Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add Cool.Real, Cool.Int, Cool.Rat, and Cool.Num. Eliminate Str.Num an…
…d Str.Int.
  • Loading branch information
colomon committed Aug 30, 2010
1 parent 2ee5725 commit 6ccdcda
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
16 changes: 16 additions & 0 deletions src/core/Cool-num.pm
Expand Up @@ -3,6 +3,22 @@ augment class Cool {
pir::set__NP(self);
}

method Real() {
(+self).Real;
}

method Int() {
(+self).Int;
}

method Rat(::Real $epsilon = 1.0e-6) {
(+self).Rat($epsilon);
}

method Num() {
(+self).Num;
}

method abs($x:) {
(+$x).abs;
}
Expand Down
5 changes: 0 additions & 5 deletions src/core/Str.pm
Expand Up @@ -3,11 +3,6 @@ augment class Str does Stringy {

method Str() { self }

# CHEAT: this implementation is a bit of a cheat,
# but works fine for now.
multi method Int { (+self).Int; }
multi method Num { (+self).Num; }

my @KNOWN_ENCODINGS = <utf-8 iso-8859-1 ascii>;

# XXX: We have no $?ENC or $?NF compile-time constants yet.
Expand Down

0 comments on commit 6ccdcda

Please sign in to comment.