[plt-scheme] eval & syntax-rules
On Tue, Apr 20, 2010 at 12:13 PM, Skeptic . <skeptic2000 at hotmail.com> wrote:
>
> Hi,
> Why something like this works :
> #lang scheme
> (define t 9)
> (let ([t 2])
> (eval t (make-base-namespace)))
> -> 2
This is the same as:
(eval 2 (make-base-namespace))
> but not something like this :
> #lang scheme
> (define a 4)
> (define b 5)
> (define c 6)
> (define-syntax test
> (syntax-rules ()
> [(test id ...)
> (eval '(id ...) (make-base-namespace))]))
> (test a b c)
> -> reference to a unidentified identifier : a
This is like (eval (a b c) (make-base-namespace)) (which would be an
error even in an appropriate namespace, since 4 is not a function).
--
sam th
samth at ccs.neu.edu