[plt-scheme] How to find the value associated to a symbol via an identifier ?

From: Eli Barzilay (eli at barzilay.org)
Date: Sun Feb 15 22:35:11 EST 2009

On Feb 15, Andre Mayers wrote:
> I would like to define "find-symbol-value", a function or a macro
> that will do the following
> 
> (define id45 45)
> (define idid 'id45)
> 
> (define (find-symbol-value symb)
>   ...)
> 
> (find-symbol-value idid)
> ; ==> 45 

It is possible to do this, but not in a way that will make you happy.
Perhaps you really need something like this:

  (define id45 (box 45))
  (define idid id45)
    
  (unbox idid)
  ; ==> 45 

?

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.