parrotcode: Perl 6 Hash class | |
Contents | Language Implementations | Perl6 |
src/builtins/hash.pir - Perl 6 Hash class
our List multi method Hash::delete ( *@keys )
our Scalar multi method Hash::delete ( $key ) is default
$key
or $keys
from 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 )
%hash
in no apparent order, but the order will be the same between successive calls to these functions, as long as %hash
doesn't change.@keytests
are provided, only elements whose keys evaluate $key ~~ any(@keytests)
as true are iterated.keys
only returns the key; values
the value; kv
returns both as a 2 element list in (key, value) order, pairs
a Pair(key, value)
.kv %hash
returns the same as zip(keys %hash; values %hash)
keys
is not longer supported. Use the .buckets
property instead.
|