pval was: Re: [CM] symbol-value (was: 2 questions)
Larry Troxler
lt@westnet.com
Sun, 20 Oct 2002 12:05:54 -0400 (EDT)
On Sat, 19 Oct 2002, Rick Taube wrote:
> >Well, as stated before, that doesn't really help if you're concerned
> >with dynamic change of the meaning of a certain symbol during the
> >course of the process. I'd rather store references of things than the
> >things themselves in the cycle.
>
> use pval, thats what its for. its stores an expression, which can be simply a reference to a variable. this is what happens:
>
> (define (foo n)
> (let ((vbl 0))
> (process with pat = (new cycle
> :of (list 'a
> (pval vbl)
> 'c))
> repeat n
> do
> (format true " ~s" (next pat))
> (incf vbl))))
>
> (events (foo 30) false)
> A 1 C A 4 C A 7 C A 10 C A 13 C A 16 C A 19 C A 22 C A 25 C A 28 C
>
>
In what environment does pval evaluate things? From your example, it looks
like it's the current environment when "next" is called.
I don't pretend to necesarily completely understand CL and Scheme's
concept of environments, so forgive me if I'm asking the wrong question.
I'm just interested in knowing what local variables are available, etc..
Larry