Skip to content

Commit

Permalink
Update nqp-setting with RPA.grep
Browse files Browse the repository at this point in the history
  • Loading branch information
bacek committed Jan 29, 2011
1 parent 139ce22 commit 404b8f2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ext/nqp-rx/src/stage0/nqp-setting.nqp
Expand Up @@ -54,6 +54,16 @@ module ResizablePMCArray {
@mapped;
}

=begin item grep
Return an array with elements matching code.
=end item

method grep (&code) {
my @grepped;
for self { @grepped.push($_) if &code($_) };
@grepped;
}

=begin item reverse
Return a reversed copy of the invocant.
=end item
Expand All @@ -68,6 +78,7 @@ module ResizablePMCArray {

our sub join ($separator, *@values) { @values.join($separator); }
our sub map (&code, *@values) { @values.map(&code); }
our sub grep (&code, *@values) { @values.grep(&code); }
our sub list (*@values) { @values; }

# vim: ft=perl6
Expand Down

0 comments on commit 404b8f2

Please sign in to comment.