Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
can now use multis to distinguish zip/cross-with
  • Loading branch information
TimToady committed Sep 24, 2015
1 parent 9257a86 commit f89dc23
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/core/List.pm
Expand Up @@ -980,8 +980,11 @@ multi sub infix:<cmp>(@a, @b) {
(@a Zcmp @b).first(&prefix:<?>) || @a <=> @b
}

sub infix:<X>(+lol, :$with) {
return METAOP_CROSS($with, find-reducer-for-op($with))(|lol.list) with $with;
proto sub infix:<X>(|) {*}
multi sub infix:<X>(+lol, :$with!) {
METAOP_CROSS($with, find-reducer-for-op($with))(|lol.list);
}
multi sub infix:<X>(+lol) {
my int $n = lol.elems - 1;
my $laze = False;
my @l = do for 0..$n -> $i {
Expand Down Expand Up @@ -1094,8 +1097,11 @@ sub infix:<X>(+lol, :$with) {

my &cross = &infix:<X>;

sub infix:<Z>(+lol, :$with) {
return METAOP_ZIP($with, find-reducer-for-op($with))(|lol.list) with $with;
proto sub infix:<Z>(|) {*}
multi sub infix:<Z>(+lol, :$with!) {
METAOP_ZIP($with, find-reducer-for-op($with))(|lol.list);
}
multi sub infix:<Z>(+lol) {
my $arity = lol.elems;
my $laze = True;
return () if $arity == 0;
Expand Down

0 comments on commit f89dc23

Please sign in to comment.