Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Preliminary Range.WHICH
  • Loading branch information
lizmat committed Sep 2, 2014
1 parent bf4b469 commit 49af621
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/core/Range.pm
Expand Up @@ -41,6 +41,15 @@ my class Range is Iterable is Cool does Positional {
self;
}

multi method WHICH (Range:D:) {
self.^name
~ "|$!min"
~ ("^" if $!excludes_min)
~ '..'
~ ("^" if $!excludes_max)
~ $!max;
}

method flat() { nqp::p6list(nqp::list(self), List, Bool::True) }
method infinite() { nqp::p6bool(nqp::istype($!max, Num)) && $!max eq 'Inf' }
method iterator() { self }
Expand Down

0 comments on commit 49af621

Please sign in to comment.