setDifference

setDifference(set1, set2)

Try it yourself:


Remove set members with setDifference

setDifference(A, B) returns members in A that are not in B. It is useful for exclusions, permission gaps, and comparing lists after deduplication.

Example

With A = {1,2,3} and B = {2,4}, the difference is {1,3}. The operation is directional: reversing inputs changes the result. Compare setSymDifference for members unique to either set and setIntersect for shared members.

Input notes

Set equality rules determine whether two values match. Use setDistinct when source collections contain duplicates and setIsSubset to test containment rather than construct a result.

Try Set Difference in Calcul.io

Start with one of the editable examples above, then replace its arguments with your own values. Keeping the function on a separate calculator line makes the input and result easy to compare. For a longer workflow, assign the result to a variable or reference that line in the next expression.

Check the shown signature before adding optional arguments, and use the related-function links to compare operations with similar purposes.

All functions