Currying != Generalized Partial Application?!

I had mistakenly learned that curry was a form of generalized partial application from the paper : Function Currying in Scheme by Jeffrey A. Meunier
and the Wikipedia entry (I should have known better), however I was mildly reprimanded for making this novice mistake in a recent paper submission to ICFP. There was a short post to the Scheme mailing list some time back summing up the problem.

In my paper I defined curry in Cat as:

  define curry : ('b ('A 'b -> 'C) -> ('A -> 'C)) { swap quote swap compose }

Whereas this really should have been called "partial-apply", "papply" or something comparable.
So the correct definition should have been:

  define papply : ('b ('A 'b -> 'C) -> ('A -> 'C)) { swap quote swap compose }
  define curry : (('A 'b -> 'C) -> ('b -> ('A -> 'C)) { quote [papply] compose } 

Has anyone else made this mistake? It seems to me that I have seen more incorrect definitions than correct ones.

P.S. Anyone here interested in the health of Wikipedia (I've given up), I'd suggest fixing the code examples and "intuitively ..." note.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Not guilty, your honour.

But I am guilty of occasionally calling partial application by the name "partial evaluation", and I think I'm not the only one.


Sometimes when people say "partial evaluation" in the context of partial application, they really mean "staging".

What's the difference?

I'm guessing that by 'staging' you mean partial evaluation performed during compilation. But I'm suddenly having doubts.

Currying v. partial application

Currying is easy to define. Currying is turning a function of type (A,B) -> C into A -> (B -> C). That is what currying should always mean.

Partial application is slightly more fuzzy. The intuitive notion is applying a function to less values than arguments of the function, but then you could say all functions take one argument, so...

Partial application and currying are closely related, and one unambiguous way to define partial application is to say, f x is a partial application iff curry (uncurry f) x == f x. This would distinguish between "incompletely applying" a function and a function that returns a function after doing some work. Usually, we don't really care to make that distinction, and essentially any function that returns a function can be considered to be partially applied when used.

If I have a function

If I have a function f:(x,y)->z, I can't apply it to only one of its arguments. I can curry it, turning it into a function g:x->(y->z) ... and I can apply g to only one of the original arguments. But turning f into g and applying g to some x are technically different things.

I suspect the confusion arises because originally currying was a technique to model multiple-argument functions in a single-argument framework and was a meta-operation. In ML-like languages, the functions are typically already curried, so the only operation you see being done is partial application.


seems like a common confusion

The curry() function in Maple takes a procedure and a list of arguments and returns a new procedure that takes the rest of the arguments. To me thats not currying, thats partial application.

The funny thing is that the Maple help page for curry() states that the definition of "currying" is derived from the Haskell 98 report. However, the type of the curry function in the standard prelude is what you would expect, ((a, b) -> c) -> a -> b -> c, which is totally different from the Maple curry.

Digging deeper I see that section 3.3 of the report is titled "Curried Applications and Lambda Abstractions" but it talks about partial applications. Is a "curried application" the same as a partial application?

Curried Application

While that is the title of the section, the term "curried application" is used nowhere else in the page; "partial application" is used. Looking at other documents, it does look like "curried application" = "partial application". At any rate, it still doesn't sound anything like "currying".

Curried vs. partial application

Partial application is a kind of curried application, according to Denotational Versus Declarative Semantics For Functional Programming (pg. 4):

A curried application of a constructor or function symbol is called partial, exact, or exceeding according to the case that the number m of arguments is less than, equal to or greater than the symbol's rank.

is it correct

As far as currying is considere there doesn't seem to be much confusion. e.g. x->y->z is x->(y->z). The application starts with first left most argument. Is partial application meant to be intent that only a subset of the arguments are provided a value and the function which will accept the remaining values is returned as a result.
e.g. let there be a function such as a->b->c->d->e
It can be used using partial application and automatic definitions provided by compiler like entity as follows
This can work if any subset of arguments could be provided their values in a partial application.

In conclusion currying is a special case of partial application and hence can be termed so.