Skip to content

Commit

Permalink
Produce a known-lazy Seq from List.roll(*)
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Aug 19, 2015
1 parent 52bf81a commit a343c2f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/core/List.pm
Expand Up @@ -608,9 +608,8 @@ my class List does Iterable does Positional { # declared in BOOTSTRAP
my $elems = self.elems;
return () unless $elems;

gather loop {
take nqp::atpos($!reified,$elems.rand.floor);
}
# directly use Seq.from-loop so that the result is known infinite
Seq.from-loop({nqp::atpos($!reified, $elems.rand.floor)});
}
multi method roll(\number) {
return self.roll(*) if number == Inf;
Expand Down

0 comments on commit a343c2f

Please sign in to comment.