Re: Crazy macro
- From: Wade Humeniuk <whumeniu+anti+spam@xxxxxxxxx>
- Date: Sun, 30 Apr 2006 14:27:36 GMT
I prefer something like this,
(defmacro multiv-let* (vars inits &body body)
(let ((form `(progn ,@body)))
(loop for init in (reverse inits)
for vars in (reverse vars)
do
(setf form `(multiple-value-bind ,vars ,init ,form)))
form))
Then
(multiv-let* ((x y z) (p q) (r s))
((foo) (baz x y) (zap x p))
(stuff))
Expands to
(MULTIPLE-VALUE-BIND (X Y Z)
(FOO)
(MULTIPLE-VALUE-BIND (P Q)
(BAZ X Y)
(MULTIPLE-VALUE-BIND (R S) (ZAP X P) (PROGN (STUFF)))))
In general the multi-lets(*) could be written to accept normal,
multiple and destructured binding with a little syntax.
Wade
.
- References:
- Crazy macro
- From: Drew McDermott
- Crazy macro
- Prev by Date: Re: time to bring back the Lisp machines?
- Next by Date: Re: KnowOS (Lisp Web-Based Time Sharing)
- Previous by thread: Re: Crazy macro
- Next by thread: time to bring back the Lisp machines?
- Index(es):
Relevant Pages
|
|