roleQuantHashdoesAssociative { }

The QuantHash role provides the basic functionality shared by the Setty, Baggy and Mixy roles. These provide object hashes whose values are limited in some way.

QuantHashes are what set operators use internally.

Methods§

method hash§

methodhash()

Coerces the QuantHash object to a Hash (by stringifying the objects for the keys) with the values of the hash limited to the same limitation as QuantHash, and returns that.

method Hash§

methodHash()

Coerces the QuantHash object to a Hash (by stringifying the objects for the keys) without any limitations on the values, and returns that.

method Map§

methodMap()

Available as of the 2021.02 release of the Rakudo compiler.

Coerces the QuantHash object to a Map (by stringifying the objects for the keys) without any limitations on the values, and returns that.

method of§

methodof()

Returns the type of value a value of this QuantHash may have. This is typically Bool for Setty, UInt for Baggy or Real for Mixy roles.

method keyof§

methodkeyof()

Returns the type of value a key of this subclass of QuantHash may have. This is typically Mu, which is also the default for punned QuantHashes.

method Capture§

methodCapture()

Returns the object as a Capture by previously coercing it to a Hash.

method list§

multimethodlist(QuantHash:D:)

Returns a list of Pair objects of all keys and values in the QuantHash.

method Setty§

methodSetty(--> Setty:D)

Coerce the QuantHash object to the equivalent object that uses the Setty role. Note that for Mixy type coercion items with negative values will be skipped.

my%bisBag=one=> 1, two => 2; say%b.Setty; # OUTPUT: «Set(one two)␤» my%misMix=one=> 1, minus => -1; say%m.Setty; # OUTPUT: «Set(one)␤»

method Baggy§

methodBaggy(--> Baggy:D)

Coerce the QuantHash object to the equivalent object that uses the Baggy role. Note that for Mixy type coercion items with negative values will be skipped.

my%sisSet=<one two>; say%s.Baggy; # OUTPUT: «Bag(one two)␤» my%misMix=one=> 1, minus => -1; say%m.Baggy; # OUTPUT: «Bag(one)␤»

method Mixy§

methodMixy(--> Mixy:D)

Coerce the QuantHash object to the equivalent object that uses the Mixy role.

my%sisSet=<one two>; say%s.Mixy; # OUTPUT: «Mix(one two)␤» my%bisBag=one=> 1, two => 2; say%b.Mixy; # OUTPUT: «Mix(one two(2))␤»

Typegraph§

Type relations for QuantHash
raku-type-graphQuantHashQuantHashAssociativeAssociativeQuantHash->AssociativeBaggyBaggyBaggy->QuantHashSettySettySetty->QuantHashMuMuAnyAnyAny->MuBagBagBag->BaggyBag->AnyMixyMixyMixy->BaggyBagHashBagHashBagHash->BaggyBagHash->AnySetSetSet->SettySet->AnySetHashSetHashSetHash->SettySetHash->AnyMixHashMixHashMixHash->AnyMixHash->MixyMixMixMix->AnyMix->Mixy

Expand chart above

close