Live data from Hacker News

Can we stop calling it currying?

news.ycombinator.com

11–20 of 44 posts

Re: Can we stop calling it currying?

#13

Another name for currying is "partial application". See http://en.m.wikipedia.org/wiki/Partial_application

not quite the same thing- currying turns polyadic function into a sequence of unary functions, whereas partial application gives you a function with a couple arguments filled already

Re: Can we stop calling it currying?

#14

Another name for currying is "partial application". See http://en.m.wikipedia.org/wiki/Partial_application

This a common misconception. Partial application is like taking f(x, y) = x + y and turning it into f(y) = 1 + y by supplying x = 1. Currying is like taking the same function and turning it into (f(x))(y) = x + y. Expressing f as a higher-order single argument function in this way gives us the advantages of partial application using normal total application.

A good example is the derivative function from calculus, which could be specified in at least two obvious ways. A simple, but ugly solution is to have it take a function and a point as arguments and return the value of the derivative at that point.

Alternatively, it could take a function and return its derivative as a function, which could then be evaluated at many different points.

This is the difference between e.g.

(Float -> Float, Float) -> Float, and (Float -> Float) -> (Float -> Float).

Taking this idea to its logical conclusion and applying it to any multiple argument function gives you currying.

Re: Can we stop calling it currying?

#15
"Call 'it' something 'meaningful'"?? "Currying" is meaningful...

Perhaps you just aren't comfortable with the idea that its meaning wasn't formed via some sort of compounding pattern you thought would be more inherently meaningful(?), or maybe you feel the need for natural language to be as precise as your programs?

There are lots of different ways that new words come into a language, and one of them is "verbificiation" of a noun (sometimes even a proper one). In this case, Haskell Curry was "verbified", and so now we have "currying". I don't care to speculate as to why "currying" was favored over "some-compounding-of-words-that-you-think-precisely-conveys-the-exact-meaning", but I assure you the first person to use "currying", did it because they thought in that moment that that was the best way to meaningfully convey the idea they were talking about, and the others around that person (implicitly) agreed by using it too. If you really think you can do better, start calling it something else; if it's any good, it'll catch on.

Re: Can we stop calling it currying?

#17

To answer your question, I don't think it matters what it's called, just that you learn what it means (just like any word). As an aside, what you're describing isn't strictly currying. The key insight of currying is that a function of multiple arguments can be decomposed in to a series of function applications where each function takes only one argument - this is related to but not the same as partial application.

[deleted]

Re: Can we stop calling it currying?

#18

I don't recall currying -- either the name or the concept -- being a particular stumbling-block for beginners trying to learn functional programming. There isn't really a problem that needs solving here.

Another name for this technique is "partial application".

No it is not. For an explanation see http://www.uncarved.com/blog/not_currying.mrk

Re: Can we stop calling it currying?

#19

I don't recall currying -- either the name or the concept -- being a particular stumbling-block for beginners trying to learn functional programming. There isn't really a problem that needs solving here.

Some languages, like ML family or Haskell, make it an organic part of the language, so beginners doesn't need to worry about the concept to use it.

When first exposed to ML/Haskell code, they may use simple mental models such as "you write function arguments without parens and commas" and "the last type in foo -> bar -> baz is the return type". Then it gets replaced with realization that "oh, so 'let f x y = x + y' is just a sugar for 'let f = fun x -> fun y -> x + y'".

If one is learning the concept in a language that supports functions of multiple arguments and uses something else than currying for built-in partial application mechanism, I can imagine them having problems with it. Learning how familiar things works internally is usually easier than learning "this is what you can do and why you may want it".

Post reply on HN