diff --git a/doc/Type/Mix.pod6 b/doc/Type/Mix.pod6 index b628bc087..fd96ae638 100644 --- a/doc/Type/Mix.pod6 +++ b/doc/Type/Mix.pod6 @@ -44,9 +44,10 @@ C, for which it is a shorthand). Any positional parameters, regardless of their type, become elements of the mix - with a weight of C<1> for each time the parameter occurred: - my $n = mix "a", "a", "b" => 0, "c" => 3.14; - say $n.keys.map(&WHAT); # OUTPUT: «((Str) (Pair) (Pair))␤» - say $n.pairs; # OUTPUT: «(a => 2 (c => 3.14) => 1 (b => 0) => 1)␤» + my $n = mix "a", "a", "b" => 0, 3.14, π, π; # The Pair is a single element + say $n.keys.map: *.^name; # OUTPUT: «(Rat Pair Num Str)␤» + say $n.pairs; + # OUTPUT: «(3.14 => 1 (b => 0) => 1 3.141592653589793 => 2 a => 2)␤» Alternatively, the C<.Mix> coercer (or its functional form, C) can be called on an existing object to coerce it to a C. Its @@ -60,6 +61,15 @@ values become the associated numeric weights: say $n.keys.map(&WHAT); # OUTPUT: «((Str) (Str))␤» say $n.pairs; # OUTPUT: «(a => 2 c => 3.14)␤» +Elements with a 0 value, as C above, are simply eliminated from the C. + +Alternatively, since Ces are L, we can use the C<%> sigil to +declare them; in that case, we can employ C to declare their type: + + my %n is Mix = ("a", "a", "b" => 0, "c" => 3.14); + say %n.^name; # OUTPUT: «Mix␤» + say %n; # OUTPUT: «Mix(a(2), c(3.14))␤» + =head1 Operators Ces can use all kind of set operators returning either C or