Skip to content

Commit

Permalink
Add generic version of reducewith that treats its argument as a list,…
Browse files Browse the repository at this point in the history
… to allow the [+] 1 case to work.
  • Loading branch information
colomon committed Apr 3, 2010
1 parent e50ff8c commit d906f51
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/core/metaops.pm
Expand Up @@ -133,6 +133,13 @@ our multi sub reducewith(&op, Iterable $an-iterable,
$result;
}

our multi sub reducewith(&op, $arg,
:$chaining,
:$right-assoc,
:$triangle) {
reducewith(&op, $arg.list, :$chaining, :$right-assoc, :$triangle);
}

# degenerate case of operators, to be used by reduce() for the 0-ary case
# this fails for operators defined in PIR, so some of them are commented out.
our multi sub infix:<**>() { 1 }
Expand Down

0 comments on commit d906f51

Please sign in to comment.