# Lambda abstraction

(Difference between revisions)
 Revision as of 17:23, 3 February 2007 (edit) (Somebody who knows WTF they're talking about should probably look at this...)← Previous diff Current revision (19:54, 13 July 2007) (edit) (undo)m (3 intermediate revisions not shown.) Line 1: Line 1: - A ''lambda abstraction'' is another name for an [[anonymous function]]. It gets its name from the usual notation for writing it - for example, $\lambda x \to x^2$. (Note: some sources write it as $\lambda x . \ x^2$.) + [[Category:Glossary]] + {{Foundations infobox}} + A ''lambda abstraction'' is another name for an [[anonymous function]]. It gets its name from the usual notation for writing it: for example, $\lambda x \to x^2$. (Another common, equivalent notation is: $\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 must more ugly character sequence '->'. So, for example, the lambda abstraction above would be written in Haskell as + 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 Line 7: Line 9: - 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. + 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, $(\lambda x \to x^2 ) \ 7$ - the result of the expression is determined by replacing every occurrence of the parameter variable (in this case $x$) with the parameter value (in this case 7). This is an [[Eta conversion|eta reduction]]. + When a lambda abstraction is applied to a value—for instance, $(\lambda x \to x^2 ) \ 7$—the result of the expression is determined by replacing every [[free variable|free occurrence]] of the parameter variable (in this case $x$) with the parameter value (in this case $7$). This is a [[Beta reduction|beta reduction]].

## Current revision

 Haskell theoretical foundations Lambda calculus:Alpha conversion - Beta reductionEta conversion - Lambda abstraction

A lambda abstraction is another name for an anonymous function. It gets its name from the usual notation for writing it: for example, $\lambda x \to x^2$. (Another common, equivalent notation is: $\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, $(\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 x) with the parameter value (in this case 7). This is a beta reduction.