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)

Intersection operator.

Returns the intersection of all of its arguments. This creates a new Set that contains only the elements common to all of the arguments if none of the arguments are a Bag, BagHash, Mix or MixHash.

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

If any of the arguments are Baggy or Mixy>, the result is a new Bag (or Mix) containing the common elements, each weighted by the largest common weight (which is the minimum of the weights of that element over all arguments).

say <a a b c a> (&) bag(<a a b c c>); # OUTPUT: «Bag(a(2), b, c)␤» 

is equivalent to (&), at codepoint U+2229 (INTERSECTION).