Documentation for infix (&), infix ∩
assembled from the following pages:
Language documentation: Operators §
From Operators
(Operators) infix (&), infix ∩ §
multi sub infix:<(&)>(**)
'&' 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)»
Language documentation: Sets, bags, and mixes §
(Sets, bags, and mixes) infix (&), infix ∩ §
Returns the intersection of all of its arguments. More information, Wikipedia definition.