start with a sorted list
sort(aList)

then use something like

on deletedups aList
    retlist=[]
    cnt=count(aList)
    repeat with i=1 to cnt
        if not (inList(aList[i],retList)) then
            add(retList,aList[i])
        end if
    end repeat
return retList
end


on inlist aItem, alist
    cnt=count(alist)
    isinlist=0
    repeat with i=1 to cnt
        if aname=alist[i] then
            isinlist=1
            exit repeat
        else if aItem< alist[i] then
            exit repeat
        end if
    end repeat
    return isinlist
end


Stephen Ingrum
LeagueofDesign.com
http://www.leagueofdesign.com


----- Original Message ----- 
From: "Changhsu P. Liu" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, September 08, 2000 5:36 PM
Subject: <lingo-l> Find duplicates in a list


> Is there a way to find duplicate items in a list?
> 
> aList = ["mary", "mary", "john", "steve", "john", "mary"]
> 
> How can I find how many mary and john are in the list and its location 
> without doing a lot of repeats?
> 
> Thanks,
> 
> 
> Changhsu Liu
> [EMAIL PROTECTED]
> 
> 
> [To remove yourself from this list, or to change to digest mode, go to
> http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
> email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
> Lingo-L is for learning and helping with programming Lingo.  Thanks!]
> 
> 


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to