aboutsummaryrefslogtreecommitdiffhomepage
path: root/std/Number
diff options
context:
space:
mode:
authorMarvin Borner2024-01-18 16:36:34 +0100
committerMarvin Borner2024-01-18 16:36:34 +0100
commit3faeba8c3e31bbe254a4facec8704d419e1bbdb8 (patch)
treee4fedc9d65c2875421ff441a50731ebe2987f8f2 /std/Number
parentd22c013e4e74889a82004b05aab1158b98cfafc9 (diff)
More efficient str→blc
Diffstat (limited to 'std/Number')
-rw-r--r--std/Number/Binary.bruijn20
1 files changed, 10 insertions, 10 deletions
diff --git a/std/Number/Binary.bruijn b/std/Number/Binary.bruijn
index 28a3f7f..6445d9f 100644
--- a/std/Number/Binary.bruijn
+++ b/std/Number/Binary.bruijn
@@ -78,19 +78,19 @@ zero? [0 true [false] i] ⧗ Binary → Boolean
:test (=?(+1b)) (false)
# extracts least significant bit from a binary number
-lst [0 b⁰ [b¹] [b⁰]] ⧗ Binary → Bit
+lsb [0 b⁰ [b¹] [b⁰]] ⧗ Binary → Bit
-:test (lst (+0b)) (b⁰)
-:test (lst (+1b)) (b¹)
-:test (lst (+42b)) (b⁰)
+:test (lsb (+0b)) (b⁰)
+:test (lsb (+1b)) (b¹)
+:test (lsb (+42b)) (b⁰)
# extracts most significant bit from a binary number
# not really useful for binary numbers, but part of interface
-mst [=?0 b⁰ b¹] ⧗ Binary → Bit
+msb [=?0 b⁰ b¹] ⧗ Binary → Bit
-:test (mst (+0b)) (b⁰)
-:test (mst (+1b)) (b¹)
-:test (mst (+42b)) (b¹)
+:test (msb (+0b)) (b⁰)
+:test (msb (+1b)) (b¹)
+:test (msb (+42b)) (b¹)
# extracts nth bit from a binary number
nth …!!… ∘ list! ⧗ Binary → Number → Bit
@@ -277,7 +277,7 @@ div² [~(0 z a¹ a⁰)] ⧗ Binary → Binary
:test (/²(+5b) =? (+2b)) (true)
# returns true if the number is even (remainder mod 2 == 0)
-even? ¬‣ ∘ lst ⧗ Binary → Boolean
+even? ¬‣ ∘ lsb ⧗ Binary → Boolean
=²?‣ even?
@@ -287,7 +287,7 @@ even? ¬‣ ∘ lst ⧗ Binary → Boolean
:test (even? (+42b)) (true)
# returns true if the number is odd (remainder mod 2 == 1)
-odd? lst ⧗ Binary → Boolean
+odd? lsb ⧗ Binary → Boolean
≠²?‣ odd?