JSFiddle - React, Tailwind, and code Playground
by ciju
JavaScript
var sum = function (f) {
return function (n) {
return n === 1 ? 1 : n + f(n - 1);
};
};
var s4 = function (h) {
return sum(function (n) {
return h(h)(n);
});
};
console.assert(s4(s4)(5) === 15);