• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Counting the items in anested list
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Shortening Filenames
  • Next by Date: Scope of globals, parents and children, "load script" and all that jazz
  • Previous by thread: Re: Counting the items in anested list
  • Next by thread: Re: Counting the items in anested list
  • Index(es):
    • Date
    • Thread