• 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: Forgotten but not gone
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Forgotten but not gone


  • Subject: Re: Forgotten but not gone
  • From: Cal <email@hidden>
  • Date: Sat, 27 Jan 2001 00:33:40 -0500

Charles Arthur <email@hidden> wrote:

Richard 23 <email@hidden> wrote:
...
For reasons of efficency due to the common usage of lists the
linked list was put into the closet but not without providing
compatibility with the original data type.

So here's is an example and it's not a typo:

set x to [1, 2, 3]
set y to [4, 5, 6]
set z to x & y
set item 2 of y to 999
>z --> {1, 2, 3, 4, 999, 6}

set x to {1, 2, 3}
set y to {4, 5, 6}
set z to x & y
set item 2 of y to 999
z --> {1, 2, 3, 4, 5, 6}

Even weirder (or more fascinating):
set a to [1, 2]
set b to [3, 4]
set c to a & b
set second item of b to 99
c --> {1, 2, 3, 99}

set a to {1, 2}
set b to [3, 4]
set c to a & b
set second item of b to 99
c --> {1, 2, 3, 4}

So curly brackets rule over vectors... fascinating...

Sorry to disappoint, Charles, but nothing weird here. It's not that curly brackets rule...it's that square brackets represent an old implementation of lists, superceded in AppleScript 1.1 by a newer implementation. In the last example, concatenating a and b must necessarily make a new copy of the contents of b, because you couldn't have a single list, part as a vector and part as a linked list. Make sense?

Cal


  • Prev by Date: Re: «event sysonfo4»
  • Next by Date: AS 1.5 (OS X PB) bug fixed in 1.5.5?
  • Previous by thread: Re: Forgotten but not gone
  • Next by thread: Re: Forgotten but not gone
  • Index(es):
    • Date
    • Thread