System.Map - Manhunter07/MFL GitHub Wiki
Declaration
function Map(Values: System.Struct, Mapper: function): System.Struct = \built-in\
Description
The Map function in the System package maps an existing structure (array or record) to a new structure.
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 Mapper. The mapper function shall return a value that replaces the individual element or field for the function result.
Remarks
- The result's data type depends on the input and is identical to that of the argument passed as
Valuesparameter. - If the length of
Valuesis zero,Mapperis never called and an empty array ([]) or record ({}) is returned. - If
Creeperdemands more or less arguments than1, an exception is raised.