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!)
I’ve seen references to curried functions in several articles and blogs but I can’t
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Currying is when you break down a function that takes multiple arguments into a series of functions that each take only one argument. Here’s an example in JavaScript:
This is a function that takes two arguments, a and b, and returns their sum. We will now curry this function:
This is a function that takes one argument,
a, and returns a function that takes another argument,b, and that function returns their sum.add(3, 4)statement.add3that will add 3 to its argument. (This is what some may call a closure.)add3operation to add 3 to 4, again producing 7 as a result.