The Stack Overflow podcast is back! Listen to an interview with our new CEO.

 Post Undeleted by zzzzBov occurred Mar 18 '13 at 16:26 3 added 162 characters in body edited Mar 18 '13 at 16:26 zzzzBov 5,27511 gold badge2323 silver badges2626 bronze badges I feel that Jon Resig's `curry` function is misnamed, and is actually a form of partial application. Currying and partial function application are often conflated.[10] The difference between the two is clearest for functions taking more than two arguments. Given a function of type `f:(X × Y × Z)→N`, currying produces `curry(f): X→(Y→(Z→N)))`. That is, while an evaluation of the first function might be represented as `f(1, 2, 3)`, evaluation of the curried function would be represented as `fcurried(1)(2)(3)`, applying each argument in turn to a single-argument function returned by the previous invocation. Note that after calling `fcurried(1)`, we are left with a function that takes a single argument and returns another function, not a function that takes two arguments. I'm going to break here because that last line is really important. Jon Resig's version of `curry` produces a function that takes two arguments, which means that it is not actually a currying function. In contrast, partial function applicationpartial function application refers to the process of fixing a number of arguments to a function, producing another function of smaller arity. Given the definition of above, we might fix (or 'bind') the first argument, producing a function of type `partial(f): (Y×Z)→N`. Evaluation of this function might be represented as `fpartial(2,3)`. Note that the result of partial function application in this case is a function that takes two arguments. Intuitively, partial function application says "if you fix the first arguments of the function, you get a function of the remaining arguments". For example, if function div`div` stands for the division operation x/y`x/y`, then div`div` with the parameter x`x` fixed at 1 (i.e., div 1`div 1`) is another function: the same as the function inv`inv` that returns the multiplicative inverse of its argument, defined by inv(y) = 1/y`inv(y) = 1/y`. The practical motivation for partial application is that very often the functions obtained by supplying some but not all of the arguments to a function are useful; for example, many languages have a function or operator similar to plus_one`plus_one`. Partial application makes it easy to define these functions, for example by creating a function that represents the addition operator with 1 bound as its first argument. I feel that Jon Resig's `curry` function is misnamed, and is actually a form of partial application. Currying and partial function application are often conflated.[10] The difference between the two is clearest for functions taking more than two arguments. Given a function of type `f:(X × Y × Z)→N`, currying produces `curry(f): X→(Y→(Z→N)))`. That is, while an evaluation of the first function might be represented as `f(1, 2, 3)`, evaluation of the curried function would be represented as `fcurried(1)(2)(3)`, applying each argument in turn to a single-argument function returned by the previous invocation. Note that after calling `fcurried(1)`, we are left with a function that takes a single argument and returns another function, not a function that takes two arguments. I'm going to break here because that last line is really important. Jon Resig's version of `curry` produces a function that takes two arguments In contrast, partial function application refers to the process of fixing a number of arguments to a function, producing another function of smaller arity. Given the definition of above, we might fix (or 'bind') the first argument, producing a function of type . Evaluation of this function might be represented as . Note that the result of partial function application in this case is a function that takes two arguments. Intuitively, partial function application says "if you fix the first arguments of the function, you get a function of the remaining arguments". For example, if function div stands for the division operation x/y, then div with the parameter x fixed at 1 (i.e., div 1) is another function: the same as the function inv that returns the multiplicative inverse of its argument, defined by inv(y) = 1/y. The practical motivation for partial application is that very often the functions obtained by supplying some but not all of the arguments to a function are useful; for example, many languages have a function or operator similar to plus_one. Partial application makes it easy to define these functions, for example by creating a function that represents the addition operator with 1 bound as its first argument. I feel that Jon Resig's `curry` function is misnamed, and is actually a form of partial application. Currying and partial function application are often conflated.[10] The difference between the two is clearest for functions taking more than two arguments. Given a function of type `f:(X × Y × Z)→N`, currying produces `curry(f): X→(Y→(Z→N)))`. That is, while an evaluation of the first function might be represented as `f(1, 2, 3)`, evaluation of the curried function would be represented as `fcurried(1)(2)(3)`, applying each argument in turn to a single-argument function returned by the previous invocation. Note that after calling `fcurried(1)`, we are left with a function that takes a single argument and returns another function, not a function that takes two arguments. I'm going to break here because that last line is really important. Jon Resig's version of `curry` produces a function that takes two arguments, which means that it is not actually a currying function. In contrast, partial function application refers to the process of fixing a number of arguments to a function, producing another function of smaller arity. Given the definition of above, we might fix (or 'bind') the first argument, producing a function of type `partial(f): (Y×Z)→N`. Evaluation of this function might be represented as `fpartial(2,3)`. Note that the result of partial function application in this case is a function that takes two arguments. Intuitively, partial function application says "if you fix the first arguments of the function, you get a function of the remaining arguments". For example, if function `div` stands for the division operation `x/y`, then `div` with the parameter `x` fixed at 1 (i.e., `div 1`) is another function: the same as the function `inv` that returns the multiplicative inverse of its argument, defined by `inv(y) = 1/y`. The practical motivation for partial application is that very often the functions obtained by supplying some but not all of the arguments to a function are useful; for example, many languages have a function or operator similar to `plus_one`. Partial application makes it easy to define these functions, for example by creating a function that represents the addition operator with 1 bound as its first argument. 2 added 283 characters in body edited Mar 18 '13 at 14:10 zzzzBov 5,27511 gold badge2323 silver badges2626 bronze badges I feel that Jon Resig's `curry` function is misnamed, and is actually a form of partial application. Currying and partial function application are often conflated.[10] The difference between the two is clearest for functions taking more than two arguments. Given a function of type `f:(X × Y × Z)→N`, currying produces `curry(f): X→(Y→(Z→N)))`. That is, while an evaluation of the first function might be represented as `f(1, 2, 3)`, evaluation of the curried function would be represented as `fcurried(1)(2)(3)`, applying each argument in turn to a single-argument function returned by the previous invocation. Note that after calling `fcurried(1)`, we are left with a function that takes a single argument and returns another function, not a function that takes two arguments.   I'm going to break here because that last line is really important. Jon Resig's version of `curry` produces a function that takes two arguments In contrast, partial function application refers to the process of fixing a number of arguments to a function, producing another function of smaller arity. Given the definition of above, we might fix (or 'bind') the first argument, producing a function of type . Evaluation of this function might be represented as . Note that the result of partial function application in this case is a function that takes two arguments. Intuitively, partial function application says "if you fix the first arguments of the function, you get a function of the remaining arguments". For example, if function div stands for the division operation x/y, then div with the parameter x fixed at 1 (i.e., div 1) is another function: the same as the function inv that returns the multiplicative inverse of its argument, defined by inv(y) = 1/y. The practical motivation for partial application is that very often the functions obtained by supplying some but not all of the arguments to a function are useful; for example, many languages have a function or operator similar to plus_one. Partial application makes it easy to define these functions, for example by creating a function that represents the addition operator with 1 bound as its first argument. I feel that Jon Resig's `curry` function is misnamed, and is actually a form of partial application. Currying and partial function application are often conflated.[10] The difference between the two is clearest for functions taking more than two arguments. Given a function of type `f:(X × Y × Z)→N`, currying produces . That is, while an evaluation of the first function might be represented as , evaluation of the curried function would be represented as , applying each argument in turn to a single-argument function returned by the previous invocation. Note that after calling , we are left with a function that takes a single argument and returns another function, not a function that takes two arguments.   In contrast, partial function application refers to the process of fixing a number of arguments to a function, producing another function of smaller arity. Given the definition of above, we might fix (or 'bind') the first argument, producing a function of type . Evaluation of this function might be represented as . Note that the result of partial function application in this case is a function that takes two arguments. Intuitively, partial function application says "if you fix the first arguments of the function, you get a function of the remaining arguments". For example, if function div stands for the division operation x/y, then div with the parameter x fixed at 1 (i.e., div 1) is another function: the same as the function inv that returns the multiplicative inverse of its argument, defined by inv(y) = 1/y. The practical motivation for partial application is that very often the functions obtained by supplying some but not all of the arguments to a function are useful; for example, many languages have a function or operator similar to plus_one. Partial application makes it easy to define these functions, for example by creating a function that represents the addition operator with 1 bound as its first argument. I feel that Jon Resig's `curry` function is misnamed, and is actually a form of partial application. Currying and partial function application are often conflated.[10] The difference between the two is clearest for functions taking more than two arguments. Given a function of type `f:(X × Y × Z)→N`, currying produces `curry(f): X→(Y→(Z→N)))`. That is, while an evaluation of the first function might be represented as `f(1, 2, 3)`, evaluation of the curried function would be represented as `fcurried(1)(2)(3)`, applying each argument in turn to a single-argument function returned by the previous invocation. Note that after calling `fcurried(1)`, we are left with a function that takes a single argument and returns another function, not a function that takes two arguments. I'm going to break here because that last line is really important. Jon Resig's version of `curry` produces a function that takes two arguments In contrast, partial function application refers to the process of fixing a number of arguments to a function, producing another function of smaller arity. Given the definition of above, we might fix (or 'bind') the first argument, producing a function of type . Evaluation of this function might be represented as . Note that the result of partial function application in this case is a function that takes two arguments. Intuitively, partial function application says "if you fix the first arguments of the function, you get a function of the remaining arguments". For example, if function div stands for the division operation x/y, then div with the parameter x fixed at 1 (i.e., div 1) is another function: the same as the function inv that returns the multiplicative inverse of its argument, defined by inv(y) = 1/y. The practical motivation for partial application is that very often the functions obtained by supplying some but not all of the arguments to a function are useful; for example, many languages have a function or operator similar to plus_one. Partial application makes it easy to define these functions, for example by creating a function that represents the addition operator with 1 bound as its first argument. Post Deleted by zzzzBov occurred Mar 18 '13 at 14:00 1 answered Mar 18 '13 at 14:00 zzzzBov 5,27511 gold badge2323 silver badges2626 bronze badges I feel that Jon Resig's `curry` function is misnamed, and is actually a form of partial application. Currying and partial function application are often conflated.[10] The difference between the two is clearest for functions taking more than two arguments. Given a function of type `f:(X × Y × Z)→N`, currying produces . That is, while an evaluation of the first function might be represented as , evaluation of the curried function would be represented as , applying each argument in turn to a single-argument function returned by the previous invocation. Note that after calling , we are left with a function that takes a single argument and returns another function, not a function that takes two arguments. In contrast, partial function application refers to the process of fixing a number of arguments to a function, producing another function of smaller arity. Given the definition of above, we might fix (or 'bind') the first argument, producing a function of type . Evaluation of this function might be represented as . Note that the result of partial function application in this case is a function that takes two arguments. Intuitively, partial function application says "if you fix the first arguments of the function, you get a function of the remaining arguments". For example, if function div stands for the division operation x/y, then div with the parameter x fixed at 1 (i.e., div 1) is another function: the same as the function inv that returns the multiplicative inverse of its argument, defined by inv(y) = 1/y. The practical motivation for partial application is that very often the functions obtained by supplying some but not all of the arguments to a function are useful; for example, many languages have a function or operator similar to plus_one. Partial application makes it easy to define these functions, for example by creating a function that represents the addition operator with 1 bound as its first argument.