Permalink
Browse files

start to switch some protos to a more constraint signature

we want things like  @list.map: &sin; to work, and that can only work
if &sin is arity 1, so it cannot have a proto sig of (|)
  • Loading branch information...
moritz committed Oct 27, 2012
1 parent 72ec639 commit ce3b28dec57eda34fe0b477f819df74fd9bab47a
Showing with 43 additions and 43 deletions.
  1. +2 −2 src/core/List.pm
  2. +41 −41 src/core/Numeric.pm
View
@@ -401,10 +401,10 @@ multi infix:<xx>(Mu \x, $n is copy, :$thunked) {
GatherIter.new({ take ($thunked ?? x.() !! x) while $n-- > 0; }, :infinite($n == $Inf)).list
}
-proto sub pop(|) {*}
+proto sub pop(@) {*}
multi sub pop(@a) { @a.pop }
-proto sub shift(|) {*}
+proto sub shift(@) {*}
multi sub shift(@a) { @a.shift }
proto sub unshift(|) {*}
View
@@ -31,146 +31,146 @@ multi sub infix:<eqv>(Numeric:D $a, Numeric:D $b) {
## arithmetic operators
-proto prefix:<+>(|) { * }
+proto prefix:<+>($?) { * }
multi prefix:<+>(\a) { a.Numeric }
-proto prefix:<->(|) { * }
+proto prefix:<->($?) { * }
multi prefix:<->(\a) { -a.Numeric }
-proto sub abs(|) { * }
+proto sub abs($) { * }
multi sub abs(\a) { abs a.Numeric }
-proto sub sign(|) {*}
+proto sub sign($) {*}
multi sub sign(Numeric \x) { x.sign }
multi sub sign(Cool \x) { x.Numeric.sign }
-proto sub log(|) {*}
+proto sub log($, $?) {*}
multi sub log(Numeric $x) { $x.log }
multi sub log(Numeric $x, Numeric $base) { $x.log($base) }
multi sub log(Cool $x) { $x.Numeric.log }
multi sub log(Cool $x, Cool $base) { $x.Numeric.log($base.Numeric) }
-proto sub log10(|) {*}
+proto sub log10($, $?) {*}
multi sub log10(Numeric $x) { $x.log(10e0) }
multi sub log10(Cool $x) { $x.Numeric.log(10e0) }
-proto sub exp(|) {*}
+proto sub exp($) {*}
multi sub exp(Numeric $x) { $x.exp }
multi sub exp(Numeric $x, Numeric $base) { $x.exp($base) }
-proto sub sin(|) {*}
+proto sub sin($) {*}
multi sub sin(Numeric \x) { x.sin }
multi sub sin(Cool \x) { x.Numeric.sin }
-proto sub asin(|) {*}
+proto sub asin($) {*}
multi sub asin(Numeric \x) { x.asin }
multi sub asin(Cool \x) { x.Numeric.asin }
-proto sub cos(|) {*}
+proto sub cos($) {*}
multi sub cos(Numeric \x) { x.cos }
multi sub cos(Cool \x) { x.Numeric.cos }
-proto sub acos(|) {*}
+proto sub acos($) {*}
multi sub acos(Numeric \x) { x.acos }
multi sub acos(Cool \x) { x.Numeric.acos }
-proto sub tan(|) {*}
+proto sub tan($) {*}
multi sub tan(Numeric \x) { x.tan }
multi sub tan(Cool \x) { x.Numeric.tan }
-proto sub atan(|) {*}
+proto sub atan($) {*}
multi sub atan(Numeric \x) { x.atan }
multi sub atan(Cool \x) { x.Numeric.atan }
-proto sub sec(|) {*}
+proto sub sec($) {*}
multi sub sec(Numeric \x) { x.sec }
multi sub sec(Cool \x) { x.Numeric.sec }
-proto sub asec(|) {*}
+proto sub asec($) {*}
multi sub asec(Numeric \x) { x.asec }
multi sub asec(Cool \x) { x.Numeric.asec }
-proto sub cosec(|) {*}
+proto sub cosec($) {*}
multi sub cosec(Numeric \x) { x.cosec }
multi sub cosec(Cool \x) { x.Numeric.cosec }
proto sub acosec(|) {*}
multi sub acosec(Numeric \x) { x.acosec }
multi sub acosec(Cool \x) { x.Numeric.acosec }
-proto sub cotan(|) {*}
+proto sub cotan($) {*}
multi sub cotan(Numeric \x) { x.cotan }
multi sub cotan(Cool \x) { x.Numeric.cotan }
-proto sub acotan(|) {*}
+proto sub acotan($) {*}
multi sub acotan(Numeric \x) { x.acotan }
multi sub acotan(Cool \x) { x.Numeric.acotan }
-proto sub sinh(|) {*}
+proto sub sinh($) {*}
multi sub sinh(Numeric \x) { x.sinh }
multi sub sinh(Cool \x) { x.Numeric.sinh }
-proto sub asinh(|) {*}
+proto sub asinh($) {*}
multi sub asinh(Numeric \x) { x.asinh }
multi sub asinh(Cool \x) { x.Numeric.asinh }
-proto sub cosh(|) {*}
+proto sub cosh($) {*}
multi sub cosh(Numeric \x) { x.cosh }
multi sub cosh(Cool \x) { x.Numeric.cosh }
-proto sub acosh(|) {*}
+proto sub acosh($) {*}
multi sub acosh(Numeric \x) { x.acosh }
multi sub acosh(Cool \x) { x.Numeric.acosh }
-proto sub tanh(|) {*}
+proto sub tanh($) {*}
multi sub tanh(Numeric \x) { x.tanh }
multi sub tanh(Cool \x) { x.Numeric.tanh }
-proto sub atanh(|) {*}
+proto sub atanh($) {*}
multi sub atanh(Numeric \x) { x.atanh }
multi sub atanh(Cool \x) { x.Numeric.atanh }
-proto sub sech(|) {*}
+proto sub sech($) {*}
multi sub sech(Numeric \x) { x.sech }
multi sub sech(Cool \x) { x.Numeric.sech }
-proto sub asech(|) {*}
+proto sub asech($) {*}
multi sub asech(Numeric \x) { x.asech }
multi sub asech(Cool \x) { x.Numeric.asech }
-proto sub cosech(|) {*}
+proto sub cosech($) {*}
multi sub cosech(Numeric \x) { x.cosech }
multi sub cosech(Cool \x) { x.Numeric.cosech }
-proto sub acosech(|) {*}
+proto sub acosech($) {*}
multi sub acosech(Numeric \x) { x.acosech }
multi sub acosech(Cool \x) { x.Numeric.acosech }
-proto sub cotanh(|) {*}
+proto sub cotanh($) {*}
multi sub cotanh(Numeric \x) { x.cotanh }
multi sub cotanh(Cool \x) { x.Numeric.cotanh }
-proto sub acotanh(|) {*}
+proto sub acotanh($) {*}
multi sub acotanh(Numeric \x) { x.acotanh }
multi sub acotanh(Cool \x) { x.Numeric.acotanh }
-proto sub sqrt(|) {*}
+proto sub sqrt($) {*}
multi sub sqrt(Numeric \x) { x.sqrt }
multi sub sqrt(Cool \x) { x.Numeric.sqrt }
proto sub roots($, $) { * }
multi sub roots($x, Cool $n) { $x.Numeric.Complex.roots($n.Int) }
multi sub roots($x, Numeric $n) { $x.Numeric.Complex.roots($n.Int) }
-proto sub floor(|) { * }
+proto sub floor($) { * }
multi sub floor($a) { $a.Numeric.floor }
multi sub floor(Numeric $a) { $a.floor }
-proto sub ceiling(|) { * }
+proto sub ceiling($) { * }
multi sub ceiling($a) { $a.Numeric.ceiling }
multi sub ceiling(Numeric $a) { $a.ceiling }
-proto sub round(|) { * }
+proto sub round($) { * }
multi sub round($a) { $a.Numeric.round }
multi sub round(Numeric $a) { $a.round }
multi sub round(Numeric $a, $scale) { $a.round($scale) }
@@ -220,7 +220,7 @@ multi infix:<**>(\a, \b) { a.Numeric ** b.Numeric }
## relational operators
-proto infix:«<=(|) { * }
+proto infix:«<=>»($, $?) { * }
multi infix:«<=>»(\a, \b) { a.Real <=> b.Real }
proto infix:<==>($a?, $b?) { * }
@@ -249,31 +249,31 @@ multi infix:«>=»(\a, \b) { a.Real >= b.Real }
## bitwise operators
-proto infix:<+&>(|) { * }
+proto infix:<+&>($?, $?) { * }
multi infix:<+&>() { +^0 }
multi infix:<+&>($x) { $x }
multi infix:<+&>($x, $y) { $x.Numeric.Int +& $y.Numeric.Int }
-proto infix:<+|>(|) { * }
+proto infix:<+|>($?, $?) { * }
multi infix:<+|>() { 0 }
multi infix:<+|>($x) { $x }
multi infix:<+|>($x, $y) { $x.Numeric.Int +| $y.Numeric.Int }
-proto infix:<+^>(|) { * }
+proto infix:<+^>($?, $?) { * }
multi infix:<+^>() { 0 }
multi infix:<+^>($x) { $x }
multi infix:<+^>($x, $y) { $x.Numeric.Int +^ $y.Numeric.Int }
-proto infix:«+<»(|) { * }
+proto infix:«+<»($?, $?) { * }
multi infix:«+<»() { fail "No zero-arg meaning for infix:«+<»"; }
multi infix:«+<»($x) { $x }
multi infix:«+<»($x,$y) { $x.Numeric.Int +< $y.Numeric.Int }
-proto infix:«+>»(|) { * }
+proto infix:«+>»($?, $?) { * }
multi infix:«+>»() { fail "No zero-arg meaning for infix:«+>»"; }
multi infix:«+>»($x) { $x }
multi infix:«+>»($x,$y) { $x.Numeric.Int +> $y.Numeric.Int }
-proto prefix:<+^>(|) { * }
+proto prefix:<+^>($?, $?) { * }
multi prefix:<+^>($x) { +^ $x.Numeric.Int }

0 comments on commit ce3b28d

Please sign in to comment.