;;AUTOLOAD: byte-to-bits
;;AUTODOC: byte-to-bits "expands a byte into an array of bits"
;;(byte-to-bits number)
;;
;;This is more a answer to a common programmatic puzzle than an useful 
;;function...
;;e.g.:
;;(byte-to-bits 57)        ==>      [() () t t t () () t]

(defun byte-to-bits (byte &aux (bits (vector)))
  (dotimes (i 8)
    (put bits (- 7 i) (if (= 0 (logand (** 2 i) byte)) ()  t))
  )
  bits
)

;;AUTOLOAD: bits-to-byte
;;AUTODOC: bits-to-byte "collapse an array of bits into a byte"
;;(bits-to-byte array-of-bits)
;;
;;This is more a answer to a common programmatic puzzle than an useful 
;;function...
;;e.g.:
;;(bits-to-byte [() () t t t () () t])        ==>      57

(defun bits-to-byte (bits &aux (byte 0) (n (** 2 (- (length bits) 1))))
  (dolist (bit bits)
    (if bit (incf byte n))
    (setq n (/ n 2))
  )
  byte
)
    
  
