Programming Language Theory: Difference between revisions

No edit summary
No edit summary
Line 11: Line 11:


The integers (or any countably infinite set) can be represented via the [http://en.wikipedia.org/wiki/Church_encoding Church encoding]:
The integers (or any countably infinite set) can be represented via the [http://en.wikipedia.org/wiki/Church_encoding Church encoding]:
* <tt>0 ≡ λfx. x</tt>
* <tt>1 ≡ λfx. f x</tt>
* <tt>n ≡ λf. λx . f<sup>n</sup>x</tt>
* <tt>n ≡ λf. λx . f<sup>n</sup>x</tt>
* <tt>plus ≡ λm. λn. λf. λx. m f (n f x)</tt> (from ''f<sup>(m + n)</sup>(x) = f<sup>m</sup>(f<sup>n</sup>(x))'')
* <tt>plus ≡ λm. λn. λf. λx. m f (n f x)</tt> (from ''f<sup>(m + n)</sup>(x) = f<sup>m</sup>(f<sup>n</sup>(x))'')