Junior — Middle+
Implementation of auto-carry function for task chain
livecode
Task condition
It is necessary to write a function that transforms a regular function into its curried version, allowing it to be called in parts with an arbitrary set of arguments. After implementation, the following demonstration should work:
const taskChain = (task1, task2, task3) => {
console.log(task1, task2, task3);
};
const curriedTaskChain = curry(taskChain);
curriedTaskChain()()()(1, 2, 3);
curriedTaskChain()()()(2)(3);
curriedTaskChain(1, 2, 3);
curriedTaskChain(1)()(2, 3);