I have a situation where I'd like to do something like...
(define (def a b)
(store a b) ; store the definition of 'a' somewhere
(define-global a b)) ; also define 'a' so that its definition
; is accessible later in the program
Is this possible somehow? As far as I know define-global
doesn't exist, so define
statements inside procedures apply only to the local environment.
This is intended for creating a 'def' procedure for an embedded DSL in scheme, so in addition to making the definition I need to store the definition in my own symbol table. Eventually I want to 'intercept' symbol look-ups to apply my own transformation, returning an expression for the symbol look-up instead of actually performing it.
I'm using Gambit-C Scheme.
Thanks.