EFUN: filter_array

SYNTAX:
mixed *filter_array( arr, fun[, ob, extra1, extra2, ...] );
  mixed *arr;
  string fun | closure fun;
  object ob;
  mixed extra#;

DESCRIPTION:
This efun passes each of the elements of array 'arr', and any 'extra#' (if
given) as arguments to a function 'fun' in object 'ob'. The function
'fun' must return 1 if the element is to be included in the array to be
returned, or 0 if the elements is to be excluded from that array. If 'ob'
is not given, this_object() is used by default.

RETURN VALUES:
If 'arr' is not an array, then 0 will be returned.
Otherwise an array is returned with those elements of array 'arr',
for which (int)ob->fun( arr[element], extra1, extra2, ... ) returned 1.

SEE ALSO:
map_array
sort_array

EXAMPLE:
int *num_list, *odd_list;

num_list = ({ 0, 1, 2, 3, 4, 5, 6, 7 });
odd_list = filter_array( num_list, "test_odd", this_object() );

int test_odd( int i ) {
  if( i / 2 != ( i + 1 ) / 2 ) return 1;
  return 0;
}
// odd_list is now ({ 1, 3, 5, 7 })
