10.07.2015 Views

An Introduction to Functional Programming Through Lambda Calculus

An Introduction to Functional Programming Through Lambda Calculus

An Introduction to Functional Programming Through Lambda Calculus

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

- 22 -which is then evaluated...Each application evaluates <strong>to</strong> the original application so this application never terminates!We will use a version of this self application function <strong>to</strong> construct recursive functions in chapter 4. Here, we will notethat not all expression evaluations terminate. In fact, as we will see in chapter 8, there is no way of telling whether ornot an expression evaluation will ever terminate!2.8. Function application functionConsider the function:λfunc.λarg.(func arg)This has bound variable:funcand the body expression is another function:λarg.(func arg)which has bound variable:argand a function application:(func arg)as body expression. This in turn has the name:funcas function expression and the name:argas argument expression.When used, the whole function returns a second function which then applys the first function’s argument <strong>to</strong> the secondfunction’s argument. For example, let us use it <strong>to</strong> apply the identity function <strong>to</strong> the self application function:((λfunc.λarg.(func arg) λx.x) λs.(s s))In this example of an application, the function expression is itself an application:(λfunc.λarg.(func arg) λx.x)which must be evaluated first. The bound variable:funcis replaced by the argument:λx.x

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!