1.1 |
Enter the following sentences on the computer,
observe the results, give suitable names to any new primitives
(such as * and +. and *.),
and comment on their behaviour.
a=:0 1 2 3
b=:3 2 1 0
a+b
a*b
a-b
a%b
a^b
a^.b
a<b
a>b
(a<b)+(a>b)
(a<b)+.(a>b)
Compare your comments with the following:
a) |
Negative 3 is denoted by _3.
The underbar _ is part of the representation of
a negative number in the same sense that the decimal point is
part of the representation of one-half when written in the
form 0.5, and the negative
sign _ must not be confused with the symbol used
to denote subtraction (i.e., -).
|
b) |
Division (%) by zero
yields infinity, denoted by the underbar alone.
|
c) |
Log of 2 to the base 1 is infinite,
and log of 0 to the base 3 is negative
infinity (__).
|
d) |
Since the relation 5<7 is true, and the result
of 5<7 is 1, it may be said that
true and false are represented by the ordinary
integers 1 and 0.
George Boole used this same convention, together with the
symbol + to represent the boolean function or.
We use the distinct representation +.
to avoid conflict with the analogous (but different) addition
(denoted by +).
|
|