In Sets, bags, and mixes§

See primary documentation in context for infix (&), infix ∩

Returns the intersection of all of its arguments. More information, Wikipedia definition.

In Operators§

See primary documentation in context for infix (&), infix ∩

multi infix:<(&)>(**@p)

Intersection operator.

'&' as in left hand side arguments 'and' right hand side arguments. 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)␤» 
say <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)␤»