Reputation: 105
Thanks again everyone, I can't believe how far this has come. Almost there.
How do I extend the Length function.
i.e.
I can count {1,3}
by Length[{1,3}]
2
But how do I count the length of each set in the list {{1,3}, {1,1,3}, ...}
?
Upvotes: 1
Views: 989
Reputation: 61046
Just try
Length /@ {{1},{1,2,3}}
Which is an abbreviation of:
Map[Length, {{1},{1,2,3}}]
Map
applies a function (in this case Length[]
)element-wise over lists.
Upvotes: 6