Subject: Re: Manipulating macro parameters
From: rpw3@rpw3.org (Rob Warnock)
Date: Mon, 22 May 2006 03:18:25 -0500
Newsgroups: comp.lang.lisp
Message-ID: <W_mdnWG2UIdM7uzZnZ2dnUVZ_tqdnZ2d@speakeasy.net>
Pedro Kr�ger <pedrokroeger@gmail.com> wrote:
+---------------
| joe wrote:
| > Is it possible to use a macro parameter as the basis for forming new
| > names within the macro?
| 
| You may want to try something like this:
| (defmacro test (x)
|     `(defun ,(read-from-string (concatenate 'string (symbol-name x) "bar"))
|             ()
|        (+ 2 2)))
+---------------

Why READ-FROM-STRING and not simply INTERN?

Also, INTERN takes an optional second argument for the package
you want the symbol to be interned into, if that happens not
to be the current package. With READ-FROM-STRING you will have
to bind CL:*PACKAGE* around the call.


-Rob

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