MCPcopy Create free account
hub / github.com/Faheem-Khan97/javascript-coding-problems-with-theory / curry

Function curry

currying.js:48–58  ·  view source on GitHub ↗
(sum)

Source from the content-addressed store, hash-verified

46const sumn = (a,b,c) => a+b+c;
47
48function curry(sum){
49 return function curried(...args){
50 console.log(args)
51 if(sum.length <= args.length){
52 return sum(...args)
53 }
54 return function xy(...args2){
55 return curried(...args, ...args2);
56 }
57 }
58}
59
60const curriedSum = curry(sumn);
61console.log(curriedSum(6,7)(8)) // 21

Callers 1

currying.jsFile · 0.85

Calls 1

sumFunction · 0.70

Tested by

no test coverage detected