Live data from Hacker News

Can we stop calling it currying?

news.ycombinator.com

1–10 of 44 posts

Can we stop calling it currying?

#1
I recently learned what the heck "currying" means. I'm sure I'm not the only one who struggled to grasp what this term means, since its name does not come from an intuitive notion of the concept, but rather it is named after Haskell Curry who first explored this approach.

A curried function allows an incomplete argument list, in which case it returns a new function that is still awaiting the missing arguments. This allows you to compose (combine) functions into new, reusable functions. A powerful tool for programmers, and yet unfortunately we give it a name that often reminds us of curry the food and nothing else.

Can we stop calling it "currying" then and instead call it something meaningful? How about Argument-Deferred Functional Composition, or my preferred shorthand: argument deferral.

Obviously, the name "currying" and "curried function" is widespread, so it would be appropriate to say argument deferral (i.e., currying) or argument-deferred function (i.e., curried function).

Am I right to have a pet peeve about this, or should stop programming and go into marketing?

Re: Can we stop calling it currying?

#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 preferred term of "argument deferral", if only because I can write:

  def curry(f, *curry_args):
      def curried(*args):
          return f(curry_args + args)
      curried.__name__ = "curried_" + f.__name
      return curried
using a one word function name instead of "argument_deferral". (I've also seen 'xapply' in Python code, as in http://bytecodehacks.sourceforge.net/bch-docs/bch/module-byt... ).

It also has the inverse 'uncurry', mentioned in https://downloads.haskell.org/~ghc/6.12.2/docs/html/librarie... .

Your version would be "undefer the argument deferred function", I believe, vs. "uncurry the curried function". Not only is it longer, but I see a possible ambiguity: "undefer" might mean to actually call it.

In general though, there is a lot of specialized vocabulary. "A trampoline is a loop that iteratively invokes thunk-returning functions". "I used an AVL tree in the hidden Markov model." I don't see how the big problem is the inability to understand the concept from lexical decomposition of the term.

Re: Can we stop calling it currying?

#4
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.

Re: Can we stop calling it currying?

#5
Why call them 'arguments' when nobody is arguing?

Currying is the name of the thing. Adding another Enterprise Edition Operational Process Development Pattern like "argument deferral" isn't any better. I mean "Dependency Injection" isn't any easier for beginners to grasp, even though that is what it is.

Besides, it isn't argument deferral. That could easily be confused with evaluation order or things like lazy/normal/strict evaluation.

Re: Can we stop calling it currying?

#8

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".

Re: Can we stop calling it currying?

#10
post #5

Why call them 'arguments' when nobody is arguing? Currying is the name of the thing. Adding another Enterprise Edition Operational Process Development Pattern like "argument deferral" isn't any better. I mean "Dependency Injection" isn't any easier for beginners to grasp, even though that is what it is. Besides, it isn't argument deferral. That could easily be confused with evaluation order or things like lazy/normal…

+1 for "Enterprise Edition Operational Process Development Pattern"
Post reply on HN