[plt-scheme] eval and define
From: nik gaffney (nik at fo.am)
Date: Thu Dec 28 07:58:09 EST 2006 |
|
hello,.
im trying to generate function definitions using eval, but it's not really
behaving how i would expect (with common lisp shaded expectations) and im not
sure exactly what im misunderstanding in the the translation between the
following fragments
.. in common lisp
cl-user> (defvar fcn (gensym "p-"))
fcn
cl-user> fcn
#:|p-2004|
cl-user> (eval `(defun ,fcn () (+ 1 1)))
#:|p-2004|
cl-user> (#:|p-2004|)
2
using DrScheme ... .
> (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
ive tried using eval with (current-namespace) and (interaction-environment),
but without success, so i was wondering what im missing ?+
nzk