Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make Iterable.flat propagate is-lazy
  • Loading branch information
zoffixznet committed Feb 7, 2017
1 parent 6990133 commit 51b0aba
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/Iterable.pm
Expand Up @@ -16,6 +16,7 @@ my role Iterable {
}

method flat(Iterable:D:) {
my $laze := self.is-lazy;
Seq.new(class :: does Iterator {
has Iterator $!source;
has Iterator $!nested;
Expand Down Expand Up @@ -68,7 +69,7 @@ my role Iterable {
)
);
}
}.new(self.iterator))
}.new(self.iterator)).lazy-if($laze)
}

method lazy-if($flag) { $flag ?? self.lazy !! self }
Expand Down

0 comments on commit 51b0aba

Please sign in to comment.