Skip to content

Commit

Permalink
bring Hash.reverse up to date; test S32-hash/reverse.t
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Apr 10, 2009
1 parent 7b2c47c commit 029aa51
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/setting/Hash.pm
@@ -1,8 +1,12 @@
class Hash is also {
our Hash multi method reverse ( %hash: ) is export {
my %result;
(%result).{%hash.values} = %hash.keys;
%result;
multi method reverse () is export {
gather {
for @.pairs {
for @( .value ) -> $i {
take ($i => .key)
}
}
}
}

multi method push (*@values) {
Expand Down
1 change: 1 addition & 0 deletions t/spectest.data
Expand Up @@ -322,6 +322,7 @@ S32-hash/exists.t
S32-hash/keys_values.t
S32-hash/pairs.t
S32-hash/push.t
S32-hash/reverse.t
S32-hash/slice.t
S32-list/end.t
S32-list/first.t
Expand Down

0 comments on commit 029aa51

Please sign in to comment.