Live data from Hacker News

Can we stop calling it currying?

news.ycombinator.com

21–30 of 44 posts

Re: Can we stop calling it currying?

#22
post #20

That's why Clojure calls it "partial" to indicate you're doing partial application http://conj.io/store/v0/org.clojure/clojure/1.7.0-alpha4/clj...

Was posting to suggest exactly that, it's also what Python calls it (https://docs.python.org/2/library/functools.html#functools.p...), and a "partially evaluted / filled out" function basically encapsulated the whole concept.

Re: Can we stop calling it currying?

#23

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.

Actually it is the lack of currying that is a stumbling block when you go back to a language that doesn't have it.

Re: Can we stop calling it currying?

#24
Completely agree. It is atypical in any progamming language to have names of functions/operators that do not bear some relation with the nature of the function/operation.

While your suggestion suffers from a lack of concision, the point remains: A single word replacement that approximates the nature of what "currying" does, would be helpful.

Re: Can we stop calling it currying?

#25
post #3

I've read any number of peeves against certain forms of language use, and don't agree that that necessarily pigeonholes someone into marketing. Lisp, for example, uses 'car' and 'cdr' because of the hardware registers of the IBM 704. Some prefer 'first' and 'rest', but compact composed versions like '(cadr x)' for (car (cdr x)) don't exist for those English variants. "to curry" as a verb has advantages over your pref…

'To curry' also already was a verb, and as a bonus, that verb has the connotation of 'adding something'. To curry a function, you add a value for its first argument. That helped it become popular. I don't think this would have survived if it would have been called 'to Knuth', 'to Kernighan', or 'to Jensen' (in general, names for stuff one adds in moderation to something larger to improve it give good names for small things one adds to something larger: 'salt' in cryptography and 'syntactic sugar' are other examples)

"Some prefer 'first' and 'rest', but compact composed versions like '(cadr x)' for (car (cdr x)) don't exist for those English variants."

It may be lack in my mastery of English, but AFAIK, 'cadr' didn't exist, either, but that didn't stop it from becoming the standard way to describe the second item in a list.

If they had used first and rest, we likely would have frest and frrest for cadr and caadr, and I wouldn't rule out 'rfirst' either; it is not as if that is harder to pronounce than 'cdar'.

Re: Can we stop calling it currying?

#26
Thanks everyone for the comments. It is interesting to see how widely "currying" is conflated with "partial application". I have to say, I still find the name to be a stumbling block. Perhaps this discussion can help to reverse that trend.

I have also learned a good deal more from these comments and further research. It seems my idea of "currying" was not entirely complete. Per the comment herein: "Currying turns polyadic function into a sequence of unary functions". Practically speaking, this means a curried function is a single-input function that will return a function which is still awaiting an argument, so that other functions can be added to the "currying chain".

I would call this "function sequencing". This term could be equally intuitive for functional languages (ML / Haskell) and non-functional languages alike. However, I think that non-functional language users will still appreciate an explanation that references "argument deferral", since this is one of the practical benefits, and is also the key part of the "functional" context-switch needed to understand the concept (i.e., you can compose functions without providing the arguments/inputs).

Is there an equivalent to "uncurrying"? (un-what-ing??) This verbiage sounds like we're trying to unpluck a chicken. On Wikipedia (the world's collective brain dump), we understand uncurrying to be "the dual transformation to currying, and can be seen as a form of defunctionalization." Crystal. I'll losely interpret this as flattening the unary (single-input) function sequence into one polyadic (multi-input) function. So can we refer to this as "function bundling"?

To summarize, I'm submitting "sequencing" and "bundling" as the two simple verbs that better describe "currying" and "uncurrying".

Re: Can we stop calling it currying?

#27

Completely agree. It is atypical in any progamming language to have names of functions/operators that do not bear some relation with the nature of the function/operation. While your suggestion suffers from a lack of concision, the point remains: A single word replacement that approximates the nature of what "currying" does, would be helpful.

See my longer comment. I'm suggesting "sequencing" and the opposite, "bundling".

Re: Can we stop calling it currying?

#28

Thanks everyone for the comments. It is interesting to see how widely "currying" is conflated with "partial application". I have to say, I still find the name to be a stumbling block. Perhaps this discussion can help to reverse that trend. I have also learned a good deal more from these comments and further research. It seems my idea of "currying" was not entirely complete. Per the comment herein: "Currying turns pol…

As a related extension, though I don't think "partial application" is a bad term, I can also think of it as "presetting arguments", so there you go, my last submission is to call this "presetting".

Re: Can we stop calling it currying?

#29
post #25
post #3

I've read any number of peeves against certain forms of language use, and don't agree that that necessarily pigeonholes someone into marketing. Lisp, for example, uses 'car' and 'cdr' because of the hardware registers of the IBM 704. Some prefer 'first' and 'rest', but compact composed versions like '(cadr x)' for (car (cdr x)) don't exist for those English variants. "to curry" as a verb has advantages over your pref…

'To curry' also already was a verb, and as a bonus, that verb has the connotation of 'adding something'. To curry a function, you add a value for its first argument. That helped it become popular. I don't think this would have survived if it would have been called 'to Knuth', 'to Kernighan', or 'to Jensen' (in general, names for stuff one adds in moderation to something larger to improve it give good names for small…

Your description refers to "partial application", which is different from currying. I think that many people are comfortable with "currying" only because they think it's the same as partial application. The fact that this is incorrect is good reason to revisit the term.

Re: Can we stop calling it currying?

#30

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.

Thanks for this clarification. The fact that these are widely confounded is evidence that many people are comfortable with the term "currying" only because they think it's the same as "partial application", so they appreciate the connotation that you're "adding spice".

So in this case, not only CAN these people stop calling it "currying", but in fact they should, because it's the wrong word.

In my other comment I'm suggesting calling currying "sequencing", and partial application "presetting".

Post reply on HN