[gambit-list] maco to call define w/ varaible name created dynamically

lowly coder lowlycoder at huoyanjinjing.com
Fri Aug 7 11:41:31 EDT 2009


Suppose I have the following:

(define global "foo")

(define-macro (magic ...))

(magic "bar" 1); <-- I want this to expand to (define foo-bar 1)



How can I make this happen? The macro needs to access the value of
"global", but it can't at compile time; if the macro outputs some code
that takes advantage of things at run time, I can get to:

(define (string->symbol (string-append "foo" "-" "bar")) 1)

but this, of course, tries to define a function string->symbol rather
than what I want.

Thanks!



More information about the Gambit-list mailing list