January 2020
Intermediate to advanced
470 pages
11h 13m
English
As with partial application, there's a solution that works with closures. Since we have gone over many of the required details, let's jump directly into the code:
const partialCurryByClosure = fn => { const curryize = (...args1) => (...args2) => { const allParams = [...args1, ...args2]; return (allParams.length < func.length ? curryize : fn)( ...allParams ); }; return curryize();};
If you compare partialCurryByClosure() and partialByClosure(), the main difference is that with partial currying, since we are always providing arguments from the left, and there is no way to skip some, you concatenate whatever arguments you had with the new ones, and check whether you got enough. If the new list of arguments has ...
Read now
Unlock full access