Re: Eliminating duplicate items from a list
Re: Eliminating duplicate items from a list
- Subject: Re: Eliminating duplicate items from a list
- From: Brett Conlon <email@hidden>
- Date: Tue, 11 Sep 2007 18:34:10 +1100
Many thanks to all who contributed to
my request for help.
In the end I went with Mark's simple
approach to "make an empty list then write entries one at a time from
your master list to the new list and don't put it there if its already
there".
I've kept all the other responses for
future reference!
Ta muchly,
Coj
"Mark J. Reed"
<email@hidden>
Sent by: email@hidden
04/09/07 11:07 PM
|
To
| "Brett Conlon" <email@hidden>
|
cc
| email@hidden
|
Subject
| Re: Eliminating duplicate items from
a list |
|
Now that I'm more awake/caffeinated, it occurs to
me that AS will
happily do the inner loop for you:
set uniqueList to {}
repeat with origItemRef in origList
set origItem to contents of origItemRef
if uniqueList does not contain origItem then
set end of uniqueList to origItem
end
end
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. :)
--
Mark J. Reed <email@hidden>
_______________________________________________
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