Documentation for routine hash

Documentation for routine hash, assembled from the following types:

class Any

From Any

(Any) method hash

Defined as:

method hash(--> Hash:Dis nodal

Coerce the invocant to Hash.

role Baggy

From Baggy

(Baggy) method hash

Defined as:

method hash(Baggy:D: --> Hash:D)

Returns a Hash where the elements of the invocant are the keys and their respective weights the values;

my $breakfast = bag <eggs bacon bacon>;
my $h = $breakfast.hash;
say $h.WHAT;                                      # OUTPUT: «(Hash)␤» 
say $h;                                           # OUTPUT: «{bacon => 2, eggs => 1}␤» 

class Capture

From Capture

(Capture) method hash

Defined as:

method hash(Capture:D: --> Associative)

Returns the named/hash part of the Capture.

my Capture $c = \(235apples => (red => 2));
say $c.hash# OUTPUT: «␤» 

class Match

From Match

(Match) method hash

Returns a hash of named submatches.