diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/data/number/complex.lux | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/stdlib/source/lux/data/number/complex.lux b/stdlib/source/lux/data/number/complex.lux index 62928d75e..d8c365bd5 100644 --- a/stdlib/source/lux/data/number/complex.lux +++ b/stdlib/source/lux/data/number/complex.lux @@ -10,10 +10,10 @@ [data ["." maybe] [number - ["." frac ("#/." number)]] - ["." text ("#/." monoid)] + ["." frac ("#;." number)]] + ["." text ("#;." monoid)] [collection - ["." list ("#/." functor)]]] + ["." list ("#;." functor)]]] ["." macro ["." code] ["s" syntax (#+ syntax: Syntax)]]]) @@ -65,17 +65,17 @@ (def: #export negate (-> Complex Complex) - (|>> (update@ #real frac/negate) - (update@ #imaginary frac/negate))) + (|>> (update@ #real frac;negate) + (update@ #imaginary frac;negate))) (def: #export signum (-> Complex Complex) - (|>> (update@ #real frac/signum) - (update@ #imaginary frac/signum))) + (|>> (update@ #real frac;signum) + (update@ #imaginary frac;signum))) (def: #export conjugate (-> Complex Complex) - (update@ #imaginary frac/negate)) + (update@ #imaginary frac;negate)) (def: #export (*' param input) (-> Frac Complex Complex) @@ -98,8 +98,8 @@ (def: #export (/ param input) (-> Complex Complex Complex) (let [(^slots [#real #imaginary]) param] - (if (f/< (frac/abs imaginary) - (frac/abs real)) + (if (f/< (frac;abs imaginary) + (frac;abs real)) (let [quot (f// imaginary real) denom (|> real (f/* quot) (f/+ imaginary))] {#real (|> (get@ #real input) (f/* quot) (f/+ (get@ #imaginary input)) (f// denom)) @@ -129,7 +129,7 @@ (let [(^slots [#real #imaginary]) subject] {#real (f/* (math.cosh imaginary) (math.cos real)) - #imaginary (frac/negate (f/* (math.sinh imaginary) + #imaginary (frac;negate (f/* (math.sinh imaginary) (math.sin real)))})) (def: #export (cosh subject) @@ -177,18 +177,18 @@ (def: #export (abs subject) (-> Complex Complex) (let [(^slots [#real #imaginary]) subject] - (complex (if (f/< (frac/abs imaginary) - (frac/abs real)) + (complex (if (f/< (frac;abs imaginary) + (frac;abs real)) (if (f/= +0.0 imaginary) - (frac/abs real) + (frac;abs real) (let [q (f// imaginary real)] (f/* (math.pow +0.5 (f/+ +1.0 (f/* q q))) - (frac/abs imaginary)))) + (frac;abs imaginary)))) (if (f/= +0.0 real) - (frac/abs imaginary) + (frac;abs imaginary) (let [q (f// real imaginary)] (f/* (math.pow +0.5 (f/+ +1.0 (f/* q q))) - (frac/abs real)))) + (frac;abs real)))) )))) (structure: #export number (Number Complex) @@ -199,13 +199,13 @@ (def: % ..%) (def: (negate x) (|> x - (update@ #real frac/negate) - (update@ #imaginary frac/negate))) + (update@ #real frac;negate) + (update@ #imaginary frac;negate))) (def: abs ..abs) (def: (signum x) (|> x - (update@ #real frac/signum) - (update@ #imaginary frac/signum)))) + (update@ #real frac;signum) + (update@ #imaginary frac;signum)))) (def: #export (exp subject) (-> Complex Complex) @@ -231,17 +231,17 @@ (def: (copy-sign sign magnitude) (-> Frac Frac Frac) - (f/* (frac/signum sign) magnitude)) + (f/* (frac;signum sign) magnitude)) (def: #export (root2 (^@ input (^slots [#real #imaginary]))) (-> Complex Complex) - (let [t (|> input ..abs (get@ #real) (f/+ (frac/abs real)) (f// +2.0) (math.pow +0.5))] + (let [t (|> input ..abs (get@ #real) (f/+ (frac;abs real)) (f// +2.0) (math.pow +0.5))] (if (f/>= +0.0 real) {#real t #imaginary (f// (f/* +2.0 t) imaginary)} {#real (f// (f/* +2.0 t) - (frac/abs imaginary)) + (frac;abs imaginary)) #imaginary (f/* t (copy-sign imaginary +1.0))}))) (def: #export (root2-1z input) @@ -250,18 +250,18 @@ (def: #export (reciprocal (^slots [#real #imaginary])) (-> Complex Complex) - (if (f/< (frac/abs imaginary) - (frac/abs real)) + (if (f/< (frac;abs imaginary) + (frac;abs real)) (let [q (f// imaginary real) scale (f// (|> real (f/* q) (f/+ imaginary)) +1.0)] {#real (f/* q scale) - #imaginary (frac/negate scale)}) + #imaginary (frac;negate scale)}) (let [q (f// real imaginary) scale (f// (|> imaginary (f/* q) (f/+ real)) +1.0)] {#real scale - #imaginary (|> scale frac/negate (f/* q))}))) + #imaginary (|> scale frac;negate (f/* q))}))) (def: #export (acos input) (-> Complex Complex) @@ -299,7 +299,7 @@ nth-phi (|> input argument (f// r-nth)) slice (|> math.pi (f/* +2.0) (f// r-nth))] (|> (list.indices nth) - (list/map (function (_ nth') + (list;map (function (_ nth') (let [inner (|> nth' .int int-to-frac (f/* slice) (f/+ nth-phi)) |