Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Improve list handling in sequence generator.
  • Loading branch information
pmichaud committed Jul 7, 2011
1 parent c12b7cc commit 5fac548
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/operators.pm
Expand Up @@ -8,7 +8,7 @@ sub infix:<=>(Mu \$a, Mu \$b) {
}

sub SEQUENCE($left, $right, :$exclude_end) {
my @right := ($right,).list;
my @right := $right.flat;
my $endpoint = @right.shift;
my $infinite = $endpoint ~~ Whatever;
$endpoint = Bool::False if $infinite;
Expand All @@ -31,8 +31,8 @@ sub SEQUENCE($left, $right, :$exclude_end) {
($cmp < 0) ?? { $^x.succ } !! ( $cmp > 0 ?? { $^x.pred } !! { $^x } )
}

GATHER({
my @left := $left.list;
(GATHER({
my @left := $left.flat;
my $value;
my $code;
my $stop;
Expand Down Expand Up @@ -85,7 +85,7 @@ sub SEQUENCE($left, $right, :$exclude_end) {
$value = generate($code);
}
take $value unless $exclude_end;
}, :$infinite), @right;
}, :$infinite), @right).list;
}

# XXX Wants to be a macro when we have them.
Expand Down

0 comments on commit 5fac548

Please sign in to comment.