[plt-dev] syntax-case behaving differently

From: Marijn Schouten (hkBst) (hkBst at gentoo.org)
Date: Thu May 7 16:33:06 EDT 2009

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I found a difference in running a file with "mzscheme -f <file>" and with
"plt-r6rs <file>" involving syntax-case. For the first you should comment the
import. Then the first will error:

cdr: expects argument of type <pair>; given #<syntax:blah>

and the second will produce the expected output:

(a b (+ c -1) d e)

The code is:


(import (rnrs)) ;comment this line for mzscheme

(define make-next-coords
  (lambda (x)
    (with-syntax (((name ... pos inc) x))
      (let ((pos (syntax->datum #'pos)))
        (let f ((names #'(name ...))(pos pos))
          (with-syntax (((name rest ...) names))
            (if (zero? pos)
                #'((+ name inc) rest ...)
                #`(name #,@(f (cdr names)(- pos 1))))))))))

(write (syntax->datum (make-next-coords #'(a b c d e 2 -1))))


Is this a bug or is there another explanation?

Thanks,

Marijn

- --
If you cannot read my mind, then listen to what I say.

Marijn Schouten (hkBst), Gentoo Lisp project, Gentoo ML
<http://www.gentoo.org/proj/en/lisp/>, #gentoo-{lisp,ml} on FreeNode
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkoDRYIACgkQp/VmCx0OL2xuQQCfSYTIkOObHh/G73SoGnk5L3Sc
nhIAniHjKUmg4XUv+lNys55srC55oAQR
=zKrz
-----END PGP SIGNATURE-----


Posted on the dev mailing list.