[plt-scheme] DrScheme and R6RS (solved already)
Hi,
I have written this small program:
(import (rnrs))
(define-syntax py-for
(syntax-rules (in)
((_ (?bindings ...) in ?collection body ...)
(let ((code (lambda (?bindings ...) body ...)))
(let loop ((collect ?collection))
(unless (null? collect)
(apply code (car collect))
(loop (cdr collect))))))
((_ ?binding in ?collection body ...)
(py-for (?binding) in (map list ?collection) body ...))))
(py-for x in '(1 2 3)
(display x))
(py-for (x y) in '((a b) (A B) (1 2))
(display x) (display y))
When I run it using plt-r6rs, ikarus and ypsilon, it works perfectly.
Now, when I try to run it in DrScheme I get the following:
Module Language: there can only be one expression in the definitions
window in: (define-syntax py-for (syntax-rules (in) ((_ (?bindings ...)
in ?collection body ...) (let ((code (lambda (?bindings ...)
body ...))) (let loop ((collect ?collection)) (unless (null? collect)
(apply code (car collect)) (loop (cdr collect)))))) ((_ ?binding
in ?collection body ...) (py-for (?binding) in (map list ?collection)
body ...))))
Adding #lang r6rs (or scheme) at the top of the file fixes this problem
but then neither plt-r6rs, ikarus nor ypsilon can run the file anymore,
since #lang scheme is not valid r6rs syntax.
What can I do to make DrScheme (4.2.5) run files in R6RS mode?
Edit: The friendly folks on #scheme told me to use #!r6rs which works
in ikarus, ypsilon, plt-r6rs and DrScheme. Still sending the mail in
case someone will have the same problem at some point.
regards,
Marek