开发者

How do I count a List of Lists?

Thanks again everyone, I can't believe how far this has come. Almost there.

How do I ex开发者_开发技巧tend 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}, ...}?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜