each = function (a, f) { from_to(0, a.length-1, function (i) {f(a[i]);}); } sum = function (a) { var s = 0; each(a, (e) => s += e); return s; } sum([1,2,3]);
Output