>>
<<
Ndx
Usr
Pri
Phr
Dic
Rel
Voc
!:
wd
Help
Dictionary
A. Nouns
Nouns are classified in three independent ways:
numeric or literal; open or boxed; arrays of various ranks.
The atoms of any array must belong to a single class:
numeric, literal, or boxed. Arrays of ranks 0, 1, and 2 are
also called atom, list, and table, or, in math,
scalar, vector, and matrix.
Numbers and literals are represented as stated in
Part I.
Arrays. A single entity such as 2.3
or _2.3j5 or 'A' or '+' is called an atom.
The verb denoted by comma chains its arguments to form a list
whose shape (given by the verb $)
is equal to the number of atoms combined. For example:
$ date=: 1,7,7,6 word=: 's','a','w'
4
|. date |. word
was 6 7 7 1
The verb |. used above is called reverse.
The phrase s$b produces an array of shape s from
the list b. For example:
(3,4) $ date,1,8,6,7,1,9,1,7
1 7 7 6
1 8 6 7
1 9 1 7
table=: 2 3$ word,'bat'
table $table
saw 2 3
bat
The number of atoms in the shape of a noun is called its rank.
Each position of the shape is called an axis of the array,
and axes are referred to by indices 0, 1, 2, etc.
For example, axis 0 of table has length 2 and axis
1 has length 3.
The last k axes of an array b determine
rank-k cells or k-cells of b.
The rest of the shape vector is called the frame of b relative
to the cells of rank k; if $c is 2 3 4 5,
then c has the frame 2 3 relative to cells of rank 2,
the frame 2 3 4 5 relative to 0-cells (atoms),
and an empty frame relative to 4-cells. If:
] b=:2 3 4 $ 'abcdefghijklmnopqrstuvwx'
abcd
efgh
ijkl
mnop
qrst
uvwx
then the list abcd is a 1-cell of b,
and the letters are each 0-cells.
A cell of rank one less than the rank of b
is called an item of b; an atom
has one item, itself. For example, the verb from
(denoted by {) selects items from its right argument,
as in:
0{b 1{b 0{0{b
abcd mnop abcd
efgh qrst
ijkl uvwx
2 1{0{b 1{2{0{b 0{3
ijkl j 3
efgh
Moreover, the verb grade (denoted by /:)
provides indices to { that bring items to "lexical" order.
Thus:
g=: /: n=: 4 3$3 1 4 2 7 9 3 2 0
n g g{n
3 1 4 1 0 3 2 7 9
2 7 9 3 1 4
3 2 0 3 1 4
3 1 4 3 2 0
Negative numbers, as in _2-cell and _1-cell (an item),
are also used to refer to cells whose frames are of the length
indicated by the magnitude of the number.
For example, the list abcd may be referred to either as a
_2-cell or as a 1-cell of b.
Open and Boxed. The nouns discussed thus far
are called open, to distinguish them from boxed nouns
produced by the verb box denoted by < .
The result of box is an atom, and boxed nouns are displayed in boxes.
Box allows one to treat any array (such as the list of letters
that represent a word) as a single entity, or atom. Thus:
words=:(<'I'),(<'was'),(<'it')
letters=: 'I was it'
$words $letters
3 8
|. words |. letters
+--+---+-+ ti saw I
|it|was|I|
+--+---+-+
2 3$words,|.words
+--+---+--+
|I |was|it|
+--+---+--+
|it|was|I |
+--+---+--+
>>
<<
Ndx
Usr
Pri
Phr
Dic
Rel
Voc
!:
wd
Help
Dictionary