• 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: Sifting a list sans loop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sifting a list sans loop


  • Subject: Re: Sifting a list sans loop
  • From: Victor Yee <email@hidden>
  • Date: Sat, 26 Jan 2002 22:51:52 -0500

On Sat, 26 Jan 2002 20:43:13 -0600, ehsan saffari wrote,

> I have many lists of 2000-5000 items.
> In each list each item is either a list or a string.
> I need to discard the lists and keep the strings for further processing.
> Is there a method (osax included) that would allow me to discard the list
> items without using a loop:

You could try asking for the "plain text" of the list. I'm not sure how stable
that would be on large lists, but it works fine with small lists.

set theList to {1, 1, {"2"}, "3", true, {4}, "3", 1}
plain text of theList
--> {"3", "3"}

Also works with other classes:

lists of theList
--> {{"2"}, {4}}

numbers of theList
--> {1, 1, 1}

booleans of theList
--> {true}

Victor


  • Follow-Ups:
    • Re: Sifting a list sans loop
      • From: "Serge Belleudy-d'Espinose" <email@hidden>
  • Prev by Date: Re: Problems with speed & issues with coercion in OS 9.2.2
  • Next by Date: Re: Not so sure (was Re: Scott Norton is brilliant (was:
  • Previous by thread: Re: Sifting a list sans loop
  • Next by thread: Re: Sifting a list sans loop
  • Index(es):
    • Date
    • Thread