(define-syntax test (ir-macro-transformer (lambda (exp inject compare) (let* ((type (cadr exp)) (body (cddr exp)) (get-x (inject (symbol-append (strip-syntax type) '- (strip-syntax 'x)))) (get-y (inject (symbol-append (strip-syntax type) '- (strip-syntax 'y))))) `(let ((thing ,@body)) (list (,get-x thing) (,get-y thing))))))) (define-syntax test-outer (ir-macro-transformer (lambda (exp inject compare) (let* ((type (cadr exp)) (body (cddr exp))) `(test ,type ,@body))))) #;704> (test-outer my-foo (make-foo 1 2)) Error: unbound variable: my-foo-x Call history: (##sys#list (##core#quote let) (##sys#list (##sys#cons (##core#quote thing) body)) (##sys#list (##co... (##sys#list (##sys#cons (##core#quote thing) body)) (##sys#cons (##core#quote thing) body) (##sys#list (##core#quote list) (##sys#list get-x (##core#quote thing)) (##sys#list get-y (##core#qu... (##sys#list get-x (##core#quote thing)) (##sys#list get-y (##core#quote thing)) (##core#let ((thing2353278 (make-foo 1 2))) (list2353279 (my-foo-x thing2353278) (my-foo-y thing2353... (##core#begin (list2353279 (my-foo-x thing2353278) (my-foo-y thing2353278))) (list2353279 (my-foo-x thing2353278) (my-foo-y thing2353278)) (my-foo-x thing2353278) (my-foo-y thing2353278) (make-foo 1 2) (make-foo 1 2) [make-foo] (##sys#make-structure (##core#quote foo) x y) (list2353279 (my-foo-x thing2353278) (my-foo-y thing2353278)) (my-foo-x thing2353278) <--