Convert a number from 0-7 into a octal character.
(octal-digit-to-char n) → *
ACL2 has a built-in version of this function, digit-to-char,
but
(defconstant *codes* (loop for i from 0 to 7 collect i)) ;; .114 seconds, no garbage (time (loop for i fixnum from 1 to 10000000 do (loop for c in *codes* do (str::octal-digit-to-char c)))) ;; .379 seconds, no garbage (time (loop for i fixnum from 1 to 10000000 do (loop for c in *codes* do (digit-to-char c))))
Function:
(defun octal-digit-to-char$inline (n) (declare (type (unsigned-byte 3) n)) (let ((acl2::__function__ 'octal-digit-to-char)) (declare (ignorable acl2::__function__)) (mbe :logic (digit-to-char n) :exec (code-char (the (unsigned-byte 8) (+ 48 n))))))