WITH-COUNT did not allow inserting declarations at the beginning of the body

This commit is contained in:
Juan Jose Garcia Ripoll 2010-05-21 23:04:43 +02:00
parent 480e227d2c
commit 39e7f02a79

View file

@ -16,13 +16,14 @@
(defmacro with-count ((count &optional (value count) &key (output nil output-p))
&body body)
(setf body `(locally ,@body))
`(let ((,count (sequence-count ,value)))
(declare (fixnum ,count))
,(if output-p
`(if (plusp ,count)
,@body
,body
,output)
`(progn ,@body))))
body)))
(defmacro with-predicate ((predicate) &body body)
`(let ((,predicate (si::coerce-to-function ,predicate)))