rschroev_nospam_ml at fastmail.fm
Wed Mar 16 00:20:31 CET 2005
Thomas A. Russ wrote:
> Fernando <frr at easyjob.net> writes:
>>On 15 Mar 2005 00:43:49 -0800, "Kay Schluehr" <kay.schluehr at gmx.net>
>>>Maybe You can answer my question what this simple LISP function does ?
>>>(defun addn (n)
>>> #'(lambda (x)
>>> (+ x n)))
>>The same as
>> 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)
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
More information about the Python-list