Edit in JSFiddle
JavaScript
var s1 = function (f, n) { return n === 1 ? 1 : n + f(f, n - 1); } console.assert(s1(s1, 5) === 15);