BoxSetDifference
Compute the relative complement (A \u2212 B) of two Sets.
Returns a new Set containing all elements that are in A but not in B. The result is a new Set of the same variant as A; neither input is modified.
Method Signature
BoxSetDifference(set=[set], otherSet=[any])Arguments
Argument
Type
Required
Description
Default
set
set
true
The source set (A).
otherSet
any
true
The set to subtract (B). Accepts any value castable to a Set.
Examples
Return elements present in this Set but not in another
a = [ 1, 2, 3 ].toSet();
b = [ 3, 4, 5 ].toSet();
d = a.difference( b );
writeOutput( d.size() );
Result: 2
Using the - operator shorthand
Result: 1
Related
Last updated
Was this helpful?
