This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** pe | |
* @argument f: the multiple-argument function to turn into a partially-evaluatable | |
* @returns : A single-argument function that applies its argument as the first argument of f, and returns the partially-evaluated function | |
* @exemple: pe((a,b)=>a+b)(9)(1) === 10 | |
*/ | |
function pe(f, context, args) { | |
if(!args) args = []; | |
if (args.length === f.length) return f.apply(context, args); | |
return function partial (a) { | |
var args_copy = args.concat.apply(args, arguments); |