Skip to content

Commit

Permalink
Add Range.from and Range.to (why are these in the spec?!) and a very …
Browse files Browse the repository at this point in the history
…stupid but mostly functional implementation of Range.Num.
  • Loading branch information
colomon committed Feb 10, 2010
1 parent 7dc1b95 commit 6a00fc0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/core/Range.pm
Expand Up @@ -42,6 +42,9 @@ class Range is Iterable {
($.min, $.max)
}

multi method from() { $.min; }
multi method to() { $.max; }

# Beautiful implementation which does not work yet in ng
# our Str multi method perl() {
# [~]
Expand All @@ -63,6 +66,10 @@ class Range is Iterable {
our Str multi method Str() {
$.iterator.join(" ");
}

our multi method Num() {
$.iterator.Seq.elems;
}
}

our multi sub infix:<..>($min, $max) {
Expand Down

0 comments on commit 6a00fc0

Please sign in to comment.