In role Setty§
See primary documentation in context for method Bag
method Bag(Setty: --> Bag)
Returns a Bag
containing the elements of the invocant.
my Bag = Set.new(1, 2, 3).Bag;say ; # OUTPUT: «Bag(3 1 2)»
The quantity of the elements in this created bag will be set to one:
say (1,2,3).Bag; # OUTPUT: «1»
In Mix§
See primary documentation in context for method Bag
method Bag (--> Bag)
Coerces the Mix
to a Bag
. The weights are convert to Int
, which means the number of keys in the resulting Bag
can be fewer than in the original Mix
, if any of the weights are negative or truncate to zero.
In MixHash§
See primary documentation in context for method Bag
method Bag (--> Bag)
Coerces the MixHash
to a Bag
. The weights are converted to Int
, which means the number of keys in the resulting Bag
can be fewer than in the original MixHash
, if any of the weights are negative or truncate to zero.
In Any§
See primary documentation in context for method Bag
method Bag(--> Bag) is nodal
Coerces the invocant to Bag
, whereby Positional
s are treated as lists of values.