Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Slurpy generators for series operator

Plus whitespace fixes, and a comment fixes by Moritz

Signed-off-by: moritz <moritz@faui2k3.org>
  • Loading branch information...
commit d3e040f159790d00d8e39ae298ff2bb05ee9f48e 1 parent 6c43f93
@eternaleye eternaleye authored moritz committed
Showing with 16 additions and 6 deletions.
  1. +4 −0 CREDITS
  2. +12 −6 src/setting/Operators.pm
View
4 CREDITS
@@ -310,4 +310,8 @@ N: Zach Morgan
E: zpmorgan@gmail.com
D: Rakudo patch
+N: Alex Elsayed
+U: eternaleye
+E: eternaleye@gmail.com
+
=cut
View
18 src/setting/Operators.pm
@@ -7,12 +7,18 @@ multi sub infix:<...> (@lhs, Code $generator) {
}
my @result = @lhs;
my @r;
- # XXX work around http://rt.perl.org/rt3/Ticket/Display.html?id=66824
- # this is a bit ugly.. since @a[1..1] returns a single item and not
- # an array, |@result[$one-item-range] throws the error
- # "argument doesn't array"
- while @r = $generator(|@(@result[*-$c..*-1])) {
- @result.push: @r;
+ if ?any( $generator.signature.params>>.<slurpy> ) {
+ while @r = $generator(|@result) {
+ @result.push: @r;
+ }
+ } else {
+ # XXX work around http://rt.perl.org/rt3/Ticket/Display.html?id=66824
+ # this is a bit ugly.. since @a[1..1] returns a single item and not
+ # an array, |@result[$one-item-range] throws the error
+ # "argument doesn't array"
+ while @r = $generator(|@(@result[*-$c..*-1])) {
+ @result.push: @r;
+ }
}
return @result;
}
Please sign in to comment.
Something went wrong with that request. Please try again.