[plt-scheme] Problem with define-syntax on 200

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Jul 31 08:42:02 EDT 2002

At Tue, 30 Jul 2002 21:56:28 -0500, Blake McBride wrote:
> I took a define-syntax definition for 'do' from "The Scheme
> Programming Language" by Dybvig and tried it under DrScheme
> version 200.  The definition and error is as follows:
> 
> (define-syntax debug-do
>    (lambda (x)
>      (syntax-case x ()
>        ((_ (binding ...) (test res ...) exp ...)
>         (with-syntax ((((var val update) ...)
>                        (map (lambda (b)
>                               (syntax-case b ()
>                                 ((var val)
>                                  (syntax (var val var)))
>                                 ((var val update)
>                                  (syntax (var val update)))))
>                             (syntax (binding ...)))))
>           (syntax (let doloop ((var val) ...)
>                     (if test
>                         (begin (if #f #f) res ...)
>                         (begin exp ... (doloop update ...))))))))))

In Chez, parentheses within syntax produce pairs. In MzScheme, they
produce syntax objects.

You can fix the above program by changing the second argument to `map'
from

  (syntax (binding ...))

to

  (syntax->list (syntax (binding ...)))


Matthew




Posted on the users mailing list.