Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

scope - live

2 views
Skip to first unread message

ALBINALI4

unread,
Jan 28, 2002, 1:59:57 AM1/28/02
to
Hi,
How can a variable in scheme be live but not in scope?

Thanks.
Fahd

Ulrich Hobelmann

unread,
Jan 28, 2002, 5:06:26 AM1/28/02
to
ALBINALI4 wrote:
>
> Hi,
> How can a variable in scheme be live but not in scope?

(define (new-counter-from n)
(lambda ()
(set! n (+ n 1))
n))

If called, this functions gives you a closure which captures n, but
doesn't
give you any access to it.
In essence everything bound anywhere (in any environment) is live, but
only one
environment list is in scope.
Ulrich

0 new messages