Lisp-likeness

Matthew D Swank akopa-is-very-much-like-my-mail-address at c.net
Tue Mar 15 23:48:44 CET 2005


On Tue, 15 Mar 2005 14:16:09 -0800, Thomas A. Russ wrote:

> The lisp snippet creates new functions each time the addn function is
> called, so one can interleave calls to the individual functions.

Yes, I believe them to be equivalent. Each call to addn creates an
activation record which is closed over by fn.

foo = addn(5)
bar = addn(6)
foo(4)
=> 9
bar(4) 
=> 10

Matt
-- 
"You do not really understand something unless you can explain it to your 
grandmother." — Albert Einstein.




More information about the Python-list mailing list