Previous: Bit Vectors, Up: Sequences Arrays Vectors [Contents][Index]
Here are some functions that relate to bit vectors:
This function returns t
if object is a bit vector.
(bit-vector-p #*01) ⇒ t (bit-vector-p [0 1]) ⇒ nil (bit-vector-p "01") ⇒ nil
This function returns t
if object is either 0 or 1.
This function creates and returns a bit vector whose elements are the arguments bits. Each argument must be a bit, i.e. one of the two integers 0 or 1.
(bit-vector 0 0 0 1 0 0 0 0 1 0) ⇒ #*0001000010 (bit-vector) ⇒ #*
This function creates and returns a bit vector consisting of length elements, each initialized to bit, which must be one of the two integers 0 or 1.
(setq picket-fence (make-bit-vector 9 1)) ⇒ #*111111111
This function returns a new bit vector containing all the elements of the sequences. The arguments sequences may be lists, vectors, or bit vectors, all of whose elements are the integers 0 or 1. If no sequences are given, an empty bit vector is returned.
The value is a newly constructed bit vector that is not eq
to any
existing bit vector.
(setq a (bvconcat '(1 1 0) '(0 0 1))) ⇒ #*110001 (eq a (bvconcat a)) ⇒ nil
(bvconcat) ⇒ #* (bvconcat [1 0 0 0 0] #*111 '(0 0 0 0 1)) ⇒ #*1000011100001
For other concatenation functions, see mapconcat
in Mapping Functions, concat
in Creating Strings, vconcat
in
Vector Functions, and append
in Building Lists.
The append
function provides a way to convert a bit vector into a
list with the same elements (see Building Lists):
(setq bv #*00001110) ⇒ #*00001110 (append bv nil) ⇒ (0 0 0 0 1 1 1 0)
Previous: Bit Vectors, Up: Sequences Arrays Vectors [Contents][Index]