diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/data/bit.lux | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/stdlib/source/lux/data/bit.lux b/stdlib/source/lux/data/bit.lux index b0b31d2dd..4f9474a90 100644 --- a/stdlib/source/lux/data/bit.lux +++ b/stdlib/source/lux/data/bit.lux @@ -1,11 +1,11 @@ -(;module: [lux #- and or not]) +(.module: [lux #- and or not]) (def: #export width Nat +64) ## [Values] (do-template [<short-name> <op> <doc> <type>] [(def: #export (<short-name> param subject) - {#;doc <doc>} + {#.doc <doc>} (-> Nat <type> <type>) (<op> subject param))] @@ -18,40 +18,40 @@ ) (def: #export (count subject) - {#;doc "Count the number of 1s in a bit-map."} + {#.doc "Count the number of 1s in a bit-map."} (-> Nat Nat) ("lux bit count" subject)) (def: #export not - {#;doc "Bitwise negation."} + {#.doc "Bitwise negation."} (-> Nat Nat) (let [mask (int-to-nat -1)] (xor mask))) (def: #export (clear idx input) - {#;doc "Clear bit at given index."} + {#.doc "Clear bit at given index."} (-> Nat Nat Nat) - (;;and (;;not (shift-left idx +1)) + (..and (..not (shift-left idx +1)) input)) (do-template [<name> <op> <doc>] [(def: #export (<name> idx input) - {#;doc <doc>} + {#.doc <doc>} (-> Nat Nat Nat) (<op> (shift-left idx +1) input))] - [set ;;or "Set bit at given index."] - [flip ;;xor "Flip bit at given index."] + [set ..or "Set bit at given index."] + [flip ..xor "Flip bit at given index."] ) (def: #export (set? idx input) (-> Nat Nat Bool) - (|> input (;;and (shift-left idx +1)) (n/= +0) ;not)) + (|> input (..and (shift-left idx +1)) (n/= +0) .not)) (do-template [<name> <main> <comp>] [(def: #export (<name> distance input) (-> Nat Nat Nat) - (;;or (<main> distance input) + (..or (<main> distance input) (<comp> (n/- (n/% width distance) width) input)))] |