System.Filter - Manhunter07/MFL GitHub Wiki

Declaration

function Filter(Values: System.Struct, Filter: function): System.Struct = \built-in\

Description

The Filter function in the System package filters an existing structure (array or record). It returns a subset of the input struct.

The second parameter is a function with one parameter. When the function is called, System.Length(Values) iterations are done through the structure and each element/field is passed as argument to Filter. The filter function shall return a boolean value that determines whether or not the value should be added to the function result.

Remarks

  • The result's data type depends on the input and is identical to that of the argument passed as Values parameter.
  • If the length of Values is zero, Mapper is never called and an empty array ([]) or record ({}) is returned.
  • If Filter demands more or less arguments than 1, an exception is raised.

See also