[plt-scheme] Meaning of set-box!
My understanding is that set-box! is used to modify the contents of a box, but neither of these seem to work
> (define (my-set-bang x a)
(set-box! x a))
> (define x 1)
> (my-set-bang (box x) 2)
> x
1
> (set-box! (box x) 2)
> x
1
On the other hand, I can see that the box contents does change, even if the variable x does not change
> (define x 1)
> (define y (box x))
> (set-box! y 2)
> x
1
> (unbox y)
2
>
What I'm trying to do is define a mutator. to be specific, I want to make incremental updates to an environment/symbol table. What I'm doing now is something like
(define (evaluate exp)
lambda (env)
...
(values result new-env))
===
Gregory Woodhouse <gregory.woodhouse at va.gov <mailto:gregory.woodhouse at med.va.gov> >
Office of Information and Technology
+1 510 768 6862
"The whole of science is nothing more than a refinement
of everyday thinking." -- Albert Einstein