[gambit-list] Newbie Question: define-syntax and syntax-rules

Marc Feeley feeley at iro.umontreal.ca
Sun Jun 17 08:37:24 EDT 2007


-----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-----



More information about the Gambit-list mailing list