[plt-scheme] define-syntax help
Given the following:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define *field-hash* (make-hash-table))
(define (make-key mod sym)
(string->symbol (format "~a.~a" mod sym)))
(define-syntax (register stx)
(syntax-case stx ()
((_ sym val mod)
#`(hash-table-put! *field-hash* (make-key 'mod 'sym) val))))
(reqister you "joe" main)
(register you "sue" aux)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
I'd like to define syntax for lookup, so that:
(lookup you main) => "joe"
(lookup you aux) => "sue"
(register me (lookup you) main) ;; me gets value "joe", lookup assumes mod=main
(register me2 (format "~a smith" (lookup you aux)) main) ;; me2 gets value "sue smith"
Is it possible to code lookup with the ability to see the 'mod' value from
the 'register' syntax?
Wayne