Re: AppleScript-Users Digest, Vol 4, Issue 433
Re: AppleScript-Users Digest, Vol 4, Issue 433
- Subject: Re: AppleScript-Users Digest, Vol 4, Issue 433
- From: Emmanuel <email@hidden>
- Date: Tue, 4 Sep 2007 21:22:57 +0200
At 12:10 PM -0700 9/4/07, Stockly, Ed wrote:
set uniqueList to {}
repeat with x from 1 to count of origList
if item x of origList is not in uniqueList then
set the end of uniqueList to item x of origList
end if
end repeat
Which doesn't change the runtime, but does make it simpler to write.
Don't get me started on the need to explicitly dereference elements
obtained via "repeat with...in", though. :)
Probably faster because there is no need to dereference elements.
Sorry, Ed, I'm afraid your code is slower, because it has to
dereference each item twice. Dereferencing is expensive (CPU-wise),
and Mark's point is to do it once for all.
For those not familiar with the issue: item x of origList is a
reference to that item, that's why you can do "set item x of origList
to "what a beautiful world"", so each time AppleScript has to use its
value it will have to retrieve it in the list.
Emmanuel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden