VTLUUG:2016-03-24: Difference between revisions
imported>Echarlie |
imported>Echarlie |
||
| Line 47: | Line 47: | ||
=== Beta reduction === | === Beta reduction === | ||
Meat of Lambda calculus. | Meat of Lambda calculus. | ||
=== Currying === | |||
Allows for nested functions. Functions manipulate each input individually | |||
===Examples=== | ===Examples=== | ||
<pre> | <pre> | ||
Currying example: | |||
(ƛx.x)2 | (ƛx.x)2 x is bound (ƛabc.cba)zz(ƛwv.w) | ||
(ƛ[x:= | (ƛ[x:=2]) to 2 (ƛa.(ƛb.(ƛc.cba)))(z)z(ƛw.(ƛv.w))) The first function | ||
2 | 2 Only applies the first z | ||
(ƛz.zz)(ƛy.yy) | (ƛz.zz)(ƛy.yy) | ||
(ƛ[z:=( | (ƛ[z:=(ƛy.yy)].zz) | ||
Currying example: | |||
(ƛabc.cba)zz(ƛwv.w) | |||
(ƛa.(ƛb.(ƛc.cba)))(z)z(ƛw.(ƛv.w))) The first function only applies the first z | |||
(ƛb.(ƛc.cbz))z(ƛw.(ƛv.w)) applies from the outer parenths in | |||
(ƛc.czz)(ƛw.(ƛv.w)) so c is applied last | |||
(ƛw.(ƛv.w))zz | |||
(ƛv.z)z | |||
z | |||
</pre> | </pre> | ||