• 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: Adding To A List
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding To A List


  • Subject: Re: Adding To A List
  • From: has <email@hidden>
  • Date: Thu, 2 Jun 2005 10:41:40 +0100

DigitEL wrote:

>Can anyone suggest why the following code which I am trying to create
>a list of incremented lists returns a list with all of the contained
>lists equal to the last list incremented?

Because all your sub-lists are the same object. You want to create a new list object each time, so change the last line to either:

     set the end of the newList to (items of currentList) -- shallow-copy the list

or:

    copy currentList to the end of the newList -- deep-copy the list

(Note: in this case it doesn't matter if you shallow- or deep-copy the list so either will do here; it's only an issue when copying a list containing other mutable objects, depending on whether or not you want to duplicate those as well.)

HTH

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

  • Follow-Ups:
    • Re: Adding To A List
      • From: kai <email@hidden>
  • Prev by Date: Automator & obj-c methods
  • Next by Date: Re: ANN: String to Property Coercion subroutines released
  • Previous by thread: Re: Adding To A List
  • Next by thread: Re: Adding To A List
  • Index(es):
    • Date
    • Thread