guile-user
[Top][All Lists]
Advanced

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

Re: Binding symbols in stages


From: Andy Wingo
Subject: Re: Binding symbols in stages
Date: Sat, 06 Mar 2010 12:13:04 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux)

Hi Hans,

On Sat 06 Mar 2010 10:03, Hans Aberg <address@hidden> writes:

>   (define add1 (lambda (y) (+ x y)))
> and then
>   (define add (lambda (x) ...))
> Thus in two separate steps, where the unbound symbol x in the first
> expression is bound only in the second.

If I understand you correctly, this is not possible in normal Scheme. (I
say normal Scheme because you can build your own interpreter for another
kind of Scheme within Guile, one with dynamic binding, say.)

The way to leave a bound identifier unbound is precisely to wrap it in a
closure. For example to "delay binding" of Y and Z in:

  (lambda (x) (+ x y z))

you need wrap the expression in a lambda:

  (lambda (y z)
    (lambda (x) (+ x y z)))

Which seems to be what you're trying to get away from, though I don't
know why.

Hope this helps,

Andy
-- 
http://wingolog.org/




reply via email to

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