Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rough but working implementations of Xop and Zop. (Had to disable X a…
…nd Z to make this work, alas, but I'm sure we'll work around that shortly.)
- Loading branch information
Showing
3 changed files
with
53 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
our multi sub zipwith(&op, Iterable $a-iterable, Iterable $b-iterable) { | ||
my $ai = $a-iterable.iterator; | ||
my $bi = $b-iterable.iterator; | ||
gather loop { | ||
my $a = $ai.get; | ||
my $b = $bi.get; | ||
last if ($a ~~ EMPTY) || ($b ~~ EMPTY); | ||
take &op($a, $b); | ||
} | ||
} | ||
|
||
our multi sub crosswith(&op, Iterable $a-iterable, Iterable $b-iterable) { | ||
my $ai = $a-iterable.iterator; | ||
my @b = $b-iterable.Seq; | ||
gather loop { | ||
my $a = $ai.get; | ||
last if ($a ~~ EMPTY); | ||
for @b -> $b { | ||
take &op($a, $b); | ||
} | ||
} | ||
} |