The intersection, union, and difference of simple members
Jul 9, 2021
Example
Find the intersection, union and difference of elements in two sets
Write the SPL script:
A1 set 1
A2 set 2
A3 The intersection of set 1 and set 2 is: [1,2,3,9,7]
A4 The union of set 1 and set 2 is: [1,4,6,2,3,9,7,5,8,7]
A5 The difference between set 1 and set 2 is: [4,6]
A6 The union of set 2 and set 1 is: [3,7,2,1,9,5,8,7,4,6]
A7 The difference between set 2 and set 1 is: [5,8,7]
It can be seen that when calculating union and difference, the order is related