diff options
author | Marvin Borner | 2023-04-08 17:14:54 +0200 |
---|---|---|
committer | Marvin Borner | 2023-04-08 17:14:54 +0200 |
commit | 67b6713b221a25763d1c08e12e8b715d432db5f8 (patch) | |
tree | 40843861e9aaacc47beba57479c0b78bcfea8f08 /std/Number | |
parent | 5e5069c5228f2cd39de38ace9134f57293cc7e5d (diff) |
Various improvements to standard library docs
Diffstat (limited to 'std/Number')
-rw-r--r-- | std/Number/Ternary.bruijn | 3 | ||||
-rw-r--r-- | std/Number/Unary.bruijn | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/std/Number/Ternary.bruijn b/std/Number/Ternary.bruijn index 9fb075e..f115349 100644 --- a/std/Number/Ternary.bruijn +++ b/std/Number/Ternary.bruijn @@ -327,12 +327,15 @@ compare-case [[[[[go (1 - 0)]]]]] ⧗ a → b → c → Number → Number → d go [=?0 5 (>?0 4 3)] # returns 1 if a>b, -1 if a<b and 0 if a=b +# also: spaceship operator compare compare-case (+0) (+1) (-1) ⧗ Number → Number → Number :test (compare (+2) (+2)) ((+0)) :test (compare (+2) (+1)) ((+1)) :test (compare (+1) (+2)) ((-1)) +…<=>… compare + # negates a balanced ternary number if <0 abs [<?0 -0 0] ⧗ Number → Number diff --git a/std/Number/Unary.bruijn b/std/Number/Unary.bruijn index edc9dcd..33127f4 100644 --- a/std/Number/Unary.bruijn +++ b/std/Number/Unary.bruijn @@ -86,7 +86,7 @@ les? \gre? ⧗ Unary → Unary → Boolean :test ((+2u) <? (+2u)) (false) :test ((+3u) <? (+2u)) (false) -# returns true if two balanced ternary numbers are equal +# returns true if two unary numbers are equal eq? [[(0 ≥? 1) ⋀? (0 ≤? 1)]] ⧗ Unary → Unary → Boolean …=?… eq? @@ -95,7 +95,7 @@ eq? [[(0 ≥? 1) ⋀? (0 ≤? 1)]] ⧗ Unary → Unary → Boolean :test ((+1u) =? (+1u)) (true) :test ((+42u) =? (+42u)) (true) -# returns true if two balanced ternary numbers are not equal +# returns true if two unary numbers are not equal not-eq? not! ∘∘ eq? ⧗ Unary → Unary → Boolean …≠?… not-eq? |