aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/math/number/complex.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/math/number/complex.lux110
1 files changed, 55 insertions, 55 deletions
diff --git a/stdlib/source/library/lux/math/number/complex.lux b/stdlib/source/library/lux/math/number/complex.lux
index 636a77838..b1c14d1bb 100644
--- a/stdlib/source/library/lux/math/number/complex.lux
+++ b/stdlib/source/library/lux/math/number/complex.lux
@@ -1,26 +1,26 @@
(.using
- [library
- [lux "*"
- ["[0]" math]
- [abstract
- [equivalence {"+" Equivalence}]
- [codec {"+" Codec}]
- ["M" monad {"+" Monad do}]]
- [control
- ["[0]" maybe]
- ["<>" parser
- ["<[0]>" code {"+" Parser}]]]
- [data
- [collection
- ["[0]" list ("[1]#[0]" functor)]]]
- [macro
- [syntax {"+" syntax:}]
- ["[0]" code]]
- [math
- [number
- ["n" nat]
- ["f" frac]
- ["[0]" int]]]]])
+ [library
+ [lux "*"
+ ["[0]" math]
+ [abstract
+ [equivalence {"+" Equivalence}]
+ [codec {"+" Codec}]
+ ["M" monad {"+" Monad do}]]
+ [control
+ ["[0]" maybe]
+ ["<>" parser
+ ["<[0]>" code {"+" Parser}]]]
+ [data
+ [collection
+ ["[0]" list ("[1]#[0]" functor)]]]
+ [macro
+ [syntax {"+" syntax:}]
+ ["[0]" code]]
+ [math
+ [number
+ ["n" nat]
+ ["f" frac]
+ ["[0]" int]]]]])
(type: .public Complex
(Record
@@ -50,23 +50,23 @@
(def: .public (not_a_number? complex)
(-> Complex Bit)
- (or (f.not_a_number? (value@ #real complex))
- (f.not_a_number? (value@ #imaginary complex))))
+ (or (f.not_a_number? (the #real complex))
+ (f.not_a_number? (the #imaginary complex))))
(def: .public (= param input)
(-> Complex Complex Bit)
- (and (f.= (value@ #real param)
- (value@ #real input))
- (f.= (value@ #imaginary param)
- (value@ #imaginary input))))
+ (and (f.= (the #real param)
+ (the #real input))
+ (f.= (the #imaginary param)
+ (the #imaginary input))))
(template [<name> <op>]
[(def: .public (<name> param input)
(-> Complex Complex Complex)
- [#real (<op> (value@ #real param)
- (value@ #real input))
- #imaginary (<op> (value@ #imaginary param)
- (value@ #imaginary input))])]
+ [#real (<op> (the #real param)
+ (the #real input))
+ #imaginary (<op> (the #imaginary param)
+ (the #imaginary input))])]
[+ f.+]
[- f.-]
@@ -80,8 +80,8 @@
(template [<name> <transform>]
[(def: .public <name>
(-> Complex Complex)
- (|>> (revised@ #real <transform>)
- (revised@ #imaginary <transform>)))]
+ (|>> (revised #real <transform>)
+ (revised #imaginary <transform>)))]
[opposite f.opposite]
[signum f.signum]
@@ -89,25 +89,25 @@
(def: .public conjugate
(-> Complex Complex)
- (revised@ #imaginary f.opposite))
+ (revised #imaginary f.opposite))
(def: .public (*' param input)
(-> Frac Complex Complex)
[#real (f.* param
- (value@ #real input))
+ (the #real input))
#imaginary (f.* param
- (value@ #imaginary input))])
+ (the #imaginary input))])
(def: .public (* param input)
(-> Complex Complex Complex)
- [#real (f.- (f.* (value@ #imaginary param)
- (value@ #imaginary input))
- (f.* (value@ #real param)
- (value@ #real input)))
- #imaginary (f.+ (f.* (value@ #real param)
- (value@ #imaginary input))
- (f.* (value@ #imaginary param)
- (value@ #real input)))])
+ [#real (f.- (f.* (the #imaginary param)
+ (the #imaginary input))
+ (f.* (the #real param)
+ (the #real input)))
+ #imaginary (f.+ (f.* (the #real param)
+ (the #imaginary input))
+ (f.* (the #imaginary param)
+ (the #real input)))])
(def: .public (/ param input)
(-> Complex Complex Complex)
@@ -116,12 +116,12 @@
(f.abs #real))
(let [quot (f./ #imaginary #real)
denom (|> #real (f.* quot) (f.+ #imaginary))]
- [..#real (|> (value@ ..#real input) (f.* quot) (f.+ (value@ ..#imaginary input)) (f./ denom))
- ..#imaginary (|> (value@ ..#imaginary input) (f.* quot) (f.- (value@ ..#real input)) (f./ denom))])
+ [..#real (|> (the ..#real input) (f.* quot) (f.+ (the ..#imaginary input)) (f./ denom))
+ ..#imaginary (|> (the ..#imaginary input) (f.* quot) (f.- (the ..#real input)) (f./ denom))])
(let [quot (f./ #real #imaginary)
denom (|> #imaginary (f.* quot) (f.+ #real))]
- [..#real (|> (value@ ..#imaginary input) (f.* quot) (f.+ (value@ ..#real input)) (f./ denom))
- ..#imaginary (|> (value@ ..#imaginary input) (f.- (f.* quot (value@ ..#real input))) (f./ denom))]))))
+ [..#real (|> (the ..#imaginary input) (f.* quot) (f.+ (the ..#real input)) (f./ denom))
+ ..#imaginary (|> (the ..#imaginary input) (f.- (f.* quot (the ..#real input))) (f./ denom))]))))
(def: .public (/' param subject)
(-> Frac Complex Complex)
@@ -133,8 +133,8 @@
(-> Complex Complex Complex)
(let [scaled (/ param input)
quotient (|> scaled
- (revised@ #real math.floor)
- (revised@ #imaginary math.floor))]
+ (revised #real math.floor)
+ (revised #imaginary math.floor))]
(- (* quotient param)
input)))
@@ -311,8 +311,8 @@
(def: .public (approximately? margin_of_error standard value)
(-> Frac Complex Complex Bit)
(and (f.approximately? margin_of_error
- (value@ ..#real standard)
- (value@ ..#real value))
+ (the ..#real standard)
+ (the ..#real value))
(f.approximately? margin_of_error
- (value@ ..#imaginary standard)
- (value@ ..#imaginary value))))
+ (the ..#imaginary standard)
+ (the ..#imaginary value))))