Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

lazy implementation of List.first. colomon++

Signed-off-by: Moritz Lenz <moritz@faui2k3.org>
  • Loading branch information...
commit 56fad03b58505c93f3e4ba4975b077d882563bc1 1 parent 57a1482
@timo timo authored moritz committed
Showing with 2 additions and 4 deletions.
  1. +2 −4 src/core/Any.pm
View
6 src/core/Any.pm
@@ -38,10 +38,8 @@ my class Any {
self.map({ $_ if $_ ~~ $test });
}
method first(Mu $test) is rw {
- for self.list {
- return $_ if $_ ~~ $test;
- }
- Nil;
+ my @results := self.grep($test);
+ @results ?? @results[0] !! Nil;
}
method join($separator = '') {
Please sign in to comment.
Something went wrong with that request. Please try again.