[plt-scheme] Very basic macro question
Hi!
I am trying to learn syntax-rules macros but have some very basic questions regarding manipulation of s-expressions.
Below is some simple code to illustrate my questions:
#lang scheme
(define-syntax foo
(syntax-rules ()
((_ (x y))
#t)))
(define sexpr '(a b))
;; one
(foo sexpr)
;; two
(foo '(a b))
;; three
(foo (a b))
;; four
(eval `(foo ,sexpr))
So I understand why the first example fails. I am not sure why example two matches as I would only assume example three would. I understand why example four works but is there anyway I can do this without eval?
TIA.
_________________________________________________________________
Got a cool Hotmail story? Tell us now
http://clk.atdmt.com/UKM/go/195013117/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100117/b35e92d0/attachment.html>