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++) { <apple>; } |
(three apples)and define `three' as an abstraction looking like this:
(define three (lambda (f) (lambda (x) (f(f(f x)))))) |
(define apples (lambda (basket) (insert-apple basket) basket)) |
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.
Georg P. Loczewski 2004-03-05