# A Programming Language

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

A Programming Language is the title of a book and a paper, both published in 1962 by Kenneth E. Iverson. It describes one iteration of his notation. The initials of the book's title later was used to form the name APL. At the time of writing Iverson notation was used for mathematics and description of IBM's hardware, and its purely human purposes are reflected in the loose conventions (relative to APL) and two-dimensional structure of the notation presented in A Programming Language.

## Notation

A Programming Language does not feature a full multidimensional array model. Rather, operations are defined on scalars, vectors, and matrices while higher-rank arrays are not discussed. Nonetheless, it features many of the array conveniences that became characteristics of APL:

• Scalar functions are present with the name "basic operations".
• While scalar extension is not defined in general, a scalar can be multiplied by an array as a "scalar multiple".
• Vector functions are usually extended to work on the rows of matrices (the opposite of the leading axis model). When doubled typographically, they work on columns instead.

In addition to scalars, vectors, and matrices, tree and file types are defined.

A Programming Language features precursors of many APL primitive functions. These include:

• The shape vector is not used, but dimension functions are present: ${\displaystyle \nu }$ gives the length of a vector, and ${\displaystyle \nu }$ and ${\displaystyle \mu }$ give the row length and column length of a matrix.
• Comparison functions are defined using the symbols ${\displaystyle <}$, ${\displaystyle >}$, and ${\displaystyle =}$ and the rules that a vertical bar negates a relation and that an underline combines it with ${\displaystyle =}$ (relations are combined by or-ing them together).
• The arithmetic scalar functions Sum (${\displaystyle +}$), Difference (${\displaystyle -}$), Product (${\displaystyle \times }$), and Quotient (${\displaystyle \div }$) are defined as in mathematics.
• The logical functions And (${\displaystyle \wedge }$) and Or (${\displaystyle \vee }$) also match mathematical usage. Logical negation is denoted with an overbar.
• The functions Absolute Value, Ceiling, and Floor use paired symbols (${\displaystyle |a|}$, ${\displaystyle \lceil a\rceil }$, and ${\displaystyle \lfloor a\rfloor }$). The paired symbols for ceiling and floor were adopted by mathematicians (absolute value was already in use), but APL implementations dropped the closing symbol for consistency with monadic function syntax.
• Residue uses ${\displaystyle |}$ as in APL, but allows a subscript to indicate the smallest value allowed—mirroring index origin.
• Interval (renamed "Index Generator" in APL\360) uses the letter ${\displaystyle \iota }$ with an optional index origin subscript.
• Index-Of is also written with ${\displaystyle \iota }$ and an index origin subscript. It is defined on vector left arguments and vector or scalar right arguments.
• Membership is ${\displaystyle \epsilon }$ as in APL.
• Reduction (${\displaystyle /}$, or ${\displaystyle //}$ instead of ⌿) starts from the left rather than the right. For reductions of empty arrays, the identity element is returned.
• Rotate is written with arrows: ${\displaystyle \uparrow }$ for left rotation and ${\displaystyle \downarrow }$ for right rotation.
• Reverse is written with an arrow in some direction above the argument.
• Transpose is written with a tilde (${\displaystyle {\tilde {}}}$) above a matrix, e.g. ${\displaystyle {\tilde {M}}}$.
• Compression and Expansion use ${\displaystyle /}$ and ${\displaystyle \backslash }$ as in APL.
• Catenate uses a circled comma.
• Indexing is written with a subscript, or ${\displaystyle \textstyle \int _{j}}$ to allow index origin specification.
• Grade is called "ordering", and the Grade of ${\displaystyle x}$ with index origin ${\displaystyle j}$ is written ${\displaystyle 0_{j}/x}$
• Base (${\displaystyle \bot }$) on vectors works like in APL. On matrices, rows are paired up, or columns with a doubled base symbol.
• The Intersection and Union are written with ${\displaystyle \cap }$ and ${\displaystyle \cup }$, and the Set Difference with ${\displaystyle \Delta }$.
• The Inner Product is written by placing one scalar function above another, e.g. ${\displaystyle u\,_{\times }^{+}{}v}$, and the Outer Product by using ${\displaystyle \circ }$ in place of the top function with two vector arguments