How Many Bits?
(integer-length #b1000) => 4
Use it to print a binary number:
(defun binary-to-string (bits)
(let* ((L (integer-length bits))
;; Note that bit zero is on the right
;; of the string (character L-1).
(when (logbitp (- L I 1) bits)
(setf (char string I) #\1)))