Bag
ErrorsCollection

Bag

Synthesised documentation from type/MixHash type/Any type/Setty type/Mix

From type/MixHash

See Original text in context

method Bag (--> Bag:D)

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.

From type/Any

See Original text in context

method Bag(--> Bag:Dis nodal

Coerces the invocant to Bag, whereby Positional are treated as lists of values.

From type/Setty

See Original text in context

method Bag(Setty:D: --> Bag:D)

Returns a Bag containing the elements of the invocant.

my Bag $b = Set.new(123).Bag;
say $b;                                           # OUTPUT: «Bag(3 1 2)␤»

The quantity of the elements in this created bag will be set to one:

say (1,2,3).Bag{1};                              # OUTPUT: «1␤»

From type/Mix

See Original text in context

method Bag (--> Bag:D)

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.