Re: Set [list] to [value] strangeness
Re: Set [list] to [value] strangeness
- Subject: Re: Set [list] to [value] strangeness
- From: Axel Luttgens <email@hidden>
- Date: Thu, 15 Apr 2004 17:45:31 +0200
Mr Tea wrote:
On 14 Apr 2004, at 7.14 pm, Michael Terry wrote:
set {item 1 of {1, 2, 3}, item 2 of {1, 2, 3}, item 3 of {1, 2, 3}}
to {4, 5, 6}
Well, I liked that idea because it would corroborate my thinking that
the left hand side of 'set''s should be first class types, but if the
above were the case, then this should fail:
set {1, 2} to {3, 4, 5}
... but it doesn't.
And neither does this:
set {item 1 of {1, 2}, item 2 of {1, 2}} to {4, 5, 6}
It is almost as though the numbers on the left of 'to' are being
treated as variables.
Or is it? Here are some related conundra:
set {1} to 4
--> 4
set x to 1
set {x} to 4
--> error: can't get item 1 of 4
set {"what", "the", "hey?"} to "Verrry interestink, but stoopid!"
--> "Verrry interestink, but stoopid!"
set {"what", "the", "hey?"} to 4
--> 4
set h to "hey?"
set {"what", "the", h} to 4
--> error: can't get item 3 of 4
set h to "hey?"
set {"what", "the", h} to "Verrry interestink, but stoopid!"
--> "Verrry interestink, but stoopid!"
Hey! That's a nice one; it seems I somewhat under-estimated the "set
{...} to ..." construct in my previous posts.
set {"what", "the", h} to "Verrry interestink, but stoopid!"
h
--> "r"
With a more explicit and possibly less stoopid variant:
set {c1, c2, c3} to "Hey"
{c1, c2, c3}
--> {"H", "e", "y"}
Axel
_______________________________________________
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.