• 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: ranting about "as item"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ranting about "as item"


  • Subject: Re: ranting about "as item"
  • From: Richard 23 <email@hidden>
  • Date: Sun, 3 Dec 2000 09:05:30 -0800

> That's right. And coercing something "as list as item" the way it
>was written a few posts back in this thread was resulting in the "as
>item" coercion doing precisely nothing.

I don't really know why you keep saying that over and over again.
Repetition doesn't makes something more true! 8)

{1, 2, 3} as item
--> {1, 2, 3}

{1} as item
--> 1

An Item is defined as an element of a list.
or more generally any item in a container.

when you have a single-item list, "as item" coerces the list to an item,
or more simply gets the element from the list.

when a applied to any value, an attempt is made to get the value contained
by that item. Here's another example.

--------------------

set dumList to words of "apple banana pear"
set theList to {a reference to dumList's 2nd item, "four", 10}

set {valueList, itemList, contentList} to {{}, {}, {}}

repeat with theValue in theList
set end of valueList to theValue
set end of itemList to theValue as item
set end of contentList to theValue's contents
end repeat

* * * * * * * * * * *



get valueList -- we know this is going to be messed up

--> {item 1 of {item 2 of {"apple", "banana", "pear"}, "four", 10},
item 2 of {item 2 of {"apple", "banana", "pear"}, "four", 10}, item 3 of
{item 2 of {"apple", "banana", "pear"}, "four", 10}}



get contentList -- this is a little better

--> {item 2 of {"apple", "banana", "pear"}, "four", 10}



get itemList -- here's the "as item" result

-->{"banana", "four", 10}



Yeah, "as item" isn't doing anything there either is it?


R23


  • Prev by Date: re: Month as Integer (or he's ranting again)
  • Next by Date: Finder's open event has properties? Cal?
  • Previous by thread: Re: ranting again
  • Next by thread: Finder's open event has properties? Cal?
  • Index(es):
    • Date
    • Thread