<div dir="ltr">Hi -<br><br>are there specific rules that governs the choice of context to datum-&gt;syntax?&nbsp; I&#39;m finding that the choices of the context impacts whether the name can be captured, and are not seeing what the issues are... <br>
<br>Below are two versions of `if-it` - the first version works with #&#39;_, but the second version cannot work with it (it works with #&#39;test).<br><br>Any pointers are appreciated, thanks.<br>yc<br><br><div style="margin-left: 40px; font-family: courier new,monospace;">
(define-syntax (if-it stx)<br>&nbsp; (syntax-case stx ()<br>&nbsp;&nbsp;&nbsp; ((_ test then else)<br>&nbsp;&nbsp;&nbsp;&nbsp; (with-syntax ((it<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (datum-&gt;syntax #&#39;_&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#39;it)))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #&#39;(let ((it test))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if it test else))))))<br><br>(if-it &#39;(abc def) it &#39;nil) ;; works <br><br>(define-syntax (if-it1 stx)<br>&nbsp; (syntax-case stx ()<br>&nbsp;&nbsp;&nbsp; ((_ test then else)<br>&nbsp;&nbsp;&nbsp;&nbsp; (with-syntax ((it<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (datum-&gt;syntax #&#39;_ ;; doesn&#39;t work... works if replaced with #&#39;test<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#39;it)))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #&#39;(let ((it test))&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if it then else)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )))))<br><br>(if-it1 &#39;(abc def) it &#39;nil) ;; =&gt; reference to undefined identifier: it<br>
</div><br></div>