aboutsummaryrefslogtreecommitdiffhomepage
path: root/std/Number
diff options
context:
space:
mode:
authorMarvin Borner2024-10-27 01:00:38 +0200
committerMarvin Borner2024-10-27 01:00:38 +0200
commitc6e39268be197a4eaccc0187271764a646017715 (patch)
tree7d15737e481be8a247f657121e9926938a6fdbf2 /std/Number
parent10e46668751765c2981a07da3bc9411093db2bee (diff)
Refactored comparisons and sets
Diffstat (limited to 'std/Number')
-rw-r--r--std/Number/Binary.bruijn2
-rw-r--r--std/Number/Ternary.bruijn2
-rw-r--r--std/Number/Unary.bruijn2
3 files changed, 6 insertions, 0 deletions
diff --git a/std/Number/Binary.bruijn b/std/Number/Binary.bruijn
index 87f7312..c778890 100644
--- a/std/Number/Binary.bruijn
+++ b/std/Number/Binary.bruijn
@@ -139,6 +139,8 @@ binary→ternary [y [[[rec]]] [0] 0 (+0t)] ⧗ Binary → Ternary
# TODO: remove ternary conversion
compare-case [[[(T.compare-case 2 1 0) ⋔ binary→ternary]]] ⧗ a → b → c → Binary → Binary → d
+<?>‣ &compare-case
+
# returns true if number is greater than other number
# TODO: remove ternary conversion
gt? T.gt? ⋔ binary→ternary ⧗ Binary → Binary → Boolean
diff --git a/std/Number/Ternary.bruijn b/std/Number/Ternary.bruijn
index 5392b63..e00bbc5 100644
--- a/std/Number/Ternary.bruijn
+++ b/std/Number/Ternary.bruijn
@@ -291,6 +291,8 @@ gt? positive? ∘∘ sub ⧗ Number → Number → Boolean
compare-case [[[[[go (1 - 0)]]]]] ⧗ a → b → c → Number → Number → d
go [=?0 5 (>?0 4 3)]
+<?>‣ &compare-case
+
# ============================================================================ #
# most relevant functions are defined - we can now derive from Generic/Number! #
# ============================================================================ #
diff --git a/std/Number/Unary.bruijn b/std/Number/Unary.bruijn
index 214bfb9..96fef9a 100644
--- a/std/Number/Unary.bruijn
+++ b/std/Number/Unary.bruijn
@@ -103,6 +103,8 @@ eq? [[=?(1 - 0) ⋀? =?(0 - 1)]] ⧗ Unary → Unary → Boolean
compare-case [[[[[go (1 - 0) (0 - 1)]]]]] ⧗ a → b → c → Unary → Unary → d
go [[=?0 (=?1 6 5) 4]]
+<?>‣ &compare-case
+
# ============================================================================ #
# most relevant functions are defined - we can now derive from Generic/Number! #
# ============================================================================ #