Difference between revisions of "Beta reduction"

From HaskellWiki
Jump to navigation Jump to search
(2 cents on wording / links.)
(I think my example actually included an eta-reduction as well as a beta conversion. Edited example.)
Line 3: Line 3:
 
For example, suppose we have
 
For example, suppose we have
 
<haskell>
 
<haskell>
(\x y -> 2*x*x + y) 7
+
2*x*x + y
 
</haskell>
 
</haskell>
 
If we now replace every occurance of <hask>x</hask> with 7, we arrive at
 
If we now replace every occurance of <hask>x</hask> with 7, we arrive at
 
<haskell>
 
<haskell>
\y -> 2*7*7 + y
+
2*7*7 + y
 
</haskell>
 
</haskell>
 
We have thus performed a ''beta reduction''.
 
We have thus performed a ''beta reduction''.
 
[[Category:Glossary]]
 
   
 
Also see [[Lambda calculus]] and the [http://en.wikipedia.org/wiki/Lambda_calculus wikipedia lambda calculus article].
 
Also see [[Lambda calculus]] and the [http://en.wikipedia.org/wiki/Lambda_calculus wikipedia lambda calculus article].
  +
 
[[Category:Glossary]]

Revision as of 12:55, 30 January 2007

A beta reduction (also written β reduction) is where you actually apply a lambda function to an expression to generate a result.

For example, suppose we have

2*x*x + y

If we now replace every occurance of x with 7, we arrive at

2*7*7 + y

We have thus performed a beta reduction.

Also see Lambda calculus and the wikipedia lambda calculus article.