Common Lisp the Language, 2nd Edition


next up previous contents index
Next: Hash Tables Up: Arrays Previous: Strings

2.5.3. Bit-Vectors

A bit-vector can be written as the sequence of bits contained in the string, preceded by #*; any delimiter character, such as whitespace, will terminate the bit-vector syntax. For example:

#*10110     ;A five-bit bit-vector; bit 0 is a 1 
#*          ;An empty bit-vector

The bits notated following the #*, taken from left to right, occupy locations within the bit-vector with increasing indices. The leftmost notated bit is bit-vector element number 0, the next one is element number 1, and so on.

The function prin1 will print any bit-vector (not just a simple one) using this syntax, but the function read will always construct a simple bit-vector when it reads this syntax.


AI.Repository@cs.cmu.edu