On 7-Aug-09, at 11:51 AM, vasil wrote:
May be you need this:
(define-macro (define-at-expand-time-and-runtime . body) (eval `(define ,@body)) `(define ,@body))
(define-at-expand-time-and-runtime global "foo")
(define-macro (magic name value) `(define ,(string->symbol (string-append global "-" name)) ,value))
(magic "bar" 1)
Here's a stylistic improvement on your idea. The advantage is that the nature of the expression is more apparent (for example you can grep for "(define global" to find the definition of global).
Marc
(define-macro (at-expand-time-and-runtime expr) (eval expr) `,expr)
(at-expand-time-and-runtime (define global "foo"))
(define-macro (magic name value) `(define ,(string->symbol (string-append global "-" name)) ,value))
(magic "bar" 1)