The lambda operator creates an anonymous function.
λx•x×x
Apply a function to its argument by setting them next to each other.
(λx•x×x)2
Rules:
LambdaExpression
→
variable|(MN)|(λvariable•M)
M
→
LambdaExpression
N
→
LambdaExpression
Bound and free: Bound variables are parameters; free are what's left.
Substitution M[x←N].
Generally, just substitute N for all
free occurrences of x in M.
First, though, if N's un-bound variables are bound in M
(this is, if they are used as parameters), rename them to remove
conflicts, so the substitution leaves the free variables of
N free. (Obviously, parameter names are indifferent.)
(zx)[x←y]=(zy)
(zx)[z←(λz•x+z)]=((λz•x+z)x)
(λx•x×x)[x←(λz•x+z)]=(λx•x×x)
((λx•M)N)⇒M[x←N]
Values are always functions, since there's nothing else.
Applied lamdba calculus adds number and such.
Lisp
Lisp variations langauges approximate an applied lamda calculus.
Notice that define is really a kind of assignment. No one has
figured out how to dispense with the impurity.