News for hackers. Stuff that matters.
Re:Conversations with a six-year-old on functional programming by omegaham on Tuesday May 08, 2018 @09:31AM (#17020735)
> "How is this read: \lambda x.\, x - 3"

I'd read it as "Lambda x maps to x - 3."

In Python, you can rewrite lambdas as regular functions if you want.

    lambda x : x - 3
is the same as

    def f(x):
        return x - 3
This runs in the IDLE as such:

    >>> f = lambda x : x - 3
    >>> def g(x):
    ...     return x - 3
    ... 
    >>> f(0)
    -3
    >>> g(0)
    -3
    >>> (lambda x : x - 3)(0)
    -3

There are no comments on this comment yet.