• 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: Eliminating duplicate items from a list
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Re: Eliminating duplicate items from a list (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: re: FileMaker Value Lists
  • Next by Date: [OT] iSync and one other (silly) question
  • Previous by thread: Re: Eliminating duplicate items from a list
  • Next by thread: Re: Eliminating duplicate items from a list
  • Index(es):
    • Date
    • Thread