Skip to content

Commit

Permalink
.pred and .succ for Rat
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Sep 22, 2009
1 parent 5d3d3a3 commit e52ed31
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/setting/Rat.pm
Expand Up @@ -36,6 +36,13 @@ class Rat {
our Num multi method sec($base = 'radians') is export {
self.Num.sec($base);
}

multi method succ {
Rat.new($!numerator + $!denominator, $!denominator);
}
multi method pred {
Rat.new($!numerator - $!denominator, $!denominator);
}
}

multi sub infix:<+>(Rat $a, Rat $b) {
Expand Down

0 comments on commit e52ed31

Please sign in to comment.