[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: backquote

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))
		      (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.