Plaster
New
List
Login
common-lisp
default
anonymous
2021.03.18 18:57:16
(defun binary-to-lisp (input-file output-file name) (with-open-file (out output-file :direction :output) (let ((octets (alexandria:read-file-into-byte-vector input-file))) ;; We need to resort to format because we have no way to do ;; read-time evaluation without #. :( (format out "(defvar ~A #.(make-array ~D :element-type '(unsigned-byte 8) :initial-contents ~S))~%" name (length octets) octets))))
Raw
Annotate
Repaste
Edit