|
![](/i/fill.gif) |
On 22-4-2012 12:40, Warp wrote:
> Orchid Win7 v1<voi### [at] dev null> wrote:
>>> For instance,
>>> I still don't understand what currying *really* is about, and every time
>>> I try to suggest "is like this?" the answer is "not really".
>
>> 1. You can take a 5-argument function, pass it 2 argument, and get a
>> 3-argument function as the result.
>
> But that's the thing: It sounds so trivial as to defy sense. Why give
> a particular name to such a trivial thing? It's like calling the act of
> taking a 3-dimensional vector and expanding it to a 4-dimensional one
> "potatoing", or taking two integers and adding them together "bananaing",
> or taking a class and adding another class as its member "orangeing".
> Why give an obscure name to such a trivial operation?
>
> But then when one starts asking questions like "so it's like giving
> default values to function parameters?" or "so it's like writing another
> function with less parameters that calls the first function by giving it
> some default values as the rest of the parameters?", the answer is something
> like "not really".
My answers to why currying is important is that
- if you have currying, you have function application. if you have a one
input function and you supply that input you reduce it to a zero
argument function a.k.a. a constant. If you think about it that way the
distinction between a value and a function gets blurred.
- I think that one of the main reasons to give it a name is that when
the concept was invented you suddenly had (non-exotic) functions that
could take functions as argument and return yet another function. In
short it is when functions transformed from recipes to objects.
When you have done OO languages for some time you might not see the
point anymore, that does not mean that at one point in time you made the
mental transition yourself.
--
tip: do not run in an unknown place when it is too dark to see the
floor, unless you prefer to not use uppercase.
Post a reply to this message
|
![](/i/fill.gif) |