Next: Explanation of three apples' Up: Numeric Abstractions Previous: Numeric Abstractions   Contents   Start

## Natural Numbers

The basic abstractions in the previous section introduced the selectors true and false as logical constants. Their practical usefulness is very limited if they can be generated only by a more or less complex synthesis of themselves using the basic abstractions.

In practical life truth values are also generated by relational expressions, i.e. by operations comparing numbers or other types of data with one another. This leads us to introduce abstractions defining numbers in A++.

People familiar with computers are very often inclined to look at numbers as mere bit patterns reducing them to a well-structured but dead pile of binary digits.
This is not the natural approach to numbers taken by everyday humans. Another approach to numbers, which was introduced by Alonzo Church in his Lambda Calculus seems quite natural however on the contrary even familiar to little children.

The nunber 3' for example is quite intuitively understood by humans as 3-times'. Thus it is meaningful to say 3 apples', meaning 3 times the entity apple'.

For a programming language that views numbers as dead bit-patterns it is necessary to express something as simple as 3 apples' using a complicated (relative to what is to be expressed) construct like this:

  for (i = 1; i<3; i++) { ; } 

Why not just write:

(three apples)
and define three' as an abstraction looking like this:
 (define three (lambda (f) (lambda (x) (f(f(f x)))))) 

Before we can understand this abstraction we have to define apples as well:
 (define apples (lambda (basket) (insert-apple basket) basket)) 

The definition of apples shows us that we need something else to make the example work: we need a basket as well, which we assume to be defined as a container somewhere in the environment.

How containers like our basket can be defined we will see shortly in one of the next sections when we talk about collections of data.

The function to put an apple into the basket insert-apple' we leave also undefined right now, being confidential that it can be defined later without problems.

Subsections

Next: Explanation of `three apples' Up: Numeric Abstractions Previous: Numeric Abstractions   Contents   Start

Georg P. Loczewski 2004-03-05