Programming Language Theory: Difference between revisions
No edit summary |
|||
| Line 6: | Line 6: | ||
===Untyped λ-calculus=== | ===Untyped λ-calculus=== | ||
Two operators (function ''definition'' and ''application'') upon one operand type (λ-expression). | Two operators (function ''definition'' and ''application'') upon one operand type (λ-expression). | ||
* Function definition: <tt>(λ'' | * Function definition: <tt>(λ''boundparam''. body)</tt> | ||
* Function application: <tt>function(''actualparam'')</tt> | * Function application: <tt>function(''actualparam'')</tt> | ||
The body is made up of ''free'' and ''bound'' variables. Those not present in the λ's list of bound variables are free. A λ-expression with no free variables is ''closed''. | |||
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>n ≡ λf. λx . f<sup>n</sup>x</tt> | * <tt>n ≡ λf. λx . f<sup>n</sup>x</tt> | ||