Finding duplicates in a list

jbv jbv.silences at
Wed Jan 9 06:53:42 EST 2008


the following runs in 105 msec on my old G3 300 Mhz Mac,
and must be pretty fast on the latest machines...
It finds 442 duplicates.


on mouseUp
  set cursor to watch
  lock screen
  put fld 1 into a    -- fld 1 contains the 8708 lines of your list
  put "" into T
  put the milliseconds into m
  repeat for each line j in a
    add 1 to T[j]
  end repeat
  put "" into a
  repeat for each line j in the keys of T
    if T[j] > 1 then
      put j & cr after a
    end if
  end repeat
  put the milliseconds - m &cr&cr& a
end mouseUp

More information about the use-livecode mailing list