[plt-scheme] Problem with define-syntax on 200
The expression (syntax (binding ...)) evaluates to a syntax object and hence
the error from trying to map over it. Use the syntax->list function to convert
a syntax object that contains list-like syntax into a list of syntax objects.
Concretely, changing
(syntax (binding ...)) to (syntax->list (syntax (binding ...)))
should fix this bug.
-Scott
On Tue, 30 Jul 2002, Blake McBride wrote:
>
> Greetings,
>
> 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 ...))))))))))
>
> (define try
> (lambda (m)
> (debug-do ((i 0 (+ i 1)))
> ((> i m) 88)
> (display i)
> (newline))))
>
>
> 'try' works fine with the real 'do' but gives the following error with
> 'debug-do'
> at definition time:
>
> map: expects type <list> as 2nd argument, given:
> #<syntax:C:\Scheme-debugger\debugger.scm:266:28>; other arguments were:
> #<procedure:...ger\debugger.scm:260:28>
>
> (debugger.scm is a debugger I'm working on - It actually works!)
>
> I need this code to work for real. It's not just an exercise for me.
> Your help is appreciated.
>
> --blake
>
> -------
> Download source code to my Dynace Object Oriented
> Extension to C from http://algorithms.us
>