2 added 125 characters in body edited Aug 21 '18 at 20:05 kglr 218k1010 gold badges248248 silver badges499499 bronze badges ClearAll[foo]; foo[x : {___List?(VectorQ[#, NumberQ] &)}] := Plus @@@ x foo[{{1, 2}, {2, 3, 4}}]  {3, 9} foo[{{1, 2}, {{3}}}]  foo[{{1, 2}, {{3}}}] Note: You need to use NumericQ in place of NumberQ if you want foo[{{1, 2}, {2, 3, π}}] to return {3, 2 + 3 π}. ClearAll[foo]; foo[x : {___List?(VectorQ[#, NumberQ] &)}] := Plus @@@ x foo[{{1, 2}, {2, 3, 4}}]  {3, 9} foo[{{1, 2}, {{3}}}]  foo[{{1, 2}, {{3}}}] ClearAll[foo]; foo[x : {___List?(VectorQ[#, NumberQ] &)}] := Plus @@@ x foo[{{1, 2}, {2, 3, 4}}]  {3, 9} foo[{{1, 2}, {{3}}}]  foo[{{1, 2}, {{3}}}] Note: You need to use NumericQ in place of NumberQ if you want foo[{{1, 2}, {2, 3, π}}] to return {3, 2 + 3 π}. 1 answered Aug 21 '18 at 19:57 kglr 218k1010 gold badges248248 silver badges499499 bronze badges ClearAll[foo]; foo[x : {___List?(VectorQ[#, NumberQ] &)}] := Plus @@@ x foo[{{1, 2}, {2, 3, 4}}]  {3, 9} foo[{{1, 2}, {{3}}}]  foo[{{1, 2}, {{3}}}]