Does this help: 

> #lang racket
> 
> (define-namespace-anchor top)
> 
> (parameterize ((current-namespace (namespace-anchor->namespace top)))
>   (eval '(define x 10))
>   (namespace-variable-value 'x))



eval takes a namespace and you need to supply it explicitly (as an argument) or 
implicitly (via a parameter setting). 






On Nov 17, 2012, at 1:06 AM, Monica Tomson wrote:

> Hi,
> 
> When I use eval on an S-Expression, where there are something like (define 
> len (...)), racket screams at me define: not allowed in an expression context 
> in: (define len (make-length 10))
> 
> My questions are:
> 
> How to make eval work on definition?
> If eval is not designed to work on definitions, then is there some 
> workarounds that can make it work?
> I appreciate any help!
> 
> Thanks,
> 
> Monica
> 
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users

Attachment: smime.p7s
Description: S/MIME cryptographic signature

____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to