[gambit-list] Newbie Question: define-syntax and syntax-rules
Gabriel Kronberger
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")
> "/usr/local/Gambit-C/4.0b22/syntax-case.scm"
> > 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"))
> hello
>
> Something really strange is happening with your installation! Are
> you sure you are using the official distribution of beta 22?
>
> http://www.iro.umontreal.ca/~gambit/download/gambit/4.0/source/
> gambc-4.0b22.tar.gz
>
> 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
>
>
> Marc
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.3 (Darwin)
>
> iD8DBQFGdSsF//V9Zc2T/v4RAqedAJoD3Vx9ZU7HQeqqSEbMY71kTydxRwCZARFu
> bYxdY7qjfWok0F/mMZpt3Rc=
> =SkFr
> -----END PGP SIGNATURE-----
>
Hi Marc,
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
enough RAM).
I checked the syntax-case file of the old installation and it matched
your version.
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,
Gabriel
More information about the Gambit-list
mailing list