2 ms·
Because lambda expressions of just one argument are the simplest possible thing that works. One of the neat things you learn if you start playing with lambda e
by tel 13y ago
Because lambda expressions of just one argument are the simplest possible thing that works.
One of the neat things you learn if you start playing with lambda expressions in languages with algebraic data types is that multiple argument functions are modeled perfectly as functions which take single, tuple-typed arguments.
f :: (Int, Int) -> Int
f = \(a, b) -> a + b
ghci> :t curry f
curry f :: Int -> Int -> Int
ghci> f(3,2)
5
So, if you let your lambdas be as simple as possible then you naturally get "multi-argument lambdas" as the combination of tuples and lambdas.