• 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: Set [list] to [value] strangeness
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Re: (2 of 2) Application Scripting Question - Theoretical? (was Re: Technote 2106 is da Bomb) (From: Nigel Garvey <email@hidden>)
 >Re: (2 of 2) Application Scripting Question - Theoretical? (was Re: Technote 2106 is da Bomb) (From: Mr Tea <email@hidden>)
 >Re: (2 of 2) Application Scripting Question - Theoretical? (was Re: Technote 2106 is da Bomb) (From: Michael Terry <email@hidden>)
 >Set [list] to [value] strangeness (was: Re: (2 of 2) etc.) (From: Mr Tea <email@hidden>)

  • Prev by Date: Re: Adding a doc icon flag
  • Next by Date: Re: Starting a process when Mail starts - possible?
  • Previous by thread: Set [list] to [value] strangeness (was: Re: (2 of 2) etc.)
  • Next by thread: Re: (2 of 2) Application Scripting Question - Theoretical? (was Re: Technote 2106 is da Bomb)
  • Index(es):
    • Date
    • Thread