Williammer
6/13/2014 - 8:51 AM

jsPattern.curryExample.js - one simple curry example to partially add parameters, with closure.

jsPattern.curryExample.js - one simple curry example to partially add parameters, with closure.

function add(x, y) {
    if (typeof y === "undefined") { // partial
        return function (y) {
            return x + y;
        };
    }
    // full application
    return x + y;
}