projects
/
kmrcl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
r9687: new routines
[kmrcl.git]
/
macros.lisp
diff --git
a/macros.lisp
b/macros.lisp
index bf2714b86d441eec6f9d0c4bbce5a64f7f539d73..c83b3b64a19f9f9be26f9dd96daa9ed9213f6f6d 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)))
@@
-254,3
+263,9
@@
(pprint exp)))
(format t "~%~%")
(values)))
(pprint exp)))
(format t "~%~%")
(values)))
+
+(defmacro defconst (symbol value &optional doc)
+ `(defconstant ,symbol (if (boundp ',symbol)
+ (symbol-value ',symbol)
+ ,value)
+ ,@(when doc (list doc))))