fu-lambda-tutorial - A Tutorial Introduction to the Lambda...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: A Tutorial Introduction to the Lambda Calculus Raul Rojas * FU Berlin, WS-97/98 Abstract This paper is a short and painless introduction to the calculus. Originally developed in order to study some mathematical properties of effectively com- putable functions, this formalism has provided a strong theoretical foundation for the family of functional programming languages. We show how to perform some arithmetical computations using the calculus and how to define recur- sive functions, even though functions in calculus are not given names and thus cannot refer explicitly to themselves. 1 Definition The calculus can be called the smallest universal programming language of the world . The calculus consists of a single transformation rule (variable substitution) and a single function definition scheme. It was introduced in the 1930s by Alonzo Church as a way of formalizing the concept of effective computability. The calculus is universal in the sense that any computable function can be expressed and evaluated using this formalism. It is thus equivalent to Turing machines. However, the calculus emphasizes the use of transformation rules and does not care about the actual machine implementing them. It is an approach more related to software than to hardware. The central concept in calculus is the expression. A name, also called a variable, is an identifier which, for our purposes, can be any of the letters a,b,c,... An expression is defined recursively as follows: < expression > := < name > | < function > | < application > < function > := < name > . < expression > < application > := < expression >< expression > An expression can be surrounded with parenthesis for clarity, that is, if E is an expression, ( E ) is the same expression. The only keywords used in the language are and the dot. In order to avoid cluttering expressions with parenthesis, we adopt the convention that function application associates from the left, that is, the expression E 1 E 2 E 3 ...E n * Send corrections or suggestions to rojas@inf.fu-berlin.de 1 is evaluated applying the expressions as follows: ( ... (( E 1 E 2 ) E 3 ) ...E n ) As can be seen from the definition of expressions given above, a single identifier is a expression. An example of a function is the following: x.x This expression defines the identity function. The name after the is the identifier of the argument of this function. The expression after the point (in this case a single x ) is called the body of the definition. Functions can be applied to expressions. An example of an application is ( x.x ) y This is the identity function applied to y . Parenthesis are used for clarity in order to avoid ambiguity. Function applications are evaluated by substituting the value of the argument x (in this case y ) in the body of the function definition, i.e....
View Full Document

This note was uploaded on 10/03/2011 for the course CSC 544 taught by Professor Staff during the Spring '11 term at Rhode Island.

Page1 / 9

fu-lambda-tutorial - A Tutorial Introduction to the Lambda...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online