Re: Arrays in AppleScript ?
Re: Arrays in AppleScript ?
- Subject: Re: Arrays in AppleScript ?
- From: Mark Lively <email@hidden>
- Date: Wed, 28 Dec 2005 15:11:11 -0500
On 12/28/05, Paul Berkowitz <email@hidden> wrote:
> On 12/28/05 10:55 AM, "Michael Gmail" <email@hidden> wrote:
>
> >> Worse, I don't even a have clue on how to add an entry to my array !
> >
> > set myArray to myArray & "d"
> > -- > {"a", "b", "c", "d"}
>
> Wrong. That only works here because there's an implicit coercion at work
> turning "d" into {"d"} - this only works for text items and numbers; it
> usually won't work for application objects. You need to concatenate two
> lists to each other, like this:
>
Busted. I guess you learn something new every day. I thought
*everything* was magically coerced into a 1 item list. Finder just
made a liar of me.
> You can also set the beginning of a list. What's a lot trickier in
> AppleScript than in some other languages is to insert a new element
> somewhere in the middle.
>
True, but how many languages allow you to make a list that contains itself?
set turtle to {1, 2, 3}
set item 2 of turtle to turtle
turtle
-Mark
item 1 of item 2 of item 2 of item 2 of item 2 of...
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden