Liking cljdoc? Tell your friends :D

hara.io.binary.type


+native+clj


bigint-to-bitsetclj

(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)
raw docstring

bitseqclj

(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]
raw docstring

bitseq-to-bitsetclj

(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]
raw docstring

bitseq-to-bitstrclj

(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"
raw docstring

bitseq-to-numberclj

(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
raw docstring

bitsetclj

(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]
raw docstring

bitset-to-bitseqclj

(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]
raw docstring

bitset-to-bytesclj

(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]
raw docstring

bitstrclj

(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"
raw docstring

bitstr-to-bitseqclj

(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]
raw docstring

bitstr?clj

(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
raw docstring

bytesclj

(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]
raw docstring

bytes-to-bitsetclj

(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]
raw docstring

channelclj

(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
raw docstring

input-streamclj

(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
raw docstring

long-to-bitseqclj

(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]
raw docstring

numberclj

(number obj)

converts to a number binary representation

(binary/number "100011") => 49

converts to a number binary representation

(binary/number "100011")
=> 49
raw docstring

output-streamclj

(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
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close