Skip to content

Commit

Permalink
Implement stupid first stab at lazy series operator with code blocks.
Browse files Browse the repository at this point in the history
  • Loading branch information
colomon committed Feb 8, 2010
1 parent 7e4f20e commit 4eb9894
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/core/operators.pm
Expand Up @@ -180,3 +180,21 @@ our multi sub infix:<...>($lhs, $rhs) {
}
}
}

our multi sub infix:<...>($lhs, Code $rhs) {
if $rhs.count != 1 {
die "Series operator currently cannot handle blocks with count != 1";
}

my $i = $lhs;
gather {
take $i;
my $last = $i;
loop {
$i = $rhs.($last);
my $j = $i;
take $j;
$last = $i;
}
}
}

0 comments on commit 4eb9894

Please sign in to comment.