[gambit-list] Gambit-C macros

Bob McIsaac bobmc_net at rogers.com
Sun Aug 26 15:58:00 EDT 2012


3 questions...

I'm looking for a "when" macro and tried one patterned on "unless". It 
behaves like "when-not". How do I write a proper "when" macro?

(define-syntax when-not
   (syntax-rules ()
     ((when-not test body ...)
      (if test #t (begin body ...)))))

(define (test-when n)
   (when-not (not (< n 50))
       (println "line1 " n)
       (println "line2 " n)
       (println "line3 " n)))
(test-when 0) (test-when 3) (test-when 55)

Re "define-syntax" the Gambit-C manual says .."Note that this 
implementation of syntax-case does not support special forms that are 
specific to Gambit." What are the implications of this statement? Is 
there a preferred model for writing Gambit-C macros?

Some code has a "##" prefix like..
(##define-macro (err form)
   `(let ()
      (##declare (safe) (generic))
      (err-form (lambda () ,form))))

Why is that?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20120826/4e7fa8b5/attachment.htm>

More information about the Gambit-list mailing list