Re: Appending a list to a list and getting one list.
Re: Appending a list to a list and getting one list.
- Subject: Re: Appending a list to a list and getting one list.
- From: Arthur J Knapp <email@hidden>
- Date: Tue, 14 May 2002 09:38:38 -0400
>
Date: Mon, 13 May 2002 12:40:02 -0400
>
Subject: Appending a list to a list and getting one list.
>
From: Paul Skinner <email@hidden>
>
set bigList to {}
>
set bigListRef to a reference to bigList
>
set numItems to 10000
>
set t to (time of (current date)) --Start timing operations.
>
repeat with n from 1 to numItems
>
set bigListRef to bigListRef & n --SuperSlowDowner!
It sure is a super-slow-downer, primarily because after the first
iteration, bigListRef is no longer a reference, but the actual value
of "bigListRef & n".
You want to do any of the following:
set contents of bigListRef to bigListRef & n --> dereference
set bigList to bigListRef & n --> this does not affect the reference
set bigListRef's end to n --> append
{ Arthur J. Knapp, of <
http://www.STELLARViSIONs.com>
<
mailto:email@hidden>
(*) Happy
( ) Sad
( ) Ambivalent
( ) Ubiquitous
}
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.