(format t "~%~%")
(values)))
-(defmacro defconst (symbol value &optional doc)
- `(defconstant ,symbol (if (boundp ',symbol)
- (symbol-value ',symbol)
- ,value)
+(defmacro defconstant* (sym value &optional doc)
+ "Ensure VALUE is evaluated only once."
+ `(defconstant ,sym (if (boundp ',sym)
+ (symbol-value ',sym)
+ ,value)
,@(when doc (list doc))))
+
+(defmacro defvar-unbound (sym &optional (doc ""))
+ "defvar with a documentation string."
+ `(progn
+ (defvar ,sym)
+ (setf (documentation ',sym 'variable) ,doc)))
+
(declare (type (integer 0 15) n))
(schar +hex-chars+ n))
-(defconst +char-code-lower-a+ (char-code #\a))
-(defconst +char-code-upper-a+ (char-code #\A))
-(defconst +char-code-0+ (char-code #\0))
+(defconstant* +char-code-lower-a+ (char-code #\a))
+(defconstant* +char-code-upper-a+ (char-code #\A))
+(defconstant* +char-code-0+ (char-code #\0))
(declaim (type fixnum +char-code-0+ +char-code-upper-a+
+char-code-0))
(eval-when (:compile-toplevel :load-toplevel :execute)
(defvar +unambiguous-charset+
"abcdefghjkmnpqrstuvwxyz123456789ABCDEFGHJKLMNPQSRTUVWXYZ")
- (defconstant +unambiguous-length+ (length +unambiguous-charset+)))
+ (defconstant* +unambiguous-length+ (length +unambiguous-charset+)))
(defun random-char (&optional (set :lower-alpha))
(ecase set