• 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: "Mark J. Reed" <email@hidden>
  • Date: Tue, 4 Sep 2007 09:07:58 -0400

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

  • Follow-Ups:
    • Re: Eliminating duplicate items from a list
      • From: Brett Conlon <email@hidden>
References: 
 >Eliminating duplicate items from a list (From: Brett Conlon <email@hidden>)
 >Re: Eliminating duplicate items from a list (From: email@hidden)

  • Prev by Date: Re: Eliminating duplicate items from a list
  • Next by Date: Re: Eliminating duplicate items from a list
  • Previous by thread: Re: Eliminating duplicate items from a list
  • Next by thread: Re: Eliminating duplicate items from a list
  • Index(es):
    • Date
    • Thread