,@body))
+(defmacro time-seconds (&body body)
+ (let ((t1 (gensym)))
+ `(let ((,t1 (get-internal-real-time)))
+ (values
+ (progn ,@body)
+ (coerce (/ (- (get-internal-real-time) ,t1)
+ internal-time-units-per-second)
+ 'double-float)))))
+
(defmacro time-iterations (n &body body)
(let ((i (gensym))
(count (gensym)))
(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)))
+