Delphi and Freepascal Libraries that implement higher-order functions like Map, Reduce and Filter

Delphi and Freepascal Libraries that implement higher-order functions like Map, Reduce and Filter version 1.1

Authors: Amine Moulay Ramdane

Email: aminer68@gmail.com

Description:

Delphi and Freepascal Libraries that implement higher-order functions like: Map, Reduce and Filter.

Map: This is available in many functional programming languages. This takes as arguments a func function and a list of elements list, and returns a new list with func applied to each element of the list.

Reduce: This is also known as Fold. This requires a combining function, a starting point for a data structure, and possibly some default values to be used under certain conditions. The Reduce function proceeds to combine elements of the data structure using the injected function. This is used to perform operations on a set of values to get only one result (or a smaller set of values) that represents the reduction of that initial data. For example, the values 1, 2, and 3 can be reduced to the single value 6 using the SUM .

Filter: This requires a data structure and a filter condition. This returns all the elements in the structure that match the filter condition.

My Delphi library uses Delphi generics and anonymous methods to implement Map, Reduce and Filter.

My Freepascal library uses Freepascal generics and variants to implement Map, Reduce and Filter.

Please look at the Delphi demo inside the zip file called test_MapReduce.pas .

You can go to download the zip files by clicking on the following web link:

https://drive.google.com/drive/folders/1_BrQDYGaR46_S-sbZKTsAiDlV2Zjlo0x?usp=sharing

Language: Delphi 2009+ and Freepascal 3.02+

Operating Systems: Windows, Mac OSX , Linux, iOS, Android