Alex Rivera | Logout

What is 'Currying'?

Asked 2008-08-30T20:12:55.867
843

I've seen references to curried functions in several articles and blogs but I can't find a good explanation (or at least one that makes sense!)

Edit
Report

2 Answers

36

A curried function is a function of several arguments rewritten such that it accepts the first argument and returns a function that accepts the second argument and so on. This allows functions of several arguments to have some of their initial arguments partially applied.

answered 2008-10-19T05:35:02.467
4

I found this article, and the article it references, useful, to better understand currying: http://blogs.msdn.com/wesdyer/archive/2007/01/29/currying-and-partial-function-application.aspx

As the others mentioned, it is just a way to have a one parameter function.

This is useful in that you don't have to assume how many parameters will be passed in, so you don't need a 2 parameter, 3 parameter and 4 parameter functions.

answered 2009-08-30T02:19:59.127

Your Answer