next up previous contents index
Next: zero Up: Natural Numbers Previous: Natural Numbers   Contents   Index

Explanation of `three apples'

Now it should not be difficult to understand the code that lies behind the expression `(three apples)'. As clumsy as this example may be, it nevertheless should have made clear how numbers are defined in A++, following the idea of Alonzo Church in his Lambda Calculus. Numbers of this kind are called `Church Numerals'.

As interesting as these 'Church Numerals' are, readers might still ask the question `Why bother with them?' if they are not needed later in any practical programming work (Java, C, C++, not even Lisp and Scheme).

From the educational viewpoint these Church Numerals are extremely important however, because they make us very quickly familiar with the core of functional programming: functions have the same status as data,.

This is what people mean, when they use the phrase: functions are first class objects or functions have the status first class.

Following the outlined approach above we can define the following abstractions:


next up previous contents index
Next: zero Up: Natural Numbers Previous: Natural Numbers   Contents   Index
domain access counter Georg P. Loczewski 2004-03-05