I'm trying to define a pattern that will match lists of lists, where the inner lists contains only numbers (I want the sum of each list). Like this
{{1, 2}, {3, 4}}
But not like this
{1, {1, 3},{{3}}}
Why this is not working?
Clear[foo];
foo[x : {v___List}] := Plus @@@ x /; VectorQ[v, NumberQ]
Thank you!
VectorQ[v, NumberQ]
forv=Sequence[{1, 2}, {3, 4}]
becomesVectorQ[{1, 2}, {3, 4}, NumberQ]
thus you get the error messageVectorQ::argt: VectorQ called with **3** arguments; 1 or 2 arguments are expected.
$\endgroup$