Skip to content

Commit

Permalink
Make sure each Seq.skip gets a new Seq
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Dec 10, 2017
1 parent 0e228fa commit 854c10c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/core/Seq.pm
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,14 @@ my class Seq is Cool does Iterable does Sequence {
Seq.new(Rakudo::Iterator.CStyleLoop(&body, &cond, &afterwards))
}

multi method skip() { nqp::stmts( $!iter.skip-one, self) }
multi method skip(Int() $n) { nqp::stmts( $!iter.skip-at-least($n), self) }
multi method skip() {
my $iter := self.iterator;
Seq.new( $iter.skip-one ?? $iter !! Rakudo::Iterator.Empty )
}
multi method skip(Int() $n) {
my $iter := self.iterator;
Seq.new( $iter.skip-at-least($n) ?? $iter !! Rakudo::Iterator.Empty )
}
}

sub GATHER(&block) {
Expand Down

0 comments on commit 854c10c

Please sign in to comment.