chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] Getting a macro to see a runtime form?


From: Reed Sheridan
Subject: [Chicken-users] Getting a macro to see a runtime form?
Date: Thu, 5 Jan 2006 15:25:56 -0600

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?

Reed Sheridan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]