Subject: Re: Question about backquotes
From: rpw3@rpw3.org (Rob Warnock)
Date: Tue, 04 Jan 2005 03:03:35 -0600
Newsgroups: comp.lang.lisp
Message-ID: <cqqdnY2cscR6xkfcRVn-qg@speakeasy.net>
Kenny Tilton  <ktilton@nyc.rr.com> wrote:
+---------------
| ...likely be needing this soon:
|   (let ((ns (list 1 2 3))) `(a b c ,@ns do re mi))
|   => (A B C 1 2 3 DO RE MI)
| Unfortunately this @-trick does not work with the expansion /returned/ 
| by the macro function, which is why it is common to see macros like:
|      `(progn
|          ,(make-top-level 1) ;; m-t-l generates a symbolic form
|          ,(make-top-level 2)
|          ,@(loop for n from 3 to 5 collecting (make-top-level n)))
+---------------

Or like this, when you need to pick and choose which pieces to
include in the expansion [and "orphaned" NILs aren't permissible]:

    `(progn
       ,@(when some-condition
	   `((some conditionally-included form)))
       ,@(when another-condition
	   `((another conditionally-included form)))
       ,@(when third-condition
	   `((several forms)
	     (need to be included)
	     (in this case))))


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607