Skip to content

Commit

Permalink
Make subs infix:<..>/<^..>/<..^>/<^..^> and prefix:<^> multi's
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Mar 1, 2018
1 parent 804c009 commit f5b23a5
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/core/Range.pm
Expand Up @@ -722,21 +722,22 @@ my class Range is Cool does Iterable does Positional {
}
}

sub infix:<..>($min, $max) is pure {
Range.new($min, $max)
}
sub infix:<^..>($min, $max) is pure {
Range.new($min, $max, :excludes-min)
}
sub infix:<..^>($min, $max) is pure {
Range.new($min, $max, :excludes-max)
}
sub infix:<^..^>($min, $max) is pure {
proto sub infix:<..>(|) is pure {*}
multi sub infix:<..>($min, $max) { Range.new($min, $max) }

proto sub infix:<^..>(|) is pure {*}
multi sub infix:<^..>($min, $max) { Range.new($min, $max, :excludes-min) }

proto sub infix:<..^>(|) is pure {*}
multi sub infix:<..^>($min, $max) { Range.new($min, $max, :excludes-max) }

proto sub infix:<^..^>(|) is pure {*}
multi sub infix:<^..^>($min, $max) {
Range.new($min, $max, :excludes-min, :excludes-max)
}
sub prefix:<^>($max) is pure {
Range.new(0, $max.Numeric, :excludes-max)
}

proto sub prefix:<^>(|) is pure {*}
multi sub prefix:<^>($max) { Range.new(0, $max.Numeric, :excludes-max) }

multi sub infix:<eqv>(Range:D \a, Range:D \b) {
nqp::p6bool(
Expand Down

0 comments on commit f5b23a5

Please sign in to comment.