Skip to content

Commit

Permalink
Start at a infix:<...>(@lhs, Whatever) implementation, which utterly …
Browse files Browse the repository at this point in the history
…fails to be called at the moment.
  • Loading branch information
colomon committed Feb 10, 2010
1 parent ae7824c commit cf189ea
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/core/operators.pm
Expand Up @@ -143,10 +143,12 @@ our sub WHAT(\$x) {
$x.WHAT
}

class Whatever { ... }

# the magic one that handles stuff like
# 'a' ... 'z' and 'z' ... 'a'
our multi sub infix:<...>($lhs, $rhs) {
if $rhs ~~ ::Whatever {
if $rhs ~~ Whatever {
my $i = $lhs;
return gather {
loop {
Expand Down Expand Up @@ -198,3 +200,11 @@ our multi sub infix:<...>($lhs, Code $rhs) {
}
}
}

our multi sub infix:<...>(@lhs, Whatever) {
given @lhs.elems {
when 2 {
@lhs[0] ... { $_ + (@lhs[1] - @lhs[0]) };
}
}
}

0 comments on commit cf189ea

Please sign in to comment.