Previous       Table of Contents       Next

Array Languages I

The main difference between array languages and conventional languages is that with array languages arithmetic and logical operations may be applied not only to individual numbers but to lists, tables, and structures of arbitrary dimension. Thus many procedures which may become quite complicated with conventional languages can be expressed very simply with array languages. In this section we shall consider briefly the three array languages, APL, Nial and J, with which I have worked. First of all, though, we give a J program for the sample problem, remarking here only on its brevity and simplicity as compared with the programs of the previous section.

     num=: #
     sum =: +/
     max =: >./
     summary =: num, sum, max

APL, for "A Programming Language", was originally conceived by Kenneth Iverson while a graduate student at Harvard in the early 1950s. It was intended as an alternative to conventional mathematical notation for the description of algorithms arising in problems of sorting, searching and optimization. After leaving Harvard, Ken joined IBM where APL was first implemented on a computer in 1966. Since then there have been several major implementations, the current one being designated APL2.

The principles underlying the design of APL have been simplicity, brevity and generality. While the conventions of mathematical notation have been respected, these principles have always been given precedence. The data objects in APL are one-dimensional lists, two-dimensional tables, and in general rectangular arrays of arbitrary dimension. (We may note here that the simple terms "list" and "table" replace the harsher terms "vector" and "matrix" which have a mathematical connotation.) In addition to the usual elementary arithmetical operations of addition, subtraction, multiplication, division and raising to a power, there is a large number of additional operations which are defined for arrays as well as for individual numbers. For example, if we have a list of prices, a single operation will give the sum of the prices. If we also have a corresponding list of the number of units of each item purchased, then a single multiplication will give a list of the total amount spent for each item, and one addition will give the total amount spent.

The APL character set had 88 characters, this number being the maximum number available on the normal typewriter keyboard. They were the upper-case italic letters (which were typed without the use of the shift key), the digits 0 to 9, and 52 other characters many of which were common mathematical symbols with the remainder being limited to APL. Overstriking of certain pairs of characters was allowed resulting in 18 overstruck symbols and the 26 underlined upper-case letters formed by overstriking the letters with the underbar character. This character set was available on a Selectric typewriter element, familiarly referred to as a "golf ball", shown in the accompanying figure. Although the APL notation gave no problems with pencil and paper - indeed, it was a pleasure to use - its practical realization often presented problems. Also the efficient management of boxes of type elements was very important for the smooth functioning of university computing laboratories. As APL became to be used on a greater number of computing systems with different printers, the production of printed copy of APL text or a combination of APL and normal text was often a challenging task. This prompted Professor Frank Anscombe of Yale University to remark that as printing with computers became easier the printing of APL became more difficult.

Upon retirement in the late 1980s Ken began work on a "modern dialect" of APL that would provide the simplicity and generality of APL while at the same time be readily and inexpensively available on a variety of computers and capable of being printed on standard printers. The language was given the name J by Roger Hui, one of the its principal developers, because, he said, "the letter 'J' is easy to type".

Nial, for "Nested Interactive Array Language", combines concepts from APL and other languages within the framework of a mathematical model called array theory. It was developed in the late 1970s and 1980s by Trenchard More of the IBM Cambridge Scientific Center. The name comes from the Old Norse Icelandic name "Njal", a fact which has not been overlooked in the promotion of the language. (The "Q" in the logo shown here comes for Queen's University in Kingston, Ontario which is the home of Nial Systems Ltd.) The data objects in Nial are arrays whose items may be arrays, whose items in turn may be arrays, and so on. The basic items of arrays may be any of several types such as integers, decimal numbers, literal characters, etc., and different types may occur in the same array. As with APL, there is a large number of primitive array operations available and additional operators and programs may be defined.

There appear to be no readily available data on either the use of array languages relative to other programming languages or the relative use of APL, Nial and J. APL has been used extensively in a wide range of scientific and commercial applications and has had a group of devoted advocates in many universities. It continues to be used extensively and is supported by IBM and other major companies. Interest in J has grown in the last few years and appears to be increasing. Nial had a small but enthusiastic group of supporters, mostly academics, in the 1980s, but appears to be little used now.

There are Web sites for APL, Nial and J. For APL the Special Interest Group on the APL and J languages may be consulted for information on both APL and J. The Nial site contains much of interest on the langauge but does not appear to have been updated for quite some time. The J site maintained by Iverson Software Incorporated reflects the current interest in J. A large number of articles on J are referenced here at Papers and Articles.

The IBM Systems Journal (vol. 30, no. 4, 1991) marked the twenty-fifth anniversary of APL and was devoted entirely to papers about the development of the language and its applications. Of particular note are Donald McIntyre's encyclopaedic "Language as an intellectual tool: From hieroglyphics to APL", and Kenneth Iverson's "A personal view of APL" which gives one of the first published accounts of the evolution of APL into J. Unfortunately there appears to be nothing readily available on the development of Nial and its applications.

I was first introduced to APL in about 1966 by Bill Adams who played an important role in bringing the language to the University of Alberta and in promoting its use. We used it extensively in our teaching where it proved popular with many of our students. Much of my research for many years was in statistical applications of APL for which I acquired a certain notoriety with the STATPACK statistical package in its many incarnations. Much to my surprise, and to be honest with some satisfaction, I learned very recently that STATPACK is still being used. During the 1980s I worked with Nial in much the same way as I had worked with APL, and look back with pleasure and gratitude on my association with Trenchard More. A year before I retired I became involved with J, again working with statistical applications although not exclusively, and have derived great satisfaction and pleasure from this work and from the people I have been associated with.

I give a very brief discussion of J here for the person who would like to have an appreciation of the J program for the sample problem given at the beginning of the section. A slightly more detailed introduction to J based on some statistical problems suggested by a bowlful of pennies is given in the section Array Languages II. Details of my work with J may be found on my Jpage. In particular the 14-page paper A Lecture on Array Languages may be downloaded as a PDF file and may serve as an elementary introduction to APL, Nial and J. Persons wishing a somewhat longer and more detailed introduction to J may consult J and Some Elementary Statistical Calculations which may be downloaded as a PDF file. The script file is also available.

One of the greatest and most enduring pleasures in my work with array languages has been my long association with Jim Douglas of the Department of Statistics, University of New South Wales. We met at a conference in the United States in 1969 where I gave a paper on statistical applications of APL. We immediately began a correspondence and soon found we had many interests in common apart from APL. Jim spent the 1977 Fall Term at the University of Alberta, and early in 1980 I spent a couple of months working with him in Sydney. Our correspondence, although less frequent now than it once was, continues to this day.

Previous       Table of Contents       Next