Intersecting data question/challenge
Dennis Brown
see3d at writeme.com
Fri Jul 8 14:50:40 EDT 2005
Eric,
Yes, I looked at the intersect command, but it performs the action on
the keys not the data from a list. I would have to create an array
element for each integer in the list with the integer as the key.
Sounded like two loops that would run even slower than my example:
repeat for each item theItem in list1
put empty into myArray1[theItem]
end repeat
repeat for each item theItem in list2
put empty into myArray2[theItem]
end repeat
intersect myArray1 with myArray2
if the keys of myArray1 is empty then get false else get true
In actual practice, the above example runs 3 times slower than the
below example for the sample data shown.
However, knowing that Rev had such a command for the keys, I thought
perhaps someone knew of a more clever way to use it, or maybe there
was another way to intersect data.
Dennis
On Jul 8, 2005, at 1:41 PM, Eric Chatonet wrote:
> Hi Dennis,
>
> You astonished me!
>
> Are you not the guy who is fascinated by arrays?
> And, may be, by the intersect command?
>
> Le 8 juil. 05 à 19:12, Dennis Brown a écrit :
>
>
>> 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,"
>> list2="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.
>>
>
> Best Regards from Paris,
>
> Eric Chatonet.
> ----------------------------------------------------------------
> 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
> ----------------------------------------------------------------
>
> _______________________________________________
> 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