Intersecting data question/challenge

jbv jbv.silences at Club-Internet.fr
Fri Jul 8 14:50:06 EDT 2005



Dennis,

Use arrays; Something like :

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

JB

> Hello clever Rev programmers,
>
> I have a simple question or maybe it is a simple challenge.
>
> I have two lists of integers.  The list are not long, perhaps 5 to 50
> items e.g.:
> list1="310,423,522,211,107,340,"
> lis2="311,312,313,318,320,323,325,330,333,337,340,"
>
> I want to find if any of the items in list1 have a match in list2.
> I know I could do it with a repeat, something like this:
>
> get false
> repeat for each item theItem in list1
>    if theItem is not among the items of list2 then next repeat
>    get true
>    exit repeat
> end repeat
>
> I was wondering if it could be done faster without a repeat through
> some Rev trick.
>
> Dennis
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list