Just an update, I was able to make this work. #lang racket (require (for-syntax racket/syntax syntax/stx))
(define-syntax-rule (pred? x) (> 3 x)) (define-for-syntax (recursive-expand stx) (let loop ([l (syntax->list stx)]) (cond [(stx-null? l) l] [(stx-pair? (stx-car l)) (cons (loop (stx-car l)) (loop (stx-cdr l)))] [(equal? 'pred? (syntax->datum (stx-car l))) (local-expand (cons (stx-car l) (loop (stx-cdr l))) 'expression #f)] ;; this works [else (cons (stx-car l) (loop (stx-cdr l)))]))) (define-syntax (test stx) (syntax-case stx () [(_ x) (with-syntax ([expanded (recursive-expand #'x)]) #''expanded)])) (module+ test (require rackunit) (check-equal? (test (or (< 10 x) (pred? y))) '(or (< 10 x) (> 3 y)))) The code I couldn't figure out last night was: (local-expand (cons (stx-car l) (loop (stx-cdr l))) 'expression #f)] Thanks. -- Talk to you soon, Scott Klarenbach PointyHat Software Corp. www.pointyhat.ca p 604-568-4280 e sc...@pointyhat.ca 200-1575 W. Georgia Vancouver, BC V6G2V3 _______________________________________ To iterate is human; to recur, divine
____________________ Racket Users list: http://lists.racket-lang.org/users