infix (-) , infix ∖

Documentation for infix (-) , infix ∖ assembled from the following types:

language documentation Operators

From Operators

(Operators) infix (-) , infix ∖

multi sub infix:<(-)>(**@p)
multi sub infix:<>(**@p)

Set difference operator.

Returns the set difference of all its arguments. This creates a new Set that contains all the elements the first argument has but the rest of the arguments don't, i.e., of all the elements of the first argument, minus the elements from the other arguments. But only if none of the arguments are a Bag, BagHash, Mix or MixHash.

say <a a b c a d> (-) <a a b c c># OUTPUT: «set(d)␤» 
say <a b c d e> (-) <a b c> (-) <a b d># OUTPUT: «set(e)␤» 

If any of the arguments are Baggy or Mixy>, the result is a new Bag (or Mix) containing all the elements remaining after the first argument with its weight subtracted by the weight of that element in each of the other arguments.

say <a a b c a d> (-) bag(<a b c c>); # OUTPUT: «Bag(a(2), d)␤» 
say <a a b c a d>    mix(<a b c c>); # OUTPUT: «Mix(a(2), c(-1), d)␤» 

is equivalent to (-), at codepoint U+2216 (SET MINUS).