[plt-scheme] Very basic macro question

From: johny seventy (johnyseventy at hotmail.com)
Date: Sun Jan 17 09:22:14 EST 2010


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))

(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?


Got a cool Hotmail story? Tell us now
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100117/b35e92d0/attachment.html>

Posted on the users mailing list.