First note there is more than one code/macro expander for Gambit: Gambit's default, the one with Black Hole, and the syntax-case library file, for instance.<div><br></div><div><div class="gmail_quote">2012/8/26 Bob McIsaac <span dir="ltr"><<a href="mailto:bobmc_net@rogers.com" target="_blank">bobmc_net@rogers.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<font face="Courier New, Courier, monospace">Hi:<br>
<br>
3 questions...<br>
<br>
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?<br>
<br>
(define-syntax when-not<br>
(syntax-rules ()<br>
((when-not test body ...)<br>
(if test #t (begin body ...)))))<br>
<br>
(define (test-when n) <br>
(when-not (not (< n 50))<br>
(println "line1 " n)<br>
(println "line2 " n)<br>
(println "line3 " n)))<br>
(test-when 0) (test-when 3) (test-when 55)<br>
;-------------------------------------------<br></font></div></blockquote><div><br></div><div>I'm not clear about what you are trying to achieve here.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"><font face="Courier New, Courier, monospace">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?<br></font></div></blockquote><div><br></div><div>No support for #!rest #!optional #!key would be a good start. Not clear atm about more.</div><div>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000"><font face="Courier New, Courier, monospace">
;------------------------------------------------------------<br>
<br>
Some code has a "##" prefix like..<br>
</font>(##define-macro (err form)<br>
`(let ()<br>
(##declare (safe) (generic))<br>
(err-form (lambda () ,form))))<br>
<br>
Why is that?</div></blockquote><div><br></div><div>Generally in Gambit ##-prefixes on Gambit-provided procedures is to say it's the non-typechecked variant.</div><div><br></div><div>As for Gambit-provided syntactical forms (##define-macro ##lambda etc.) I believe they're equivalent with the non-prefixed variant.</div>
<div><br></div><div>Brgds</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000"><span class="HOEnZb"><font color="#888888">=bob=<br>
<br>
<code></code><font face="Courier New, Courier, monospace"> </font>
</font></span></div>
<br>_______________________________________________<br>
Gambit-list mailing list<br>
<a href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a><br>
<a href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list" target="_blank">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a><br>
<br></blockquote></div><br></div>