Lambda abstraction

From HaskellWiki
Haskell theoretical foundations

General:
Mathematics - Category theory
Research - Curry/Howard/Lambek

Lambda calculus:
Alpha conversion - Beta reduction
Eta conversion - Lambda abstraction

Other:
Recursion - Combinatory logic
Chaitin's construction - Turing machine
Relational algebra

A lambda abstraction is another name for an anonymous function. It gets its name from the usual notation for writing it: for example, Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \lambda x \to x^2} . (Another common, equivalent notation is: Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \lambda x . \ x^2} .)

In Haskell source code, the Greek letter lambda is replaced by a backslash character ('\') instead, since this is easier to type and requires only the basic 7-bit ASCII character set. Similarly, the arrow is replaced with the ASCII character sequence '->'. So, for example, the lambda abstraction above would be written in Haskell as

  \ x -> x * x

There is actually a whole mathematical theory devoted to expressing computation entirely using lambda abstractions: the lambda calculus. Most functional programming languages (including Haskell) are based upon some extension of this idea.

When a lambda abstraction is applied to a value—for instance, Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle (\lambda x \to x^2 ) \ 7} —the result of the expression is determined by replacing every free occurrence of the parameter variable (in this case Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle x} ) with the parameter value (in this case Failed to parse (SVG (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle 7} ). This is a beta reduction.