The inverse of Interset

Phil Davis revdev at pdslabs.net
Sat Nov 10 16:31:34 EST 2012


I guess I "overkilled" it as usual. Oh well - glad it works!

Phil


On 11/10/12 1:16 PM, Jim Hurley wrote:
> Hi Phil,
>
> Thanks very much. You solved my problem. I was unaware of "delete variable myArray[tKey]"
> That is very fast.
>
> It appears that this works as well:
>
> repeat for each key tKey in the keys of arrayOne
>    delete variable arrayTwo[tKey]
> end repeat
>
> This provided a very simple way to "subtract" elements of one array from the other.
>
> Thanks again,
>
> Jim
>
>
>> Hi Jim,
>>
>> I suppose you could do a union (yielding a 3rd array) and an intersect
>> (yielding a 4th array) and then remove the intersect elements from the
>> union array. It's not what you wanted but it would work. Like so:
>>
>> put arrayOne into intersectA
>> intersect intersectA with arrayTwo
>>
>> put arrayOne into unionA
>> union unionA with arrayTwo
>>
>> repeat for each key tKey in intersectA
>>       delete variable unionA[tKey]
>> end repeat
>>
>> -- now unionA contains the anti-intersection (?) of the two original arrays
>>
>> Phil Davis
>>
>>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>

-- 
Phil Davis





More information about the use-livecode mailing list