Académique Documents
Professionnel Documents
Culture Documents
by K. E. lverson
This essay portraysa personal view of the An operation (such as summation) which is ap-
development of several influential dialects of plied to all components of a vector is called re-
APL: APLP and J. The discussion traces the duction. . . . Thus, +/x is the sum, x/x is the
evolution of the treatment of arrays, functions,
and operators, as well as function definition, product, and v/x is the logical sum of the com-
grammar, terminology, and spelling. ponents of a vector x.
illustrates certain parts of speech, for whichwe When we came to implement APL, the alphabet
adopted the mathematical terms shown on the left then widely available on computers was extremely
as follows: limited, and we decided to exploit a feature of our
Perhaps because of the influence of a course in Further discussion of cells and rank may be found
tensor analysis taken as anundergraduate, I in the section on tacit programming, and in Ref-
adopted thenotion that every function argument is erence 21.
an array, and that arrays may be classified by their
ranks; a scalar is rank 0,a vector rank I , a matrix The central idea behind the use of cells and a rank
rank 2, and so on. operator was suggested to me at the 1982 APL con-
ference in Heidelberg by Arthur Whitney. In par-
The application of arithmetic (or scalar) function ticular, Arthur showed that a reduction along any
such as+ and x also followed tensor analysis; in par- particular axis (+/ [ I I A) could be neatly handled
ticular the scalar extension, which allowed two argu- by a rank operator, as in+/I I A. By further adopt-
ments to differ in rank if one were a scalar. In defining ing the idea that every primitive possessedintrinsic
other functions (such asreshape and rotate), we at- ranks (monadic, left, and right) I was able, in Ref-
tempted to make the behavior on higher-rank arrays erence 6, to greatly simplify the definition of prim-
as systematic as possible, but failedto find a satisijing itives: each function need be defined only for cells
uniform scheme. Such a uniform scheme (based on having the intrinsic ranks, and the extension to
the notion of cells) is defined in A Dictionary of higher-rank arguments is uniform for all functions.
APL,~and adopted in SAX and in J.
Adverbs and conjunctions
A rank-k cell of A is a subarray of A along k con-
tiguous final axes. For example, if Even after tasting the fruits of generalizing the 2
notation of mathematics to the form f / that per-
A mitted the use of functions other than addition, it
abcd took some time before I recognized the advantages
efgh of a corresponding generalization of the inner or
ij k l matrix product to allow the use of functions other
than addition and multiplication. Moreover, I
mop thought primarily of the derived functions provided
qrs t by these generalizations, and neitherexamined the
UVWX nature of the slash itself nor recognized that it be-
haved like a Heaviside operator.
then the list abcd is a l-cell of A , the table from m
to x is a 2-cell of A , the atomg is a O-cell of A , and However, when we came to linearize the notation
A itself is a 3-cell of A . in the implementation of APL\360, the linearization
of the inner product (which had been written as one
Each primitive function has intrinsic ranks, and ap- function on topof the other)forced the adoption of
plies to arrays as a collection of cells of the appro- a symbol for the conjunction (as in M + . X N). This
The application of adverbs and conjunctions to It is useful to view almost any task as performed in
nouns was adopted in SHARP, 22 S H A R P ~ PSAX,
, and three phases: preparation, the main task, and un-
J, but was resisted in other dialects, in spite of the doing the preparation. In programming terms this
fact that the phrase @ C 3 1 for applying reversal on would appear as i n v e r s e p m a i n p argument.
axis 3 furnished an example of such usage in early In other words, the main function is performed un-
APL, and in spite of the implied use of nouns in der the preparation p.
Heavisides notation D2 f for the second derivative
off. In J the under conjunction is denoted by & . and is
defined as follows:
In calculus, the expression f+g is usedto denote the
sum of functionsf and g , that is, (f +g) x is defined m&. p y is i n v e r s e p m p y
as (f x)+(g x). The utility of such constructs as f+g x m&.p y is i n v e r s e p ( p x ) m ( p y )
and f x g was clear, and I realized that they could be
handled by operators corresponding to the func- For example,since . denotesthenatural loga-
tions + and X. What appeared tobe needed was an rithm in J, the expression a +&. . b yields the
adverb that would applyto a function to produce a product of a and b. The under conjunction is com-
conjunction. However, I was reluctant to compli- monly used with the function open (whose inverse
cate thegrammar by introducing results other than is box) discussed in the section on atomic repre-
functions from adverbs, and I began by suggesting, sentations.
in Reference 23, a limited solution using composite
symbols such as + overstruck by an overbar. Name assignment
Somewhat later I discussed this matter with Arthur In mathematics, the symbol = is used to denote
Whitney, andhe quicklysuggested an operator both a relation and the copula in name assignment
I*:
+""""--+-+--+ & norm
Since the phrase +/ produces a function, the po- + - - + - + - - - +&
tential for tacit programming existed in the earliest
APL; but the restrictions on the copula prevented
1 1 % : I&Isumli
+"+-+"-+
assignment of a name to the definition, and there- +"""""+-+"+
fore prohibited tacit programming. +""""""""-+.+""+
a +/ b 1 1 1 2 3 4 51
+-+""""""-+
0 1 2 3 4
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
+-+""""""-+
4 5 6 7 8
a*/b a <table b
+-+""""-+
0 0 0 0 0
0 1 2 3 4 I 10 1 2 341
+-+""""-+
0 2 4 6 a
0 3 6 912
GI 4 8 l ? 16
a! / b
1 1 1 1 1 + - +""""_ +
0 1 2 3 4
0 0 1 3 6
0 0 0 1 4
0 0 0 0 1
Cited references and note
Such a table can be made easier to interpret by
displaying it with appended arguments, using the 1. A. D.Falkoff and K. E. Iverson, "The Design of APL," IBM
Journal of Research and Development 17, No. 4, 324-334
following tacit definitions: (1973).
2. A. D. Falkoff and K. E. Iverson, "The Evolution of APL,"
ACM SIGPLAN Notices 13. No. 8, 47-57 (1978).
W ) , p. 10.
+-+""""-+ +. >et: LIK u c w a edition of Heaviside's Electromagnetic
IY I I
Theory and the article by P. Nahin in the June 1990 isiue of
I 10 1 2 3 4 1
+-+""""-+ 5. R. K. W. Hui,E. K. Iverson, E. E. McDonnell, and A. T.
Whitney, "APLI?," APL90 Conference Proceedings, APL
Quote Quad 20, No. 4, ACM, New York (1990).
6. K. E. Iverson, "A Dictionary of APL," APL87 Conference
Proceedings, APL Quote Quad 18, No. 1, 202-211, ACM,
New York (1987).
"
I
7 , u " " u
7. R. Hodnkinson. "APL Procedures."APL86 ConferencePro-
+-+""""-+ ceedingsy APL Quote Quad 16, No. 4, ACM,.New York
(1986).
~
~~~-
.
I
ofwavs.
, - 7
Programming," APL91 ConferenceProceedings,APL Quote
Quad 21, No. 4, ACM, New York (1991).
~ ~~~