[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: backquote
- To: Don Cohen <donc@vaxa.isi.edu>
- Subject: Re: backquote
- From: "Stephen P. Smith" <ssmith@ruffles.nrtc.northrop.com>
- Date: Thu, 10 Nov 88 16:46:32 -0800
- Cc: common-lisp@sail.stanford.edu
- In-reply-to: Your message of Thu, 10 Nov 88 11:55:40 PST. <8811101955.AA11298@vaxa.isi.edu>
- Moon-phase: The moon is a waxing crescent (2 percent of full).
- Reply-to: ssmith@nrtc.northrop.com
Though the other solutions are actually better, here is
the macro exactly as you were trying to get it:
(defmacro define-protected (fcn &rest args)
(let ((targs (mapcar #'cadr args)))
`(defmacro ,(intern (format nil "PROTECTED-~a" fcn)) ,targs
`(let ,(mapcar #'(lambda (var val)
`(,var ,val))
',targs
(list ,@targs))
(and ,',@args (,',fcn ,',@targs))))))
Note that you *must* use the mapcar trick to build the let list; As
you saw, there is no way to pass a "free" comma around.
From your question about the CLtL reference on page 350: It was
also never clear to me without lots of experimentation what
such constructs as ,',@ should do either (or that they were
really allowed).
--Steve
- References:
- backquote
- From: Don Cohen <donc@vaxa.isi.edu>