• 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: Arrays in AppleScript ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

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

  • Prev by Date: Re: Arrays in AppleScript ?
  • Next by Date: Mail 1.0, 2.0 etc.
  • Previous by thread: Re: Arrays in AppleScript ?
  • Next by thread: Mark's Back!
  • Index(es):
    • Date
    • Thread