Added to Favorites

Related Searches

Definitions

Nearby Words

In mathematics and computer science, higher-order functions or functionals are functions which do at least one of the following:## Example

This Python script contains the higher-order function g() which takes a function as its first argument and returns a number. This example prints 100 (= (7+3)×(7+3) ).

- take one or more functions as an input
- output a function.

In mathematics these are also known as operators or functionals. The derivative in calculus is a common example, since it maps a function to another function.

In the untyped lambda calculus, all functions are higher-order; in a typed lambda calculus, from which most functional programming languages are derived, higher-order functions are generally those with types containing more than one arrow. In functional programming, higher-order functions that return other functions are said to be curried.

The `map`

function found in many functional programming languages is one example of a higher-order function. It takes as arguments a function f and a list of elements, and as result, returns a new list with f applied to each element from the list. Another very common kind of higher-order function in those languages which support them are 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 standard function, `qsort`

, is an example of this.

Other examples of higher-order functions include fold, function composition, integration, and the constant-function function λx.λy.x.

Wikipedia, the free encyclopedia © 2001-2006 Wikipedia contributors (Disclaimer)

This article is licensed under the GNU Free Documentation License.

Last updated on Wednesday August 27, 2008 at 11:42:21 PDT (GMT -0700)

View this article at Wikipedia.org - Edit this article at Wikipedia.org - Donate to the Wikimedia Foundation

This article is licensed under the GNU Free Documentation License.

Last updated on Wednesday August 27, 2008 at 11:42:21 PDT (GMT -0700)

View this article at Wikipedia.org - Edit this article at Wikipedia.org - Donate to the Wikimedia Foundation

Copyright © 2015 Dictionary.com, LLC. All rights reserved.