Hacker News new | ask | show | jobs
by AmbientLion 4105 days ago
Another name for currying is "partial application". See http://en.m.wikipedia.org/wiki/Partial_application
2 comments

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.

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