• 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: John W Baxter <email@hidden>
  • Date: Mon, 28 Jan 2002 16:20:50 -0800

At 11:14 -0500 1/28/2002, Arthur J Knapp wrote:
>> From: "Serge Belleudy-d'Espinose" <email@hidden>
>> Subject: Re: Sifting a list sans loop
>
>> At 22:51 -0500 26/01/02, Victor Yee wrote:
>
>>> set theList to {1, 1, {"2"}, "3", true, {4}, "3", 1}
>>> plain text of theList
>>> --> {"3", "3"}
>
>
>> !!!
>>
>> This is the second time in a week I get to see such magic code everybody
>>seems
>> to know but I can't find any written reference to in the ASLG or elsewhere.

I think it's in the ASLG, but it's only obvious if you know what to look for.

At the top of page 172 in the May 5, 1999 printed (print-to-order) form of
ASLG, we see an example (located in the description of the every element
reference form):

every word of {1, 2, 3}

which returns the empty list {} (because there are no words in that list:
lists don't have words).

It's a short step to this experiment:
every integer of {1, 2.0, 3}
which returns {1, 3}
(note that 2.0 is a floating point value which happens to contain an
integer value, but it's not a integer).

The ASLG also indicates that a plural class name can be used in place of
every, as in (my example):

numbers of {1, 2.0, 3}
which returns {1, 2.0, 3} unlike the prior example, since 2.0 is a number
although it's not an integer.

--John



--
John Baxter email@hidden Port Ludlow, WA, USA


References: 
 >Re: Sifting a list sans loop (From: Arthur J Knapp <email@hidden>)

  • Prev by Date: The Great Module Debate :) [was Re: solutions.... ]
  • Next by Date: Recursion Problems
  • Previous by thread: Re: Sifting a list sans loop
  • Next by thread: Re: Sifting a list sans loop
  • Index(es):
    • Date
    • Thread