filter = function (a, f) { var result = []; each (a, (e) => {if (f(e)) result.push(e)}); return result; } pos = (e) => e >= 0; filter([1,-2,3], pos);
Output