<div dir="ltr"><div>Just an update, I was able to make this work.</div><div><br></div><div>#lang racket</div><div>(require (for-syntax racket/syntax syntax/stx))</div><div><br></div><div>(define-syntax-rule (pred? x) (> 3 x))</div>
<div><br></div><div>(define-for-syntax (recursive-expand stx)</div><div>  (let loop ([l (syntax->list stx)])</div><div><span class="" style="white-space:pre">     </span>(cond [(stx-null? l) l]</div><div><span class="" style="white-space:pre">            </span>  [(stx-pair? (stx-car l))</div>
<div><span class="" style="white-space:pre">            </span>   (cons (loop (stx-car l)) (loop (stx-cdr l)))]</div><div><span class="" style="white-space:pre">           </span>  [(equal? 'pred? (syntax->datum (stx-car l)))</div><div>
<span class="" style="white-space:pre">               </span>   (local-expand (cons (stx-car l) (loop (stx-cdr l))) 'expression #f)] ;; this works</div><div><span class="" style="white-space:pre">          </span>  [else</div><div><span class="" style="white-space:pre">            </span>   (cons (stx-car l) (loop (stx-cdr l)))])))</div>
<div><br></div><div>(define-syntax (test stx)</div><div>  (syntax-case stx ()</div><div><span class="" style="white-space:pre">       </span>[(_ x)</div><div><span class="" style="white-space:pre">     </span> (with-syntax ([expanded (recursive-expand #'x)])</div>
<div><span class="" style="white-space:pre">    </span>   #''expanded)]))</div><div><br></div><div>(module+ test</div><div>  (require rackunit)</div><div>  (check-equal? (test (or (< 10 x) (pred? y)))</div><div><span class="" style="white-space:pre">                         </span>'(or (< 10 x) (> 3 y))))</div>
<div><br></div><div>The code I couldn't figure out last night was:</div><div>(local-expand (cons (stx-car l) (loop (stx-cdr l))) 'expression #f)]<br></div><div><br></div><div>Thanks.</div><div><br></div>-- <br>Talk to you soon,<br>
<br>Scott Klarenbach<br><br>PointyHat Software Corp.<br><a href="http://www.pointyhat.ca" target="_blank">www.pointyhat.ca</a><br>p 604-568-4280<br>e <a href="mailto:scott@pointyhat.ca" target="_blank">scott@pointyhat.ca</a><br>
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">200-1575 W. Georgia</span><br>Vancouver, BC <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">V6G2V3</span><br>
<br>_______________________________________<br>To iterate is human; to recur, divine
</div>