[plt-scheme] help with with-syntax

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sun Sep 17 00:04:14 EDT 2006

Do you mean this:


(define-syntax foo
   (syntax-rules ()
     ((_ x ...)
      (printf "You passed in ~a\n" (car (list 'x ...))))))

(define-syntax (blah stx)
   (syntax-case stx ()
     ((_ first x ...)
      (with-syntax ((f1 (datum->syntax-object #'first 'boo #'first)))
        #`(foo f1 x ...)))))

(foo 1 2 3)
(blah q w e)


On Sep 16, 2006, at 11:10 PM, Jon Rafkind wrote:

> Im probably missing something basic but why doesn't the following
> replace the first argument to blah with 'boo? I sort of think it is  
> but
> then the printf never happens.
>
> (define-syntax foo
>   (syntax-rules ()
>     ((_ x ...)
>      (printf "You passed in ~a\n" (car (list 'x ...))))))
>
> (define-syntax blah
>   (syntax-rules ()
>     ((_ first x ...)
>      (with-syntax ((f1 (datum->syntax-object #'first 'boo #'first)))
>        #'(foo f1 x ...)))))
>
> #; (foo 1 2 3)
> (blah q w e)
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.