In Haskell there are two concepts that doesn't look like they are the same, but I don't understand the difference. They are "point-free style" and "partially applied functions".
For point-free styles I'm going to get this example:
instead of: sum xs = foldr (+) 0 xs
we can use: sum = foldr (+) 0
Because xs
is on both sides we can omit it.
And for partially applied functions, I'm going to get this example:
increment = add 1
which could be increment n = add 1 n
, because at the moment of calling it, you need to do it with the argument, just as the first example.
So, what's the real difference between them?
But, for me, in the end it's the same.
(+)
is a function that takes an argument and returns another function, and Haskell's syntax lets you pretend that(+) 3 5
is a function applied to two arguments, something that is harder to do with the explicitly parenthesized version((+) 3) 5
. In some sense, a "fully applied" function is just an expression that doesn't return another function. – chepner