(bigint-to-bitset x)creates a bitset from a bigint
(-> (bigint-to-bitset 9223372036854775808N) (bitset-to-bitseq)) => (conj (vec (repeat 63 0)) 1)
creates a bitset from a bigint
(-> (bigint-to-bitset 9223372036854775808N)
(bitset-to-bitseq))
=> (conj (vec (repeat 63 0))
1)(bitseq obj)converts to a bitseq binary representation
(binary/bitseq (byte-array [49])) => [1 0 0 0 1 1]
converts to a bitseq binary representation (binary/bitseq (byte-array [49])) => [1 0 0 0 1 1]
(bitseq-to-bitset bseq)creates a bitset from a binary sequence
(bitseq-to-bitset [1 0 0 0 1 1]) ;; => #bs[1 0 0 0 1 1]
creates a bitset from a binary sequence (bitseq-to-bitset [1 0 0 0 1 1]) ;; => #bs[1 0 0 0 1 1]
(bitseq-to-bitstr bseq)creates a bitstr from a binary sequence
(bitseq-to-bitstr [1 0 0 0 1 1]) => "100011"
creates a bitstr from a binary sequence (bitseq-to-bitstr [1 0 0 0 1 1]) => "100011"
(bitseq-to-number arr)(bitseq-to-number arr factor)creates a number from a binary sequence
(bitseq-to-number [1 0 0 0 1 1]) => 49
(bitseq-to-number (repeat 10 1)) => 1023
creates a number from a binary sequence (bitseq-to-number [1 0 0 0 1 1]) => 49 (bitseq-to-number (repeat 10 1)) => 1023
(bitset obj)converts to a bitset binary representation
(-> (binary/bitset "100011") (bitset-to-bitseq)) => [1 0 0 0 1 1]
converts to a bitset binary representation
(-> (binary/bitset "100011")
(bitset-to-bitseq))
=> [1 0 0 0 1 1](bitset-to-bitseq bs)(bitset-to-bitseq bs length)creates a binary sequence from a bitset (-> (bitseq-to-bitset [1 0 0 0 1 1]) (bitset-to-bitseq)) => [1 0 0 0 1 1]
creates a binary sequence from a bitset
(-> (bitseq-to-bitset [1 0 0 0 1 1])
(bitset-to-bitseq))
=> [1 0 0 0 1 1](bitset-to-bytes bs)creates a byte array from a bitset
(-> (bitseq-to-bitset [1 0 0 0 1 1]) (bitset-to-bytes) seq) => [49]
creates a byte array from a bitset
(-> (bitseq-to-bitset [1 0 0 0 1 1])
(bitset-to-bytes)
seq)
=> [49](bitstr obj)converts to a bitstr binary representation
(binary/bitstr (byte-array [49])) => "100011"
converts to a bitstr binary representation (binary/bitstr (byte-array [49])) => "100011"
(bitstr-to-bitseq s)creates a binary sequence from a bitstr
(bitstr-to-bitseq "100011") => [1 0 0 0 1 1]
creates a binary sequence from a bitstr (bitstr-to-bitseq "100011") => [1 0 0 0 1 1]
(bitstr? x)checks if a string consists of only 1s and 0s
(bitstr? "0101010101") => true
(bitstr? "hello") => false
checks if a string consists of only 1s and 0s (bitstr? "0101010101") => true (bitstr? "hello") => false
(bytes obj)converts to a byte array binary representation
(-> (binary/bytes "100011") (seq)) => [49]
converts to a byte array binary representation
(-> (binary/bytes "100011")
(seq))
=> [49](bytes-to-bitset arr)creates a bitset from bytes
(-> (byte-array [49]) (bytes-to-bitset) (bitset-to-bitseq 8)) => [1 0 0 0 1 1 0 0]
creates a bitset from bytes
(-> (byte-array [49])
(bytes-to-bitset)
(bitset-to-bitseq 8))
=> [1 0 0 0 1 1 0 0](channel obj)creates a channel from various representations
(channel (fs/file "project.clj")) => java.nio.channels.Channel
creates a channel from various representations (channel (fs/file "project.clj")) => java.nio.channels.Channel
(input-stream obj)creates an inputstream from various representations
(input-stream 9223372036854775808N) => java.io.ByteArrayInputStream
creates an inputstream from various representations (input-stream 9223372036854775808N) => java.io.ByteArrayInputStream
(long-to-bitseq x)(long-to-bitseq x m)creates a binary sequence from a long
(long-to-bitseq 1023) => [1 1 1 1 1 1 1 1 1 1]
(long-to-bitseq 49 8) => [1 0 0 0 1 1 0 0]
creates a binary sequence from a long (long-to-bitseq 1023) => [1 1 1 1 1 1 1 1 1 1] (long-to-bitseq 49 8) => [1 0 0 0 1 1 0 0]
(number obj)converts to a number binary representation
(binary/number "100011") => 49
converts to a number binary representation (binary/number "100011") => 49
(output-stream obj)creates an inputstream from various representations
(output-stream (fs/file "project.clj")) => java.io.FileOutputStream
creates an inputstream from various representations (output-stream (fs/file "project.clj")) => java.io.FileOutputStream
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |