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

Gabriel Kronberger gabriel.kronberger at gmail.com
Sun Jun 17 07:37:58 EDT 2007


On 6/16/07, pierarda at iro.umontreal.ca <pierarda at iro.umontreal.ca> wrote:
> According to Marc, it seems that the debian package of gambit-c (which is not
> an "official" package) has syntax-case included by default for some reason.
> Therefore, using the debian version, try just not loading syntax-case manually.
>
> Don't forget to clean (apt-get remove packagename --purge) your system of both
>  versions, debian and source before reinstalling the package. Or even better, yet
> less "debianish", use only the source version. Debian choices are made to fit
> most of its users expectations, but know the programs less that their
> implementers.
>
> Tell us if it fixes your problem

Unfortunately this does not fix my problem.
I removed all Gambit-C files from my system

debian:/# apt-get remove gambc --purge
debian:/# rm -r /usr/local/Gambit-C

Then i reinstalled the gambc package

debian:/# apt-get install gambc

debian:/# gsi
Gambit Version 4.0 beta 20

> (define-syntax unless
    (syntax-rules ()
      ((unless test body ...)
       (if test #f (begin body ...)))))
*** ERROR IN (console)@2.19 -- Ill-formed expression
> (load "~~/syntax-case")
*** ERROR IN (console)@5.1 -- No such file or directory
(load "~~/syntax-case")
1>

It seems syntax-rules and/or define-syntax is not defined. The file
syntax-case.scm is not available.
Ok next i removed the debian package again.

debian:/# apt-get remove gambc --purge

And i compiled gambit-c 4.0b22 from the sources:

debian:/home/user/Desktop/gambc-4.0b22# make
[...]
debian:/home/user/Desktop/gambc-4.0b22# make check
[...]
============ ALL TESTS SUCCESSFUL
[...]
debian:/home/user/Desktop/gambc-4.0b22# make install
[...]
debian:/home/user/Desktop/gambc-4.0b22# make bootstrap
[...]
debian:/home/user/Desktop/gambc-4.0b22# export
PATH=/usr/local/Gambit-C/current/bin/:$PATH

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

>
> By the way, you may also do something with define-macro
>
> (define-macro (unless condition act1 . action)
>   `(if ,condition #f (begin ,act1 , at action)))
>
> (unless (= 1 3)
>         (pp "phew")
>         (pp "that was close !"))
>
> (pp (unless (= 1 1) (pp "never happens")))
> (pp (unless (= 1 2) (pp "whereas ") (pp "this happens") #t))
>
> This should let you define our own syntax if you can't succeed in having syntax-case
> working (but remember of hygienic or not macros)
>
> Hope it helps,
>
> Adrien
>
> On Fri, Jun 15, 2007 at 05:05:39PM +0200, Gabriel Kronberger wrote :
> > Hi,
> >
> > This is probably a silly question but I'm having major troubles with
> > define-syntax or syntax-rules.
> >
> > I used to work with the gambit debian packages version 4.0b20 however
> > it seems the necessary files (syntax-case.scm ...) are missing from
> > the package.
> > So I complied and installed 4.0b22. Now I can load the syntax-case.scm
> > file however it seems I can't get a simple syntax definition to work.
> > Even the simple example from the Gambit-C documentation doesn't work.
> >
> >
> > Gambit Version 4.0 beta 22
> >
> > > (load "~~syntax-case")
> > "/usr/local/Gambit-C/4.0b22/syntax-case.scm"
> > >(define-syntax unless
> > (syntax-rules ()
> > ((unless test body ...)
> > (if test #f (begin body ...)))))
> > *** ERROR IN (console at 3.15 -- Ill-formed expression
> >
> > Unfortunately i couldn't find information on this problem in the
> > documentation or the archives so i'm kinda stuck now. Any help is
> > appreciated.
> >
> > Thanks,
> > Gabriel
> > _______________________________________________
> > Gambit-list mailing list
> > Gambit-list at iro.umontreal.ca
> > https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
> >
>
> --
> "I am not a Church numeral; I am a free variable!"
> (The Scheme Underground)
>



More information about the Gambit-list mailing list