simple-bit-vector-p
simple-bit-vector-p Function
Syntax:
simple-bit-vector-p object → generalized-boolean
Arguments and Values:
object—an object.
generalized-boolean—a generalized boolean.
Description:
Returns true if object is of type simple-bit-vector; otherwise, returns false.
simple-bit-vector-pExamples:
(simple-bit-vector-p (make-array 6)) → false
(simple-bit-vector-p #\*) → true
See Also:
simple-vector-pNotes:
(simple-bit-vector-p object) ≡ (typep object ’simple-bit-vector)
Expanded Reference: simple-bit-vector-p
Basic Usage
simple-bit-vector-p returns true if its argument is a simple bit vector -- a one-dimensional bit array that is not adjustable, not displaced, and has no fill pointer.
;; Bit vector literals are simple
(simple-bit-vector-p #*10110)
=> T
;; Empty bit vector
(simple-bit-vector-p #*)
=> T
;; Not a bit vector at all
(simple-bit-vector-p (vector 1 0 1))
=> NIL
Non-Simple Bit Vectors
Bit vectors with fill pointers, adjustability, or displacement are not simple.
(simple-bit-vector-p
(make-array 5 :element-type 'bit :fill-pointer 3 :initial-element 0))
=> NIL
Non-Bit-Vector Types
Strings, general vectors, numbers, and other types all return false.
(simple-bit-vector-p "hello")
=> NIL
(simple-bit-vector-p (make-array 5))
=> NIL
(simple-bit-vector-p 42)
=> NIL
Equivalence to typep
(simple-bit-vector-p x) is equivalent to (typep x 'simple-bit-vector).
(let ((bv #*10101))
(eq (simple-bit-vector-p bv)
(typep bv 'simple-bit-vector)))
=> T