The inverse of Interset

Jim Hurley jhurley0305 at sbcglobal.net
Sat Nov 10 16:16:02 EST 2012


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




More information about the use-livecode mailing list