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

pierarda at iro.umontreal.ca pierarda at iro.umontreal.ca
Fri Jun 15 22:14:38 EDT 2007


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

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