Thomas A. Russ wrote: > Fernando <[EMAIL PROTECTED]> writes: > > >>On 15 Mar 2005 00:43:49 -0800, "Kay Schluehr" <[EMAIL PROTECTED]> >>wrote: >> >> >>>Maybe You can answer my question what this simple LISP function does ? >>> >>>(defun addn (n) >>> #'(lambda (x) >>> (+ x n))) >> >>The same as >>def addn(n): >> def fn(x): >> return n + x >> return fn > > > Is this really equivalent?
AFAIK, yes. I admit that I know almost nothing about Lisp though. And I'm not a Python guru either. > What happens if you call addn more than once with different > parameters. Will you get different functions that you can > use simultaneously? Yes. Using the addn function defined above, you can do for example: >>> add4 = addn(4) >>> add10 = addn(10) >>> add4(5) 9 >>> add10(7) 17 >>> add4(add10(28)) 42 And so on. At least, I think that's what you mean. -- If I have been able to see further, it was only because I stood on the shoulders of giants. -- Isaac Newton Roel Schroeven -- http://mail.python.org/mailman/listinfo/python-list