How do it? remove array from array

How do it? remove array from array

fanaeean
Participant Participant
498 Views
2 Replies
Message 1 of 3

How do it? remove array from array

fanaeean
Participant
Participant
I'm in problem... please help me!
example:
a = #(1,2,3,4,5,6)
b = #(2,4,5)
a + b = #(1,2,3,4,5,6)

but my knot is it.
how i do it... a - b

thnx
0 Likes
499 Views
2 Replies
Replies (2)
Message 2 of 3

Steve_Curley
Mentor
Mentor
Firstly,
if a=#(1,3,5) and b=#(2,4,6) then a+b=#(1,3,5,2,4,6) not #(1,2,3,4,5,6) unless you sort it.
a+b is equivalent to join a b.

To remove all occurances of b which exist in a you would have to cycle through the values (backwards).

Note that if the same value occurs more than once in array1 then all occurances of that value would be removed. To prevent that you would also have to remove the value from array2.

(
array1 = #(1,2,3,4,5,6)
array2 = #(3,4,5)

for a1 = array1.count to 1 by -1 do
(
if (findItem array2 array1) != 0 then
deleteItem array1 a1
)
)

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

0 Likes
Message 3 of 3

fanaeean
Participant
Participant
merci Steve :)
0 Likes