[plt-scheme] Is there a way to "apply" a macro?

From: Carl Eastlund (carl.eastlund at gmail.com)
Date: Mon Apr 12 17:49:04 EDT 2010

On Mon, Apr 12, 2010 at 5:38 PM, Kurt Leno <kurtleno at ieee.org> wrote:
> I'm kind of new to Scheme,  but it seems to me constructing code at runtime
> would be a job for eval.  I'm assuming this would end up being something
> like:
> (eval (list macro-name (list expr [literal1 val1] [literal2 val2] ...))
> <environment>)
> I'm working from the assumption that macros are essentially functions for
> writing code and that it would be available at runtime as it is from the
> Hope this helps,
> Kurt

Unfortunately, `eval' does not run code in the context of the program
where it is called.  For good reasons -- which I won't go into here,
there are discussions elsewhere we can link to if anyone is curious --
`eval' runs its input essentially as a standalone program, in a
separate namespace, without any local bindings.

It is a good tool for running whole programs, but it does not let one
"bootstrap" macros into an already-running program.


Posted on the users mailing list.