We're a place where coders share, stay up-to-date and grow their careers.

Thought I'd give this a try using plain lambda calculus. The notation is:

λx.t

λx.(λy.t)

λx y.t

MN

MNO

(MN)O

0 = λf x.x succ = λn f x. f (n f x) add = λm n f x. m f (n f x) mul = λm n f x. m (n f) x alg = λn i s. add n (mul i s)

Example 1:

2 = succ (succ 0) 5 = succ (add 2 2) 10 = add 5 5 alg 2 5 10 --> λf x.f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f x)))))))))))))))))))))))))))))))))))))))))))))))))))

Thought I'd give this a try using plain lambda calculus. The notation is:

`λx.t`

= Function taking x as an argument and producing the expression t. Can simplify`λx.(λy.t)`

->`λx y.t`

`MN`

= Apply N to M`MNO`

=`(MN)O`

Example 1: