Skip to content

Commit

Permalink
delete trailing blanks in Range.pm
Browse files Browse the repository at this point in the history
  • Loading branch information
Moritz Lenz committed Aug 28, 2010
1 parent a20e62d commit a3d4be0
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/core/Range.pm
Expand Up @@ -4,32 +4,32 @@ class Range is Iterable does Positional {
has $.max;
has $.excludes_max = Bool::False;

multi method new(::T $min, T $max,
Bool :$excludes_min = Bool::False,
multi method new(::T $min, T $max,
Bool :$excludes_min = Bool::False,
Bool :$excludes_max = Bool::False) {
self.bless(*, :$min, :$max, :$excludes_min, :$excludes_max);
}

multi method new($min, Whatever $max,
Bool :$excludes_min = Bool::False,
multi method new($min, Whatever $max,
Bool :$excludes_min = Bool::False,
Bool :$excludes_max = Bool::False) {
self.bless(*, :$min, :max(+Inf), :$excludes_min, :$excludes_max);
}

multi method new(Whatever $min, $max,
Bool :$excludes_min = Bool::False,
Bool :$excludes_min = Bool::False,
Bool :$excludes_max = Bool::False) {
self.bless(*, :min(-Inf), :$max, :$excludes_min, :$excludes_max);
}

multi method new(Whatever $min, Whatever $max,
Bool :$excludes_min = Bool::False,
Bool :$excludes_min = Bool::False,
Bool :$excludes_max = Bool::False) {
fail "*..* is not a valid range";
}

multi method new($min, $max,
Bool :$excludes_min = Bool::False,
Bool :$excludes_min = Bool::False,
Bool :$excludes_max = Bool::False) {
($min ~~ Real or $max ~~ Real)
?? self.bless(*, :min($min.Numeric), :max($max.Numeric), :$excludes_min, :$excludes_max)
Expand All @@ -41,15 +41,15 @@ class Range is Iterable does Positional {
multi method to() { $.max; }

multi method iterator() {
RangeIter.new(:value($!excludes_min ?? $!min.succ !! $!min),
RangeIter.new(:value($!excludes_min ?? $!min.succ !! $!min),
:$!max, :$!excludes_max);
}

our Str multi method perl() {
( $.min.perl,
('^' if $.excludes_min),
'..',
('^' if $.excludes_max),
( $.min.perl,
('^' if $.excludes_min),
'..',
('^' if $.excludes_max),
$.max.perl
).join('');
}
Expand Down Expand Up @@ -90,7 +90,7 @@ class Range is Iterable does Positional {
(1..$n).map: { self.pick }
}


}


Expand Down

0 comments on commit a3d4be0

Please sign in to comment.