13 ms·
I think the author is right that the meaning of `lambda` in the Python is really `anonymous def` and could be more succinctly and simply explained without any r
by solidsnack9000 4y ago
I think the author is right that the meaning of `lambda` in the Python is really `anonymous def` and could be more succinctly and simply explained without any reference to lambdas at all.
The Lambda Calculus really is formally about single argument functions. Here is one of many good references for that: https://plato.stanford.edu/entries/lambda-calculus/ https://plato.stanford.edu/entries/lambda-calculus/
Hence, the multi-argument lambdas of Python are something of a contradiction in terms, or a kind of artistic license. Now that I think about it, I can't think of a good reason not to use `def` for the anonymous function syntax in Python:
def (x, y, z...): <expr>
- thrown_22 4y ago>The Lambda Calculus really is formally about single argument functions. It needn't be: https://personal.utdallas.edu/~gupta/courses/apl/lambda.pdf https://personal.utdallas.edu/~gupta/courses/apl/lambda.pdf Currying is just an easy way to deal with multi-argument functions. You then need to add a bunch of syntactic sugar to avoid the issues the the author complains about here (something that Haskell has done). You could just as easily go the opposite route and add a bunch of different syntactic sugar and deal with multi-variable functions directly (as python does).