deleteDups()

Eric Chatonet eric.chatonet at sosmartsoftware.com
Tue Nov 15 17:01:51 EST 2005


Hi Chris,

Repeat for each is always much more faster than repeat with x:
So I would prefer:

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

Another advantage: the list has not to be sorted :-)

Best Regards from Paris,

Eric Chatonet.

Le 15 nov. 05 à 22:52, HyperChris at aol.com a écrit :

> I used to use an Xcmd set called HyperExternals Pro and one of its  
> useful
> XFCN's was deleteDups(). The main thing it did was to quickly  
> eliminate the
> duplicate lines in a sorted list. Here is my transcript  
> replacement ...
>  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
>  ... but I thought it might be fun to see what others have to offer  
> up that
> would be more elegant and clever! Anyone?

----------------------------------------------------------------
So Smart Software

For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch

Free plugins and tutorials on my website
----------------------------------------------------------------
Web site        http://www.sosmartsoftware.com/
Email        eric.chatonet at sosmartsoftware.com/
Phone        33 (0)1 43 31 77 62
Mobile        33 (0)6 20 74 50 86
----------------------------------------------------------------




More information about the use-livecode mailing list