aboutsummaryrefslogtreecommitdiffhomepage
path: root/std/String.bruijn
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/String.bruijn
parent10e46668751765c2981a07da3bc9411093db2bee (diff)
Refactored comparisons and sets
Diffstat (limited to 'std/String.bruijn')
-rw-r--r--std/String.bruijn8
1 files changed, 5 insertions, 3 deletions
diff --git a/std/String.bruijn b/std/String.bruijn
index 291188d..4ee002b 100644
--- a/std/String.bruijn
+++ b/std/String.bruijn
@@ -18,7 +18,9 @@ eq? eq? B.eq? ⧗ String → String → Boolean
?‣ &eq?
# returns eq, gt, lt depending on comparison of two numbers
-compare-case B.<=>compare-case ⧗ a → b → c → String → String → d
+compare-case B.<?>compare-case' ⧗ a → b → c → String → String → d
+
+<?>‣ &compare-case
# returns 1 if a>b, -1 if a<b and 0 if a=b
# also: spaceship operator
@@ -31,8 +33,8 @@ compare compare-case (+0) (+1) (-1) ⧗ String → String → Number
:test (compare "2" "2") ((+0))
:test (compare "2" "1") ((+1))
:test (compare "1" "2") ((-1))
-:test (compare "12" "1") ((-1))
-:test (compare "1" "12") ((+1))
+:test (compare "12" "1") ((+1))
+:test (compare "1" "12") ((-1))
# returns true if string is lexically less than other string
lt? c-lt? ∘∘ compare ⧗ String → String → Boolean