<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 08/26/2012 06:49 PM, Mikael wrote:<br>
>>I'm not clear about what you are trying to achieve here.<br>
<br>
Thanks, Mikael, for your helpful reply. In addition to
understanding Gambit specifics, I was trying to create WHEN. I
finally found a couple of examples in "Teach Yourself Scheme in
Fixnum days" .. they both work although quoted version needed
adjustment.<br>
<br>
(define-macro _when ;; alternate version<br>
(lambda (test . branch)<br>
(list 'if test<br>
(cons 'begin branch))))<br>
<br>
(define-macro when<br>
(lambda (test . branch)<br>
`(if ,test {IF and BEGIN from the example uppercase did
not work}<br>
(begin ,@branch))))<br>
<br>
=Bob=<br>
</div>
<blockquote
cite="mid:CACbx-M_MUwOS59O7orF_Nu0MzC3n3_9krE8A_N7foMQgywGgpA@mail.gmail.com"
type="cite">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
moz-do-not-send="true" 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 moz-do-not-send="true"
href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a><br>
<a moz-do-not-send="true"
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>
</blockquote>
<br>
</body>
</html>