[gambit-list] Newbie Question: define-syntax and syntax-rules
gabriel.kronberger at gmail.com
Sun Jun 17 09:18:38 EDT 2007
On 6/17/07, Marc Feeley <feeley at iro.umontreal.ca> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> On 17-Jun-07, at 7:37 AM, Gabriel Kronberger wrote:
> > debian:/home/user/Desktop/gambc-4.0b22# gsi
> > Gambit Version 4.0 beta 22
> >> (load "~~/syntax-case")
> > "/usr/local/Gambit-C/4.0b22/syntax-case.scm"
> >> syntax-rules
> > *** ERROR IN (console)@2.1 -- Unbound variable: syntax-rules
> > 1> define-syntax
> > *** ERROR IN (console)@3.1 -- Unbound variable: define-syntax
> > 2> (define-syntax unless
> > (syntax-rules ()
> > ((unless test body ...)
> > (if test #f (begin body ...)))))
> > *** ERROR IN (console)@5.19 -- Ill-formed expression
> > 2>
> > It seems even though I can load syntax-case.scm, syntax-rules and
> > define-syntax are still not defined.
> > I must be missing something really obvious!
> > I know that I can use define-macro. I use it in my code now. However I
> > would also like to play around with syntax-rules and according to the
> > documentation it should work the way I tried to use it. So either I'm
> > missing something obvious or the documentation is outdated or
> > syntax-case.scm doesn't work on my debian system.
> > Any more hints I could try to make syntax-rules work?
> > Thanks,
> > Gabriel
> I've done exactly the same thing on my MacBook Pro and get this
> (correct) behavior:
> % gsi
> Gambit Version 4.0 beta 22
> > (load "~~/syntax-case")
> > syntax-rules
> *** ERROR -- invalid syntax syntax-rules
> > define-syntax
> *** ERROR -- invalid syntax define-syntax
> > (define-syntax unless
> (syntax-rules ()
> ((unless test body ...)
> (if test #f (begin body ...)))))
> > (unless #f (display "hello\n"))
> Something really strange is happening with your installation! Are
> you sure you are using the official distribution of beta 22?
> Also, could you check the top of the file /usr/local/Gambit-C/4.0b22/
> syntax-case.scm ? It should read:
> ; File: "syntax-case.scm", Time-stamp: <2007-04-04 10:13:27 feeley>
> ; Copyright (c) 1998-2007 by Marc Feeley, All Rights Reserved.
> ; This is version 3.2 .
> ; This version includes a patch which avoids quoting self-evaluating
> ; constants. This makes it possible to use some Gambit specific forms
> ; such as declare, namespace and define-macro.
> Also, make sure no "gambcext" and "gambcini" files are being loaded.
> To avoid loading the gambcini file do
> % gsi -f
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.3 (Darwin)
> -----END PGP SIGNATURE-----
It works like a charm now! Unfortunately I don't have a good
explanation for the problems. I guess what happened was that I
installed a version from an unclean build with some files still lying
around from an unsuccessful --enable-gcc-opts building attempt (not
I checked the syntax-case file of the old installation and it matched
Then I redownloaded gambc-4.0b22.tar.gz and configured, built and installed it.
Now I can load syntax-case and there are no apparent problems with syntax-rules.
Thanks for the help,
More information about the Gambit-list