Topic summary

Bit vector

Bit vector

Extracted from the Wikipedia article Bit array.

Language support

Common Lisp provides multi-dimensional bit arrays. A one-dimensional bit-vector implementation is provided as a special case of the built-in array, acting in a dual capacity as a class and a type specifier. Bit arrays (and thus bit vectors) relies on the general make-array function to be configured with an element type of bit, which optionally permits a bit vector to be designated as dynamically resizable. The bit-vector, however, is not infinite in extent. A more restricted simple-bit-vector type exists, which explicitly excludes the dynamic characteristics. Bit vectors are represented as, and can be constructed in a more concise fashion by, the reader macro#*bits. In addition to the general functions applicable to all arrays, dedicated operations exist for bit arrays. Single bits may be accessed and modified using the bit and sbit functions and an extensive number of logical operations is supported.