Skip to main content

simple-bit-vector

simple-bit-vector Type

Supertypes:

simple-bit-vector, bit-vector, vector, simple-array, array, sequence, t

Description:

The type of a bit vector that is not displaced to another array, has no fill pointer , and is not expressly adjustable is a subtype of type simple-bit-vector.

Compound Type Specifier Kind:

Abbreviating.

Compound Type Specifier Syntax:

(simple-bit-vector [size])

Compound Type Specifier Arguments:

size—a non-negative fixnum, or the symbol *. The default is the symbol *.

Compound Type Specifier Description:

This denotes the same type as the type (simple-array bit (size)); that is, the set of simple bit vectors of size size.

Expanded Reference: simple-bit-vector

The simple-bit-vector Type

A simple-bit-vector is a bit vector that is not displaced, has no fill pointer, and is not expressly adjustable. Bit vector literals created with #* are simple bit vectors.

(typep #*10110 'simple-bit-vector)
=> T

(typep #* 'simple-bit-vector)
=> T

;; A bit vector with a fill pointer is not simple
(typep (make-array 5 :element-type 'bit :fill-pointer 3 :initial-element 0)
'simple-bit-vector)
=> NIL

Parameterized simple-bit-vector Type

(typep #*1011 '(simple-bit-vector 4))
=> T

(typep #*1011 '(simple-bit-vector 3))
=> NIL

sbit Requires Simple Bit Vectors

The sbit accessor is the simple-bit-vector counterpart of bit, potentially allowing faster access.

(let ((sbv #*10110))
(list (sbit sbv 0) (sbit sbv 1) (sbit sbv 2)))
=> (1 0 1)

Type Relationships

(subtypep 'simple-bit-vector 'bit-vector)
=> T
=> T

(subtypep 'simple-bit-vector 'simple-array)
=> T
=> T

(subtypep 'simple-bit-vector 'vector)
=> T
=> T