Skip to content

Commit

Permalink
Simple lazy implementation of .lines.
Browse files Browse the repository at this point in the history
  • Loading branch information
colomon committed Feb 7, 2010
1 parent 25b48ad commit a8ab00b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/core/IO.pm
Expand Up @@ -25,12 +25,10 @@ class IO {
}

multi method lines($limit = *) {
my @result;
#my $l = $limit ~~ Whatever ?? Inf !! $limit;
#while !$.eof && $l-- > 0 {
# push @result, $.get;
#}
@result;
my $l = $limit ~~ Whatever ?? Inf !! $limit;
gather while !$.eof && $l-- > 0 {
take $.get;
}
}

multi method print(*@items) {
Expand Down

0 comments on commit a8ab00b

Please sign in to comment.