How to get the difference between two lists?

Yves COPPE yvescoppe at skynet.be
Mon Apr 4 01:44:02 EDT 2005


Le 4 avr. 05, à 07:23, Ken Ray a écrit :

> On 4/3/05 10:49 PM, "Richard Gaskin" <ambassador at fourthworld.com> 
> wrote:
>
>>
>> With 10,000 lines in my main list and 5,000 lines in my exclude list, 
>> it
>> takes only 25 milliseconds to use this on my single-processor PBG4 
>> 1MHz:
>
> Unfortunately this is something that will be executed in a loop several
> thousand times, so even at 25ms * 2000 that ends up being 50 seconds, 
> which
> is way too long.
>
>


Hi Ken,

Try this :

on mouseUp
   answer excludeLines(fld "Liste2", fld "Liste1")
end mouseUp


function excludeLines 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 excludeLines



here it works.


Greetings.

Yves COPPE
yvescoppe at skynet.be


More information about the use-livecode mailing list