• 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: Luther Fuller <email@hidden>
  • Date: Tue, 4 Sep 2007 19:43:16 -0500

On Sep 3, 2007, at 9:31 PM, Brett Conlon wrote:
In Lotus Programming I can wrap a list in an @Unique(List variable) command and it strips out all duplicate items. What is the simplest way to do it in AS?

I'm thinking it may have to be with a repeat and using text item delimiters, right?

So, I'm sitting here with nothing else to do but be curious, so I tried ...


on uniqueList(originalList)
set newList to {}
repeat until originalList = {}
set firstItem to (first item of originalList)
set originalList to (rest of originalList)
if firstItem is not in originalList then set newList to newList & {firstItem}
end repeat
return newList
end uniqueList


Seems to work correctly. But is it fast? er?

_______________________________________________
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: 
 >Eliminating duplicate items from a list (From: Brett Conlon <email@hidden>)

  • Prev by Date: Re: Eliminating duplicate items from a list
  • Next by Date: Re: FileMaker AppleScript 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