2008-05-21 18:46:32 +00:00
|
|
|
(in-package macro-utils)
|
|
|
|
|
2008-06-24 17:45:26 +00:00
|
|
|
;(defun test-while (n)
|
|
|
|
; (let ((i 0))
|
|
|
|
; (while (< i n)
|
|
|
|
; (format t "~a~%" i)
|
|
|
|
; (incf i))))
|
|
|
|
|
|
|
|
;(defun test-until (n)
|
|
|
|
; (let ((i 0))
|
|
|
|
; (until (= i n)
|
|
|
|
; (format t "~a~%" i)
|
|
|
|
; (incf i))))
|
|
|
|
|
2008-08-23 17:19:41 +00:00
|
|
|
(defparameter *print-debug* t)
|
|
|
|
|
2008-06-24 17:45:26 +00:00
|
|
|
(defmacro pdebug (&body body)
|
2008-08-23 17:19:41 +00:00
|
|
|
`(if macro-utils:*print-debug*
|
|
|
|
(format *error-output* ,@body)))
|
2008-06-21 06:03:06 +00:00
|
|
|
|
|
|
|
(defmacro while (test-case &body body)
|
|
|
|
`(do ()
|
|
|
|
((not ,test-case) t)
|
|
|
|
,@body))
|
|
|
|
|
|
|
|
(defmacro until (test-case &body body)
|
|
|
|
`(do ()
|
|
|
|
(,test-case t)
|
|
|
|
,@body))
|
|
|
|
|
2008-05-21 18:46:32 +00:00
|
|
|
(defmacro with-gensyms ((&rest names) &body body)
|
|
|
|
`(let ,(loop for n in names collect `(,n (gensym)))
|
|
|
|
,@body))
|
|
|
|
|
2008-06-24 17:45:26 +00:00
|
|
|
|
|
|
|
|
2008-05-21 19:18:47 +00:00
|
|
|
(defmacro once-only ((&rest names) &body body)
|
2008-05-21 18:46:32 +00:00
|
|
|
(let ((gensyms (loop for n in names collect (gensym))))
|
|
|
|
`(let (,@(loop for g in gensyms collect `(,g (gensym))))
|
|
|
|
`(let (,,@(loop for g in gensyms for n in names collect ``(,,g ,,n)))
|
|
|
|
,(let (,@(loop for n in names for g in gensyms collect `(,n ,g)))
|
|
|
|
,@body)))))
|
|
|
|
|