deleteDups()

HyperChris at aol.com HyperChris at aol.com
Wed Nov 16 10:29:56 EST 2005


Chris wrote:
function deleteDups pList
    repeat with x=number of lines in pList down to 2
    if line x of pList is line (x-1) of pList then delete line x of pList
    end repeat
  return pList
end deleteDups

then Eric Chatonet wrote ...
function deleteDups pList
  local tLine,tStrippedList
  -----
  repeat for each line tLine in pList
     if tLine is not among the lines of tStrippedList
     then put tLine & cr after tStrippedList
   end repeat
  return word 1 to -1 of tStrippedList
end deleteDups

then J. Landman Gay wrote ...
function deleteDups pList
   split pList by cr and numToChar(3)
   return keys(pList)
end deleteDups


You have enlarged my universe. Using "for each" is several orders of 
magnitude faster than my original script and "split" is faster still.



More information about the use-livecode mailing list