aboutsummaryrefslogtreecommitdiffhomepage
path: root/std/Number/Ternary.bruijn
diff options
context:
space:
mode:
authorMarvin Borner2023-06-02 23:48:47 +0200
committerMarvin Borner2023-06-02 23:48:47 +0200
commit9186091f3d5ef244118d13921d21747f33c94bb3 (patch)
tree707dba519815304b2049ec346866cb3959a0fa6c /std/Number/Ternary.bruijn
parent5a7e7199354a5b6711eeafd384f643ec4e7dc842 (diff)
Added some missing functions
Diffstat (limited to 'std/Number/Ternary.bruijn')
-rw-r--r--std/Number/Ternary.bruijn20
1 files changed, 12 insertions, 8 deletions
diff --git a/std/Number/Ternary.bruijn b/std/Number/Ternary.bruijn
index f115349..86128ca 100644
--- a/std/Number/Ternary.bruijn
+++ b/std/Number/Ternary.bruijn
@@ -451,18 +451,22 @@ even? z [[rec]] ⧗ Number → Boolean
case-rec t⁰? (lst 0) (1 /³0) ¬(1 /³0)
case-end true
-:test (even? (+0)) (true)
-:test (even? (+1)) (false)
-:test (even? (+41)) (false)
-:test (even? (+42)) (true)
+=²?‣ even?
+
+:test (=²?(+0)) (true)
+:test (=²?(+1)) (false)
+:test (=²?(+41)) (false)
+:test (=²?(+42)) (true)
# returns true if the number is odd (remainder mod 2 == 1)
odd? ¬‣ ∘ even? ⧗ Number → Boolean
-:test (odd? (+0)) (false)
-:test (odd? (+1)) (true)
-:test (odd? (+41)) (true)
-:test (odd? (+42)) (false)
+≠²?‣ odd?
+
+:test (≠²?(+0)) (false)
+:test (≠²?(+1)) (true)
+:test (≠²?(+41)) (true)
+:test (≠²?(+42)) (false)
# returns max number of two
max [[(1 ≤? 0) 0 1]] ⧗ Number → Number → Number