On Jun 3, 4:43 am, Gregory Ewing <greg.ew...@canterbury.ac.nz> wrote:
> Alain Ketterlin wrote:
> > But going against generally accepted semantics should at least
> > be clearly indicated. Lambda is one of the oldest computing abstraction,
> > and they are at the core of any functional programming language.
>
> Yes, and Python's lambdas behave exactly the *same* way as
> every other language's lambdas in this area. Changing it to
> do early binding would be "going against generally accepted
> semantics".
>
> It's not the lambda that's different from other languages,
> it's the for-loop. In languages that encourage a functional
> style of programming, the moral equivalent of a for-loop is
> usually some construct that results in a new binding of the
> control variable each time round, so the problem doesn't
> arise very often.
>
> If anything should be changed here, it's the for-loop, not
> lambda.
>
> --
> Greg

I also thought so

So I tried:
Recast the comprehension as a map
Rewrite the map into a fmap (functionalmap) to create new bindings

def fmap(f,lst):
    if not lst: return []
    return [f(lst[0])] + fmap(f, lst[1:])

Still the same effects.

Obviously I am changing it at the wrong place...
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to