infix (&)

Documentation for infix (&) assembled from the following types:

language documentation Sets, bags, and mixes

From Sets, bags, and mixes

(Sets, bags, and mixes) infix (&)

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

Intersection operator. It is of precedence "Junctive and".

Returns the intersection of all of its arguments. Generally, this creates a new Set that contains only the elements common to all of the arguments.

<a b c> (&) <b c d> === set <b c>
<a b c d> (&) <b c d e> (&) <c d e f> === set <c d>

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

bag(<a a b c a>(&) bag(<a a b c c>=== bag(<a a b c>)