• 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
set myList to myList & ... and unexpected results
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

set myList to myList & ... and unexpected results


  • Subject: set myList to myList & ... and unexpected results
  • From: Ryan Wilcox <email@hidden>
  • Date: Sun, 24 Jul 2005 02:35:11 -0400

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

Perhaps someone here can help me with a puzzle. Run the following code:

- --<code language="Applescript>

set myList to {}
set myItem to {1}

set myList to myList & myItem
set item 1 of myList to 123

set myList to myList & myItem

- --</code>

The output of this code is {123, 123}, and NOT {123, 1} like I would
expect.

Could someone explain why I get this result, please? I'm not really
interested in alternative methods, I want to know why this particular
chunk of code has this result (I suspect I'm missing a key attribute of
the language in this circumstance and want to learn :) ).

Tested on 10.4.1 and 10.4, same result.

I'm very interested in hearing the answer!

Thanks in advance,
_Ryan Wilcox
================================================================
Wilcox Development Solutions:          <http://www.wilcoxd.com>
Toolsmiths for the Internet Age            PGP: 0x2F4E9C31
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFC4y8fbYO0qC9OnDERAgapAKCLzmzWZFw68KYnd/+8Xr1rwGPZVACcCCxJ
LPYuvj+3Co3UABUlgOIgX3Q=
=V982
-----END PGP SIGNATURE-----
 _______________________________________________
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

  • Follow-Ups:
    • Re: set myList to myList & ... and unexpected results
      • From: Barry Wainwright <email@hidden>
    • Re: set myList to myList & ... and unexpected results
      • From: jj <email@hidden>
  • Prev by Date: Mount a Firewire disk
  • Next by Date: Re: Mount a Firewire disk
  • Previous by thread: Re: Mount a Firewire disk
  • Next by thread: Re: set myList to myList & ... and unexpected results
  • Index(es):
    • Date
    • Thread