[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Closure of lexical environment in Scheme closures
- From: Quinn Tyler Jackson <quinn-j@...>
- Date: Thu, 11 Nov 2004 22:11:34 -0800
> Aha! So, it takes a snapshot of all of the current bindings of all of
> the local variables in the lexical environment. Sounds clear to me.
> The bindings of the variables are the values of the variables, not the
> addresses that the names point to. I sure hope nobody's disputing that.
OK. I've been following this topic.
What is the expected output of the following snippet if the function
returned by get_function is a closure?
k = 0;
function n(x)
k = k + 1;
return x + 10;
end
function get_function(x, y)
return
function (y)
z = n(x);
end;
end
f = get_function(100, 100);
f(100);
f(110);
print ("n called " .. k .. " times");
--
Quinn Tyler Jackson
http://members.shaw.ca/qjackson/