Re: Crazy macro



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
.



Relevant Pages

  • Re: [newbie] make local var visible
    ... #not adjust the ... #> methods but the vars, ... #B) make it a constant (ie. Foo). ... #-- Jim Weirich jim@xxxxxxxxxxxxxxxx http://onestepback.org ...
    (comp.lang.ruby)
  • Re: [newbie] make local var visible
    ... > methods but the vars, ... make it a constant (ie. Foo). ... -- Donald Knuth (in a memo to Peter van Emde Boas) ...
    (comp.lang.ruby)
  • Re: use vars
    ... > If this is obselete then what is the newer version of predeclare global ... use vars qw ... our $FOO; ... Prev by Date: ...
    (perl.beginners)