Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!sun-barr!cs.utexas.edu!uunet!mcvax!ukc!etive!aiai!jeff From: jeff@aiai.ed.ac.uk (Jeff Dalton) Newsgroups: comp.lang.lisp Subject: Re: Use of backquote & macro question - a real use for &aux! Message-ID: <407@skye.ed.ac.uk> Date: 3 May 89 16:15:11 GMT References: <2277@perseus.sw.mcc.com> <2292@perseus.sw.mcc.com> Reply-To: jeff@aiai.UUCP (Jeff Dalton) Organization: AIAI, University of Edinburgh, Scotland Lines: 39 In article <2292@perseus.sw.mcc.com> rcp@perseus.sw.mcc.com (Rob Pettengill) writes: >I want to thank everyone who sent in suggestions. The solution I like best >to my problem appeared in the response from donc@vaxa.isi.edu (Don Cohen). >Useing &aux variables to handle the setup required to write the macro >eliminates the need for the evaled let that bothered me in the original. >This is the first real use for &aux that I have seen! >Here is my latest version: Just to make sure there isn't some subtle confusion here, I think I should point out that &AUX isn't the only straightforward way to eliminate the evaluated LET. In particular, the &AUX can be replaced in a simple, mechanical way by a LET*. A macro that looks like this (defmacro with-context ((state-holder state-binding-list) &body body &aux (state-vars ...) (state-vals ...) (state-temps ...)) "This macro ..." `(let ... more backquoted stuff ... )) can be rewritten to look like this: (defmacro with-context ((state-holder state-binding-list) &body body) "This macro ..." (let* ((state-vars ...) (state-vals ...) (state-temps ...)) `(let ... more backquoted stuff ... ))) You need to use LET* rather than LET because the calculation of STATE-TEMPS refers to STATE-VARS. You could also use nested LETs. This sort of thing can be done for any use of &AUX, so whether you use &AUX or not is largely a matter of taste. -- Jeff