Skip to content

Commit

Permalink
Lightly tested ng versions of the Rakudo Any.first and Any.grep methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
colomon committed Dec 24, 2009
1 parent 9d5018c commit 0977b1e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/core/Any-list.pm
Expand Up @@ -19,6 +19,24 @@ augment class Any {
}
}
multi method first($test) {
for @.list {
if $_ ~~ $test {
return $_;
}
}
fail('No values matched');
}
our List multi method grep($test) {
gather {
for @.list {
take $_ if $_ ~~ $test;
}
}
}
multi method reverse() {
my @result;
for @.list {
Expand Down

0 comments on commit 0977b1e

Please sign in to comment.