Intro01


1. Mnemonics


The left side of the page shows an actual computer session with the
result of each sentence shown at the left margin.
First cover the comments at the right,
and then attempt to state in English the meaning of each primitive
so as to make clear the relations between related symbols.
For example, “< is less than
and <. is lesser of (that is, minimum)”.
Then uncover the comments and compare with your own.

   7<5                        Less than
0                             A zero is interpreted as false.
   7<.5                       Lesser of
5
   7>5                        Greater than
1                             A one is true (à la George Boole)
   7>.5                       Greater of
7
   10^3                       Power (à la Augustus De Morgan)
1000
   10^.1000                   Logarithm
3
   7=5                        Equals
0
   b=: 5                      Is (assignment or copula)
   7<.b
5
   Min=: <.                   Min is <.
   power=: ^                  power is ^
   gt=: >                     gt is >
   10 power (5 Min 3)
1000

Exercises

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 +).


1.2   Following the example Min=: <. , invent, assign,
and use names for each of the primitives encountered thus far.