Re: Counting the items in anested list
Re: Counting the items in anested list
- Subject: Re: Counting the items in anested list
- From: Ehsan Saffari <email@hidden>
- Date: Wed, 16 May 2001 15:49:23 -0600
On Tue, 15 May 2001 12:04:41 -0700, Paul Berkowitz <email@hidden>
wrote:
>
On 5/15/01 10:48 AM, "Ehsan Saffari" <email@hidden> wrote:
>
>
> say there is a nested list and we count it's items:
>
>
>
> set x to {{"a", "b"}, {{"c", "d"}, {"e", "f"}}}
>
> set cnt to count of items in x --> 2
>
>
>
> is it possible to count the items in x (=3) without a repeat loop?
>
>
>
> hope that's clear
>
>
>
Not really clear, no. Why do you say (=3)? At the first level, there are 2
>
items (lists). At the deepest level, I guess there are 6 strings altogether.
>
At no (single) level are there 3 items.
<snip>
>
"the total number of (sub)-lists when you go as deeply as you can, but not
as
>
far as individual strings".
Thanks paul, that's it. A filter that only lets lists whose items are not
lists through. so one could get the three items:
{"a", "b"}
{"c", "d"}
{"e", "f"}
looks like a repeat loop is the only answer.
cheers
ehsan