|
|
|
|
|
by jstanley
1452 days ago
|
|
Couldn't I "curry" a function f(x,y)
to "partially apply" it on x=3 with just: function(y) { return f(3,y); }
?And then I've "partially applied" f. Is this what currying is? The syntax I posted is ambivalent about which arguments you're partially applying, isn't that superior to only being able to provide the first argument? |
|
And the Haskell version is more general, since it doesn't require a unique function to be written for each possible partial application. Of course, you can do this in languages with closures:
But in Haskell that extra function isn't needed, it's just already there and called f. Regarding your last statement, there are also combinators in Haskell that allow you to do things like this: So I'm not sure it's strictly superior, it is more explicit though.