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
://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", &q
No need to sort version:
on deletedups aList
retlist=[]
repeat while aList.count()
aItem = aList[1]
add(retList,aList[1])
aList.deleteAt(1)
repeat while aList.getOne(aItem)
aList.deleteOne(aItem)
end repeat
end repeat
return retList
end
_
Stephen Ingrum
Another variation on a theme...
on removeDuplicates vlist
sort vlist
repeat with i = count(vlist) down to 2
if vlist[i] = vlist[i-1] then vlist.deleteAt(i)
end repeat
end
[To remove yourself from this list, or to change to digest mode, go to