You want something like this: 

(define-syntax (with-tables stx)
  (syntax-case stx () 
    [(with-tables stem body ...)
     (let ([table-author (datum->syntax stx 'table-author)]
           ;; ... ditto for other identifiers for which you wish to break 
lexical scope 
           )
       #`(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 ...))]))

(with-tables "x" table-author)

;; --- 

To achieve this with syntax-rules would be, well, hard.

;; --- 

The accepted way of writing this macro is: 

(define-syntax (with-tables stx)
  (syntax-case stx () 
    [(with-tables stem (table-author
                        ;; ... add other names you wish to bind in body
                        ) 
                  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 ...)]))

(with-tables "x" (table-author) table-author)




____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to