Skip to content

Commit

Permalink
remove implicit type constraint in .pairs
Browse files Browse the repository at this point in the history
Also refactored to make a bit faster when no indices are given, pmichaud++
  • Loading branch information
moritz committed Mar 8, 2009
1 parent 0f1c600 commit 051ad51
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/setting/Any-list.pm
Expand Up @@ -33,11 +33,16 @@ class Any is also {
};


multi method pairs(@values: *@indices) {
multi method pairs(*@indices) {
gather {
for (@values.keys Z @values) -> $key, $val is rw {
take ($key => $val)
unless (@indices && ($key !~~ any(@indices)));
if @indices {
for (self.list.keys Z self.list) -> $key, $val is rw {
take ($key => $val) if $key ~~ any(@indices);
}
} else {
for (self.list.keys Z self.list) -> $key, $val is rw {
take ($key => $val)
}
}
}
}
Expand Down

0 comments on commit 051ad51

Please sign in to comment.