JavaScript curry
<p>I`m a newbie at JavaScript trying to understand this tutorial about currying from Oreilly JavaScript Cookbook.</p>

<p>Could someone be kind enough to explain this program in detail step by step in plain language. Please make sure to explain the "null" argument passed in the second last line of the program. Thank you in advance if you can help. </p>

<pre><code>function curry(fn, scope) {
    scope = scope || window;
    var args = [];
    for (var i = 2, len = arguments.length; i &lt; len; ++i) {
        args.push(arguments[i]);
    }
    return function() {
        var args2 = [];
        for (var i = 0; i &lt; arguments.length; i++) {
            args2.push(arguments[i]);
        }
        var argstotal = args.concat(args2);
        return fn.apply(scope, argstotal);
    };
}

function diffPoint(x1, y1, x2, y2) {
    return [Math.abs(x2 - x1), Math.abs(y2 - y1)];
}

var diffOrigin = curry(diffPoint, null, 3.0, 4.0);
var newPt = diffOrigin(6.42, 8.0); //produces array with 3
</code></pre>
