What would be the easiest way to compare multiple arrays, and remove duplicates?
So (arrays inside arrays in this case)…
a = [[2, 1], [3, 3], [7, 2], [5, 6]]
b = [[2, 1], [6, 7], [9, 9], [4, 3]]
c = [[2, 1], [1, 1], [2, 2], [9, 9]]
d = [[2, 1], [9, 9], [2, 2], [3, 1]]
…would come out (with priority given to array a, then b, then c, then d)
a = [[2, 1], [3, 3], [7, 2], [5, 6]]
b = [[6, 7], [9, 9], [4, 3]]
c = [[1, 1], [2, 2]]
d = [[3, 1]]
It’s just set difference or subtraction and you can write it as such. Operator overloading can be a bliss 🙂
ais what it is.