code: function filter(pred) {
    return function(xs) {
      var output = [];
      for (var idx = 0; idx < xs.length; idx += 1) {
        if (pred (xs[idx])) {
          output.push (xs[idx]);
        }
      }
      return output;
    };
  }
docs: # filter :: (a -> Boolean) -> Array a -> Array a . . Returns the list of elements which satisfy the provided predicate. . . ```javascript . > filter (function(n) { return n % 2 === 0; }) ([1, 2, 3, 4, 5]) . [2, 4] . ```