aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/math/number/nat.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/math/number/nat.lux28
1 files changed, 14 insertions, 14 deletions
diff --git a/stdlib/source/library/lux/math/number/nat.lux b/stdlib/source/library/lux/math/number/nat.lux
index cef20dca2..f5fd924d5 100644
--- a/stdlib/source/library/lux/math/number/nat.lux
+++ b/stdlib/source/library/lux/math/number/nat.lux
@@ -111,7 +111,7 @@
(def .public (gcd a b)
(-> Nat Nat Nat)
- (case b
+ (when b
0 a
_ (gcd b (..% b a))))
@@ -121,7 +121,7 @@
(`` (def .public (lcm a b)
(-> Nat Nat Nat)
- (case [a b]
+ (when [a b]
(,, (with_template [<pattern>]
[<pattern>
0]
@@ -184,21 +184,21 @@
(def (binary_character value)
(-> Nat Text)
- (case value
+ (when value
0 "0"
1 "1"
_ (undefined)))
(def (binary_value digit)
(-> Nat (Maybe Nat))
- (case digit
+ (when digit
(char "0") {.#Some 0}
(char "1") {.#Some 1}
_ {.#None}))
(def (octal_character value)
(-> Nat Text)
- (case value
+ (when value
0 "0"
1 "1"
2 "2"
@@ -211,7 +211,7 @@
(def (octal_value digit)
(-> Nat (Maybe Nat))
- (case digit
+ (when digit
(char "0") {.#Some 0}
(char "1") {.#Some 1}
(char "2") {.#Some 2}
@@ -224,7 +224,7 @@
(def (decimal_character value)
(-> Nat Text)
- (case value
+ (when value
0 "0"
1 "1"
2 "2"
@@ -239,7 +239,7 @@
(def (decimal_value digit)
(-> Nat (Maybe Nat))
- (case digit
+ (when digit
(char "0") {.#Some 0}
(char "1") {.#Some 1}
(char "2") {.#Some 2}
@@ -254,7 +254,7 @@
(def (hexadecimal_character value)
(-> Nat Text)
- (case value
+ (when value
0 "0"
1 "1"
2 "2"
@@ -275,7 +275,7 @@
(`` (def (hexadecimal_value digit)
(-> Nat (Maybe Nat))
- (case digit
+ (when digit
(,, (with_template [<character> <number>]
[(char <character>)
{.#Some <number>}]
@@ -308,7 +308,7 @@
(let [output' ("lux text concat"
(<to_character> ("lux i64 and" mask input))
output)]
- (case (is Nat ("lux i64 right-shift" <shift> input))
+ (when (is Nat ("lux i64 right-shift" <shift> input))
0
output'
@@ -321,7 +321,7 @@
(loop (again [idx 0
output 0])
(if (..< input_size idx)
- (case (<to_value> ("lux text char" idx repr))
+ (when (<to_value> ("lux text char" idx repr))
{.#Some digit_value}
(again (++ idx)
(|> output
@@ -346,7 +346,7 @@
output ""])
(let [digit (decimal_character (..% 10 input))
output' ("lux text concat" digit output)]
- (case (../ 10 input)
+ (when (../ 10 input)
0
output'
@@ -360,7 +360,7 @@
(loop (again [idx 0
output 0])
(if (..< input_size idx)
- (case (decimal_value ("lux text char" idx repr))
+ (when (decimal_value ("lux text char" idx repr))
{.#None}
<failure>