[racket] Making namespaces meet

From: Richard Cleis (rcleis at mac.com)
Date: Fri Nov 5 09:56:32 EDT 2010

Have you read Guide:Racket 15.1 ?  A practical example might help. I think your second example is the same as the first, since eval uses the current namespace if none is provided.

rac

On Nov 5, 2010, at 5:53 AM, Jukka Tuominen wrote:

> 
> Hi,
> 
> I'm having trouble of getting namespaces meet when making dynamic
> definitions. I made a simple example below.
> 
> ((lambda ()
>  (define x 10)
>  (eval (list 'define 'y 5))
>  (+ x y)))
> 
> ;>> reference to undefined identifier: y
> 
> 
> 
> I then tried to "store" one of the namespaces and pass it on to another, but
> I guess that's not the way the namespaces work.
> 
> 
> 
> ((lambda ()
>  (define namespace (current-namespace))
>  (define x 10)
>  (eval (list 'define 'y 5) namespace)
>  (+ x y)))
> 
> ;>> reference to undefined identifier: y
> 
> 
> Any ideas how to solve this?
> 
> br, jukka
> 
> 
> |  J U K K A   T U O M I N E N
> |  m a n a g i n g   d i r e c t o r  M. A.
> |
> |  Finndesign  Kauppiaankatu 13, FI-00160 Helsinki, Finland
> |  mobile +358 50 5666290
> |  jukka.tuominen at finndesign.fi  www.finndesign.fi
> 
> 
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users



Posted on the users mailing list.