[Small-cl-src] WITH*
Marco Baringer
mb at bese.it
Fri Jul 16 11:36:12 UTC 2004
;;;; Alleviate deep nesting. Suggestions for a better name are welcome.
;;;;
;;;; An example will explain this far better than i can with words, so:
;;;;
;;;; (with*
;;;; (let ((*special* '())) (declare (special *special*)))
;;;; (dolist (a a-list))
;;;; (with-slots (foo bar baz) a)
;;;; (multiple-value-bind (c d e) (process baz))
;;;; (progn
;;;; body))
;;;; ==>
;;;; (let ((*special* '()))
;;;; (declare (special *special*))
;;;; (dolist (a a-list)
;;;; (with-slots (foo bar baz)
;;;; a
;;;; (multiple-value-bind (c d e)
;;;; (process baz)
;;;; body))))
(defmacro with* (&body body)
(cond
((cddr body)
(append (first body) `((with* ,@(cdr body)))))
((cdr body)
`(,@(first body) ,(second body)))
(body (first body))
(t nil)))
--
-Marco
Ring the bells that still can ring.
Forget your perfect offering.
There is a crack in everything.
That's how the light gets in.
-Leonard Cohen
More information about the Small-cl-src
mailing list