Here is a macro that is working, .. at least in the context it is being used:
(define-syntax (with-tables stx) (let*( [datum (syntax->datum stx)] [stem (cadr datum)] [body (cddr datum)] ) (datum->syntax stx (append `(let( [table-publication (string-append ,stem "_publication")] [table-author (string-append ,stem "_author")] [table-bridge-publication-author (string-append ,stem "_bridge_publication_author")] [table-unique-counters (string-append ,stem "_unique_counters")] )) body ) racket@> (with-tables "x" (displayln table-publication) table-author) x_publication "x_author" This same functionality as a syntax rule: (define-syntax with-tables (syntax-rules () [(with-tables stem body ...) (let( [table-publication (string-append stem "_publication")] [table-author (string-append stem "_author")] [table-bridge-publication-author (string-append stem "_bridge_publication_author")] [table-unique-counters (string-append stem "_unique_counters")] ) body ... ) ] )) #| racket@> (with-tables "x" table-author) reference to undefined identifier: table-author stdin::6353: table-author === context === /usr/share/racket/collects/racket/private/misc.rkt:87:7 |# Fails with a undefined identifier, but to do that it would have to evaluate the argument. Ok, so what did I do wrong here? ..not surprisingly, same result with define-syntax-rule .. (define-syntax-rule (with-tables stem body ...) (let( [table-publication (string-append stem "_publication")] [table-author (string-append stem "_author")] [table-bridge-publication-author (string-append stem "_bridge_publication_author")] [table-unique-counters (string-append stem "_unique_counters")] ) body ... )) #| racket@> (with-tables "x" table-author) reference to undefined identifier: table-author stdin::6353: table-author === context === /usr/share/racket/collects/racket/private/misc.rkt:87:7 |# -Thomas
____________________ Racket Users list: http://lists.racket-lang.org/users