Higher-order function: Difference between revisions

Content deleted Content added
Revert edit of definition. If it were sufficient for a function to return a value to be a HOF, then f(x)=x would be a HOF. After this revert, the map function will still satisfy the definition because of condition 1.
C8uyPqgR (talk | contribs)
No edit summary
 
(2 intermediate revisions by one other user not shown)
Line 7:
 
==General examples==
* <code>[[map (higher-order function)|map]]</code> function, found in many functional programming languages, is one example of a higher-order function. It takes as arguments as a function ''f'' and a collection of elements, and as the result, returns a new collection with ''f'' applied to each element from the collection.
* Sorting functions, which take a comparison function as a parameter, allowing the programmer to separate the sorting algorithm from the comparisons of the items being sorted. The [[C (programming language)|C]] standard [[function (computer science)|function]] <code>qsort</code> is an example of this.
* [[Filter (higher-order function) | filter]]
* [[fold (higher-order function)|fold]]
* [[Prefix sum|scan]]
* [[apply]]
* [[Function composition (computer science)|Function composition]]