Re: Arrays in AppleScript ?
Re: Arrays in AppleScript ?
- Subject: Re: Arrays in AppleScript ?
- From: has <email@hidden>
- Date: Wed, 28 Dec 2005 23:14:41 +0000
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