diff options
Diffstat (limited to 'stdlib/source/lux/math.lux')
-rw-r--r-- | stdlib/source/lux/math.lux | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/stdlib/source/lux/math.lux b/stdlib/source/lux/math.lux index e27e09f86..b030746a0 100644 --- a/stdlib/source/lux/math.lux +++ b/stdlib/source/lux/math.lux @@ -3,7 +3,7 @@ ["@" target] [data [number - ["." nat] + ["n" nat] ["i" int]]]]) (template [<name> <value> <doc>] @@ -138,9 +138,9 @@ (-> Nat Nat) (loop [acc 1 n n] - (if (n/<= 1 n) + (if (n.<= 1 n) acc - (recur (n/* n acc) (dec n))))) + (recur (n.* n acc) (dec n))))) (def: #export (hypotenuse catA catB) (-> Frac Frac Frac) @@ -148,28 +148,6 @@ (pow +2.0 catA) (pow +2.0 catB)))) -(template [<type> <mod> <gcd> <lcm> <zero> <*> </> <->] - [(def: #export (<gcd> a b) - {#.doc "Greatest Common Divisor."} - (-> <type> <type> <type>) - (case b - <zero> a - _ (<gcd> b (<mod> b a)))) - - (def: #export (<lcm> a b) - {#.doc "Least Common Multiple."} - (-> <type> <type> <type>) - (case [a b] - (^or [_ <zero>] [<zero> _]) - <zero> - - _ - (|> a (</> (<gcd> a b)) (<*> b)) - ))] - - [Nat nat.mod n/gcd n/lcm 0 n/* n// n/-] - ) - ## Hyperbolic functions ## https://en.wikipedia.org/wiki/Hyperbolic_function#Definitions (template [<name> <comp> <inverse>] |