Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Arrays in AppleScript ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Arrays in AppleScript ?



Mark J. Reed wrote:

>>BTW, note that the term 'array' is often used very loosely; e.g. C array is a _very_ different beast to an NSMutableArray in terms of implementation and behaviour.
>
>Whatever the heck an NSMutableArray is, sure.

See the Cocoa API (where the OP is coming from).


>It would be odd to call Lisp lists arrays

Lisp lists are linked lists - so, yup, it would be odd.


>None of which has anything to do with AppleScript, so let's move on.

Indeed; this sort of algorithm stuff is more than the typical ASer needs to know.


>> >What's a lot trickier in AppleScript than in some other languages is to insert a new element somewhere in the middle.
>>
>>Not so much tricky as impossible; you have to create a brand new list
>
>Adding an element via concatenation does the same thing, does it not?

Insertion would modify the existing list in-place, e.g.:

lst = [1, 2, 3]
lst.insert(2, 'a')
print lst # -> [1, 2, 'a', 3]


>>BTW, the List library on AppleMods <<http://applemods.sourceforge.net> http://applemods.sourceforge.net> contains ready-made handlers that will perform this and other basic list operations for you
>
>Dang useful stuff.   Oughta be in the core language if you ask me. :)

In most languages this sort of basic functionality is - often built into the list type itself. Had AS development not been curtailed early on, I imagine it would have found its way into AS as well.


Mark Lively wrote:

>but how many languages allow you to make a list that contains itself?

Quite a few.

has
--
http://freespace.virgin.net/hamish.sanderson/
 _______________________________________________
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

References: 
 >Re: Arrays in AppleScript ? (From: "Mark J. Reed" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.