On 1/5/06, Reed Sheridan <[EMAIL PROTECTED]> wrote: > I'm trying to write a macro that translates a list into a procedure. > Here's a very simplified version of my code: > > (define spec '(foo)) > > (define (process-spec spec) > (if (pair? spec) > '(lambda x x) > (error "oops"))) > > (define-macro (spec->proc a-spec) > (process-spec a-spec)) > > #> ((spec->proc (foo)) 33) > (33) > #> (spec->proc spec) > Error: during expansion of (spec->proc ...) - oops > > Is there any way to evaluate a-spec at macroexpansion time, or a > clever workaround to avoid the problem, without putting the > specification itself in the call to spec->proc? >
Anything that you wrap in `(eval-when (compile) ...)' will be evaluated at compile-time. You also can use `eval' inside a macro-expander, of course (if you want to). Can you tell more about the specific use of this facility? Where should the specs be defined, for example? cheers, felix _______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
