[plt-scheme] eval and define
>> (define fcn (gensym "p-"))
>> fcn
> p-113
>> (eval `(define ,fcn (lambda () (+ 1 1))))
>> p-113
> . reference to undefined identifier: p-113
>> (p-113)
> . reference to undefined identifier: p-113
Hi Nik,
Here's a reworked example:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> (define fcn (gensym "p-"))
> (eval `(define ,fcn (lambda () (+ 1 1))))
> (eval fcn)
#<procedure:p-3>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
That being said, what's the nature of the dynamically generated functions
that you're building? It might be that, if things are restricted enough,
that you can do without eval. Can you give us more details?
Good luck!