top | item 31877240

(no title)

anon_d | 3 years ago

I find this phrase "Automatic Currying" that people are using in this thread to be very strange.

It implies that `(add 3)` is being magically converted into `(\x -> (add 3 x))` by some fancy front-end feature.

But no, `add` is just a function that returns a function.

This pattern is core to the entire paradigm of functional programming, all the way down to the lambda calculus.

All functional programming languages are essentially just fancy syntax around lambda calculus. They have different implementation strategies (strict vs lazy), different type systems, and they have been extended with different primitives (floats, operations on floats, etc).

But at their core, they are all just lambda calculus.

In the lambda calculus, there is ONLY functions, and all functions take one argument. There are no tuples. So, multiple arguments are implemented with the pattern in question. For example:

mul = (λx. λy. λz. x(yz))

discuss

order

No comments yet.