projects
/
kmrcl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
r11204: 22 Sep 2006 Kevin Rosenberg <kevin@rosenberg.net>
[kmrcl.git]
/
macros.lisp
diff --git
a/macros.lisp
b/macros.lisp
index 1239eb46b6d7d7cce32b073edc15d0d53a23efe8..d0ba63c629d8e698cc011c6072ce82c20e7d604d 100644
(file)
--- a/
macros.lisp
+++ b/
macros.lisp
@@
-147,6
+147,15
@@
,@body))
,@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)))
(defmacro time-iterations (n &body body)
(let ((i (gensym))
(count (gensym)))
@@
-255,8
+264,16
@@
(format t "~%~%")
(values)))
(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))))
,@(when doc (list doc))))
+
+(defmacro defvar-unbound (sym &optional (doc ""))
+ "defvar with a documentation string."
+ `(progn
+ (defvar ,sym)
+ (setf (documentation ',sym 'variable) ,doc)))
+