Intro03


3. Verbs and Adverbs


In the sentence %a of Section 2, the % “acts upon” a
to produce a result, and %a is therefore analogous
to the notion in English of a verb acting upon a noun or pronoun.
We will hereafter adopt the term verb instead of
(or in addition to) the mathematical term function used thus far.


The sentence +/ 1 2 3 4 is equivalent
to 1+2+3+4; the adverb / applies to
its verb argument + to produce a new verb
whose argument is 1 2 3 4, and which is
defined by inserting the verb + between the items of its argument.
Other arguments of the insert adverb are treated similarly:

   */b=:2 7 1 8 2 8
1792
   <./b
1
   >./b
8

The verb resulting from the application of an adverb may
(like a primitive verb) have both monadic and dyadic cases;
due to its two uses, the adverb / is called either
insert or table. In the present instance of /
the dyadic case produces a table. For example:

   2 3 5 +/ 0 1 2 3 
2 3 4 5
3 4 5 6
5 6 7 8

The verbs over=:({.;}.)@":@, and by=:' '&;@,.@[,.]
can be entered as utilities (for use rather than for immediate study),
and can clarify the interpretation of function tables such as
the addition table produced above. For example:

   a=: 2 3 5
   b=: 0 1 2 3
   a by b over a +/ b
+-+-------+
| |0 1 2 3|
+-+-------+
|2|2 3 4 5|
|3|3 4 5 6|
|5|5 6 7 8|
+-+-------+
   b by b over b </ b
+-+-------+
| |0 1 2 3|
+-+-------+
|0|0 1 1 1|
|1|0 0 1 1|
|2|0 0 0 1|
|3|0 0 0 0|
+-+-------+

Exercises

3.1   Enter d=: i.5 and the sentences st=: d-/d
and pt=: d^/d to produce function tables for subtraction
and power.

 
3.2   Make tables for further functions from previous sections,
including the relations < and = and > and
lesser-of and greater-of.

 
3.3   Apply the verbs |. and |: to various tables,
and try to state what they do.

 
3.4   The transpose function |: changes the
subtraction table, but appears to have no effect on the multiplication table.
State the property of those functions whose tables remain unchanged
when transposed.


Answer: They are commutative

 
3.5   Enter d by d over d!/d and state the definition
of the dyad ! .


Answer: ! is the binomial coefficient or outof
function; 3!5 is the
number of ways that three things can be chosen from five.