Eliminate doubles in a long list field

Dar Scott dsc at swcp.com
Sat Jun 28 10:35:01 EDT 2003


On Saturday, June 28, 2003, at 12:15 AM, Yves COPPE wrote:

> function commonLines pList1, pList2
>    repeat for each line tLine in pList1
>      put 1 into tArray[tLine]
>    end repeat
>    repeat for each line tLine in pList2
>      if tArray[tLine] = 1 then
>        put 2 into tArray[tLine]
>        put tLine & cr after tRetVal
>      end if
>    end repeat
>    delete char -1 of tRetVal
>    return tRetVal
> end commonLines

I wonder if this is a good excuse to tinker with intersect.  This looks 
very close to working with sets.

Maybe there is a fast way with replace and split to turn a list into a 
set.

I suppose keys() can turn a set back into a list.

Order would not be preserved, though.

Dar Scott




More information about the use-livecode mailing list