Re: Counting the items in anested list
Re: Counting the items in anested list
- Subject: Re: Counting the items in anested list
- From: Nigel Garvey <email@hidden>
- Date: Fri, 18 May 2001 12:21:24 +0100
Ehsan Saffari wrote on Wed, 16 May 2001 15:49:23 -0600:
>
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.
And recursion, as in Paul's script.
For what it's worth, my take on that would be:
on listlessLists(aList)
set x to lists of aList
if x is {} then
1 -- add this listless list to the count
else
0 -- initialise the count
repeat with thisList in x
result + listlessLists(thisList)
end repeat
end if
-- return the result
end listlessLists
NG