Re: String to multiple-item list coercion
Re: String to multiple-item list coercion
- Subject: Re: String to multiple-item list coercion
- From: has <email@hidden>
- Date: Wed, 25 Sep 2002 22:36:51 +0100
Michelle Steiner wrote:
>
> set {day:a, month:b, year:c} to date "Sunday, September 1, 2002
>
> 12:00:00am"
>
>
--> date "Sunday, September 1, 2002 12:00:00 AM"
>
>
Thing is that the line doesn't do any computation,
Indeed. All it does is an assignment... or three.
>
so the result in the
>
result window is whatever is on the right side of the equation.
Uh-huh.
>
Going back to the original equation, we saw this:
>
set {a, b, c, d, e} to "abcdefgh"
>
--> "abcdefgh"
Same thing: no computation, just assignment.
>
However:
>
set {a, b, c, d, e} to "abcdefgh"
>
{a, b, c, d, e}
>
--> {"a", "b", "c", "d", "e"}
And what you're seeing here is the last statement - {a, b, c, d, e} - being
evaluated. Likewise, if you follow the date example with {a, b, c}, you see
{1, September, 2002} as the result. If the distinction isn't clear, try
writing the test script as:
set {a, b, c, d, e} to "abcdefgh"
log a
log b
log c
log d
log e
and see if that makes what's happening more obvious. My original point
being that there is no need for any obscure, alchemical, invisible
coercions in order to do a multiple assignment with a string on the
right-hand side. With ordered structures such as lists or strings,
assignments are made according to position; with unordered structures,
they're done according to labels.
HTH
has (seeking a sharper blade for my Occam's Razor...;)
--
http://www.barple.pwp.blueyonder.co.uk -- The Little Page of AppleScripts
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.