|parrotcode: Perl 6 Hash class, and related functions|
|Contents | Language Implementations | Perl6|
src/classes/Hash.pir - Perl 6 Hash class, and related functions
our List multi method Hash::delete ( *@keys ) our Scalar multi method Hash::delete ( $key ) is default
$keysfrom the invocant. returns the value(s) that were associated to those keys.
our Bool multi method Hash::exists ( $key )
$key, false otherwise.
multi Int|List Hash::keys ( %hash : MatchTest *@keytests ) multi Int|List Hash::kv ( %hash : MatchTest *@keytests ) multi Int|(List of Pair) Hash::pairs (%hash : MatchTest *@keytests ) multi Int|List Hash::values ( %hash : MatchTest *@keytests )
%hashin no apparent order, but the order will be the same between successive calls to these functions, as long as
@keytestsare provided, only elements whose keys evaluate
$key ~~ any(@keytests)as true are iterated.
keysonly returns the key;
kvreturns both as a 2 element list in (key, value) order,
kv %hashreturns the same as
zip(keys %hash; values %hash)
keysis not longer supported. Use the