EFUN: filter_mapping

SYNTAX:
mapping filter_mapping( map, fun[, ob, extra1, extra2, ...] );
  mapping map;
  string fun | closure fun;
  object ob;
  mixed extra#;

DESCRIPTION:
This efun passes each of the indices of mapping 'map', 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 mapping to be
returned, or 0 if the elements is to be excluded from that mapping. If 'ob'
is not given, this_object() is used by default.

RETURN VALUES:
If 'map' is not an array, then 0 will be returned.
Otherwise a mapping is returned with those index:value pairs of mapping
'map', for which (int)ob->fun( index, extra1, extra2, ... ) returned 1.

SEE ALSO:
map_mapping
mappingp
filter_array

EXAMPLE:
mapping map, odd_map;

map = ([ "a":1, "b":2, "c":3, "d":4, "e":5, "f":6 ]);
odd_map = filter_mapping( map, "test_odd", this_object() );

int test_odd( string str ) {
  if( map[str] / 2 != ( map[str] + 1 ) / 2 ) return 1;
  return 0;
}
// odd_map is now ([ "a":1, "c":3, "e":5 ])
