I'm trying to write a macro provide a new way to define functions so that:<div><br></div><blockquote class="webkit-indent-blockquote" style="margin:0 0 0 40px;border:none;padding:0px"><div><div><br></div><div>(define fold-left</div>
<div>� (function</div><div>� �_ i '() -> i</div><div>� �f i (cons x xs) -> (fold-left f (f i x) xs)))</div></div></blockquote><div><br></div>Would be valid syntax that would expand to:<div><br></div><blockquote class="webkit-indent-blockquote" style="margin:0 0 0 40px;border:none;padding:0px">
<div><div>(define fold-left</div><div>� (match-lambda*</div><div>� � [(list _ i '()) i]</div><div>� � [(list f i (cons x xs)) (fold-left f (f i x) xs)]))</div></div><div><br></div></blockquote>So far I have been able to get there half-way by wrapping each <i>args ...</i>�-> <i>body</i>�pattern in parens, which makes the above declaration look like this:<div>
<br></div><blockquote class="webkit-indent-blockquote" style="margin:0 0 0 40px;border:none;padding:0px"><div>(define fold-left<br>� (function<br>� �[_ i '() -> i]<br>� �[f i (cons x xs) -> (fold-left f (f i x) xs)]))</div>
<div><br></div></blockquote>By using this macro:<div><div><div><div><br></div><blockquote class="webkit-indent-blockquote" style="margin:0 0 0 40px;border:none;padding:0px"><div><div>(define-syntax function</div></div><div>
<div>� (syntax-rules (->)</div></div><div><div>� � [(_ (args ... -> body) ...)</div></div><div><div>� � �(match-lambda*</div></div><div><div>� � � �[(list args ...) body]</div></div><div><div>� � � �...)]))</div></div>
</blockquote><div><br></div></div></div></div><div>What macro voodoo do I need to harness in order to be able to implement the first definition syntax where the <i>args ... -> body</i>�segments need not be wrapped in parens?</div>
<div><br></div><div>BTW, first time poster, so go easy on me :)</div><div><br></div><div>Thanks a bunch!</div><div>-- Helmut</div>