Fold (higher-order function)In functional programming, fold (also termed reduce, accumulate, aggregate, compress, or inject) refers to a family of higher-order functions that analyze a recursive data structure and through use of a given combining operation, recombine the results of recursively processing its constituent parts, building up a return value. Typically, a fold is presented with a combining function, a top node of a data structure, and possibly some default values to be used under certain conditions.
Filter (higher-order function)In functional programming, filter is a higher-order function that processes a data structure (usually a list) in some order to produce a new data structure containing exactly those elements of the original data structure for which a given predicate returns the boolean value true. In Haskell, the code example filter even [1..10] evaluates to the list 2, 4, ..., 10 by applying the predicate even to every element of the list of integers 1, 2, ...
Stratégie d'évaluation (informatique)Un langage de programmation utilise une stratégie d'évaluation pour déterminer « quand » évaluer les arguments à l'appel d'une fonction (ou encore, opération, méthode) et « comment » passer les arguments à la fonction. Par exemple, dans l'appel par valeur, les arguments doivent être évalués avant d'être passés à la fonction. La stratégie d'évaluation d'un langage de programmation est spécifiée par la définition du langage même. En pratique, la plupart des langages de programmation (Java, C...
Map (higher-order function)In many programming languages, map is the name of a higher-order function that applies a given function to each element of a collection, e.g. a list or set, returning the results in a collection of the same type. It is often called apply-to-all when considered in functional form. The concept of a map is not limited to lists: it works for sequential containers, tree-like containers, or even abstract containers such as futures and promises. Suppose we have a list of integers [1, 2, 3, 4, 5] and would like to calculate the square of each integer.
Évaluation paresseuseL’évaluation paresseuse (), appelée aussi appel par nécessité ou évaluation retardée est une technique d'implémentation des programmes récursifs pour laquelle l'évaluation d'un paramètre de fonction ne se fait pas avant que les résultats de cette évaluation ne soient réellement nécessaires. Ces résultats, une fois calculés, sont préservés pour des réutilisations ultérieures. Dans un langage comme Haskell, l'évaluation est paresseuse par défaut.