[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] basic Scheme question

From: Elf
Subject: Re: [Chicken-users] basic Scheme question
Date: Mon, 27 Oct 2008 05:49:11 -0700 (PDT)

On Thu, 23 Oct 2008, Shawn Rutledge wrote:

#;10> (begin (define update #f) (let ([v 'foo]) (set! update (lambda
(d s) (printf "~s was ~s~%" d (eval d)) (set! d s)))))
#;11> (update 'v 'bar)
Error: unbound variable: v

What I'm trying to do is pass the name of a let-bound variable in to a
lambda defined within the let context, in order to tell that lambda to
access that let-bound variable.  eval doesn't work because it looks in
the outer environment, right?  (in which v is not bound)

unless there's some way to add new bindings to an arbitrary env (ie, extend
a let at runtime), then youd be better served by either explicit setting
procs for each let-bound var, or by having some form of dispatch from a single name.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]