Browse files

remove abs as a prefix op, make it a normal sub instead

  • Loading branch information...
1 parent 81328c3 commit 5b56cfcf9286e70b9a77a73369b80ad98ad10786 @moritz moritz committed Jul 21, 2012
Showing with 8 additions and 9 deletions.
  1. +0 −1 src/Perl6/Grammar.pm
  2. +1 −1 src/core/Complex.pm
  3. +2 −2 src/core/Int.pm
  4. +2 −2 src/core/Num.pm
  5. +2 −2 src/core/Numeric.pm
  6. +1 −1 src/core/Real.pm
View
1 src/Perl6/Grammar.pm
@@ -2596,7 +2596,6 @@ grammar Perl6::Grammar is HLL::Grammar {
token infix:sym<|> { <sym> <O('%junctive_or')> }
token infix:sym<^> { <sym> <O('%junctive_or')> }
- token prefix:sym<abs> { <sym> » <O('%named_unary')> }
token prefix:sym<let> { <sym> \s+ <!before '=>'> <O('%named_unary')> { $*W.give_cur_block_let($/) } }
token prefix:sym<temp> { <sym> \s+ <!before '=>'> <O('%named_unary')> { $*W.give_cur_block_temp($/) } }
View
2 src/core/Complex.pm
@@ -203,7 +203,7 @@ multi sub prefix:<->(Complex:D \$a) returns Complex:D {
$new;
}
-multi sub prefix:<abs>(Complex:D \$a) returns Num:D {
+multi sub abs(Complex:D \$a) returns Num:D {
my num $re = nqp::getattr_n(nqp::p6decont($a), Complex, '$!re');
my num $im = nqp::getattr_n(nqp::p6decont($a), Complex, '$!im');
nqp::p6box_n(nqp::sqrt_n(nqp::add_n(nqp::mul_n($re, $re), nqp::mul_n($im, $im))));
View
4 src/core/Int.pm
@@ -83,10 +83,10 @@ multi prefix:<->(int $a) returns int {
nqp::neg_i($a)
}
-multi prefix:<abs>(Int:D \$a) returns Int:D {
+multi abs(Int:D \$a) returns Int:D {
nqp::abs_I(nqp::p6decont($a), Int);
}
-multi prefix:<abs>(int $a) returns int {
+multi abs(int $a) returns int {
nqp::abs_i($a)
}
View
4 src/core/Num.pm
@@ -249,10 +249,10 @@ multi prefix:<->(num $a) {
nqp::neg_n($a);
}
-multi prefix:<abs>(Num:D \$a) {
+multi sub abs(Num:D \$a) {
nqp::p6box_n(nqp::abs_n(nqp::unbox_n($a)))
}
-multi prefix:<abs>(num $a) {
+multi sub abs(num $a) {
nqp::abs_n($a)
}
View
4 src/core/Numeric.pm
@@ -37,8 +37,8 @@ multi prefix:<+>(\$a) { $a.Numeric }
proto prefix:<->(|$) { * }
multi prefix:<->(\$a) { -$a.Numeric }
-proto prefix:<abs>(|$) { * }
-multi prefix:<abs>(\$a) { abs $a.Numeric }
+proto sub abs(|$) { * }
+multi sub abs(\$a) { abs $a.Numeric }
proto sub sign(|$) {*}
multi sub sign(Numeric \$x) { $x.sign }
View
2 src/core/Real.pm
@@ -119,7 +119,7 @@ multi sub infix:<mod>(Real $a, Real $b) {
$a - ($a.Bridge.Int div $b.Bridge.Int) * $b;
}
-multi prefix:<abs>(Real \$a) {
+multi sub abs(Real \$a) {
$a < 0 ?? -$a !! $a;
}

0 comments on commit 5b56cfc

Please sign in to comment.