Intersecting data question/challenge

Alex Tweedly alex at
Fri Jul 8 16:38:37 EDT 2005

Chris Sheffield wrote:

> Could you make use of the split command somehow?  You would have to  
> format your lists a little differently, but if you did it right and  
> specified a primary and secondary delimiter, you might be able to get  
> quick results and still take advantage of the intersect command.   
> Anyway, just another idea.
I tried that out; it's very similar in timing to the other array method 
(that includes the time to reformat the arrays into something that can 
be "split" as you need it - if the wider context could be changed, that 
could change).

JB said:

> put "" into myT1
> put "" into myT2
> repeat for each item i in list1
>     put 1 into myT1[i]
> end repeat
> repeat for each item i in list2
>     put 1 into myT2[i]
> end repeat
> get the keys of myT1
> repeat for each line j in it
>     if myT2[j]=1 then
>         get true
>         exit repeat
>     end if
> end repeat

If all you do with myT1 is take the keys of it, you don't need to create 
that array - you can put list2 into an array (either element by element, 
or using split), and the do a (fast)   repeat for each item of list1

Might be worth it if list2 is large enough ...

Alex Tweedly

No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.8.10/43 - Release Date: 06/07/2005

More information about the Use-livecode mailing list