Code: Select all
(defmacro defanonenum (&body enums)
"Converts anonymous enums to Lisp constants."
`(cl:progn ,@(cl:loop for value in enums
for index = 0 then (cl:1+ index)
when (cl:listp value)
do (cl:setf index (cl:second value)
value (cl:first value))
collect `(cl:defconstant ,value ,index))))
to define my constants. I usually define like this with the + signs on either end:
Code: Select all
(defanonenum
(+char-max+ 127))
The only caveat is that the speed would closely match what I have now. A billion runs of +char-max+
takes 0.404 seconds of real time in my current setup. Thank you in advance for any guidance on this:)