aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/math/number/int.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/math/number/int.lux25
1 files changed, 13 insertions, 12 deletions
diff --git a/stdlib/source/library/lux/math/number/int.lux b/stdlib/source/library/lux/math/number/int.lux
index 3eb21d465..d5a563dd5 100644
--- a/stdlib/source/library/lux/math/number/int.lux
+++ b/stdlib/source/library/lux/math/number/int.lux
@@ -15,10 +15,7 @@
[function
[predicate (.only Predicate)]]]
[data
- [text (.only Char)]]
- [meta
- [macro
- ["^" pattern]]]]]
+ [text (.only Char)]]]]
["[0]" //
["[1][0]" nat]
["[1][0]" i64]])
@@ -147,14 +144,18 @@
b1 (- (* q b1) a1))))))
... https://en.wikipedia.org/wiki/Least_common_multiple
-(def .public (lcm a b)
- (-> Int Int Int)
- (case [a b]
- (^.or [_ +0] [+0 _])
- +0
-
- _
- (|> a (/ (gcd a b)) (* b))))
+(`` (def .public (lcm a b)
+ (-> Int Int Int)
+ (case [a b]
+ (,, (with_template [<pattern>]
+ [<pattern>
+ +0]
+
+ [[_ +0]]
+ [[+0 _]]))
+
+ _
+ (|> a (/ (gcd a b)) (* b)))))
(def .public frac
(-> Int Frac)