Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
GLR-ify METAOP_REDUCE_CHAIN
  • Loading branch information
moritz committed Aug 20, 2015
1 parent 5e3cfb3 commit 91fc607
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/core/metaops.pm
Expand Up @@ -237,15 +237,20 @@ multi sub METAOP_REDUCE_CHAIN(\op, \triangle) {
#?endif
sub (*@values) {
my $state = True;
my Mu $current = @values.shift;
my \iter = @values.iterator;
my Mu $current = iter.pull-one;
gather {
take $state;
while $state && @values.gimme(1) {
$state = op.($current, @values[0]);
while $state && (my $next := iter.pull-one) !=:= IterationEnd {
$state = op.($current, $next);
take $state;
$current = @values.shift;
$current := $next;
}
unless $state {
while (my \v = iter.pull-one) !=:= IterationEnd {
take False;
}
}
take False for @values;
}
}
}
Expand Down

0 comments on commit 91fc607

Please sign in to comment.