Re: [racket] Creating ids from symbols

2011-08-07 Thread Mark Carter
> From: Matthew Flatt >   http://docs.racket-lang.org/guide/reflection.html > > for more information about namespaces. In the end, I couldn't get no loving from it. BUT, I did discover the following ... Suppose I define the file cache.rkt: (module cache racket   (provide encache inspect-cac

Re: [racket] Creating ids from symbols

2011-08-05 Thread Matthew Flatt
At Fri, 5 Aug 2011 15:04:42 +0100 (BST), Mark Carter wrote: > It doesn't quite work: > > (define foo 42) > (define bar 'foo) > (namespace-set-variable-value! bar 43) > foo ; => 42, but I want it to be 43 Those 4 lines in a REPL produce 43, but my guess is that you have the code in a module. In a

Re: [racket] Creating ids from symbols

2011-08-05 Thread Mark Carter
>The `namespace-set-variable-value!' function might work. It doesn't quite work: (define foo 42) (define bar 'foo) (namespace-set-variable-value! bar 43) foo ; => 42, but I want it to be 43 I guess it's perfectly possible to work around it by defining a cache as a hash, and then getting an se

Re: [racket] Creating ids from symbols

2011-08-05 Thread Matthew Flatt
The `namespace-set-variable-value!' function might work. At Fri, 5 Aug 2011 08:59:09 +0100 (BST), Mark Carter wrote: > Is it possible to set an id from a symbol, call it set-symbol? For example, I > might type > (define life -12) > > (set-symbol 'life 42) > life ; => 42 > > The reason I want to

[racket] Creating ids from symbols

2011-08-05 Thread Mark Carter
Is it possible to set an id from a symbol, call it set-symbol? For example, I might type (define life -12) (set-symbol 'life 42) life ; => 42 The reason I want to do this is so that I can store a cache of variables to disk. The cache will contain a list of variables to be stored. So I might ul