APL Programming languages by Jan Bakker 1966, USA

Description

creators
Ken Iverson et al, at IBM.


papers & manuals
n.a.

software
APL

versions
APL\360, APL SV, VS APL, Sharp APL, Sharp APL/PC, APL2, APL*PLUS, APL*PLUS/PC, APL*PLUS/PC II, MCM APL, Honeyapple, DEC APL.

.

see also
J, S, Matlab

keywords
interpreter language mathemetics statistics

APL stands for “A Programming Language.” It was created in the 1960′s by Ken Iverson and his colleagues at IBM. The language was very much mathematically inspired and used a powerful notation for mathematical algorithms. Therefore APL uses non-ASCII (or non-EBCDIC) symbols, including some Greek letters. So eg the character “X” differs from the arithmetic operation multiply “x” ; the arithmetic operation “devide” is not a “/” but has its own character “a horizontal line and a dot above and below that line” (see below).

APL is a interactive, array and matrices oriented language. Compilers are available. There isn’t even an IF statement, although branching is possible, but that should be avoided. In APL, all expressions are evaluated from right to left. A few simple APL statements will give a feeling for the language:

assignement, assign the values 10 22 25 33 to the variable COSTS; so the variable COSTS is a vector containing 4 values
reduce-function, reads as “sum over COSTS”, take the plus-reduction-of-variable COSTS, or just calculate the sum of all elements in vector COSTS
reduce-function, but now use multiply, reads as “mutiply over COSTS”
assignement using the rho-function, which define a matrix; variable COSTS2 will be a matrix of 2 rows and 4 columns and gets values 11 … 12
the rho-function is used monadic, this means that there is only a right argument and not, as in above example, a right and a left argument (used dyadic); this monadic function wil give the number of rows and columns, so the result is a vector
do a “multiply over the result of a monadic rho over COSTS2″; this means give the total number of elements in COSTS2
the “rho over COSTS” gives the number of elements in COSTS, the “sum over COSTS” gives the total sum over all elements; divede these two and it gives the total average
the “rho over matrix COSTS2″ gives the number of rows and columns; the “multiply over this result” gives the total number of elements in the matrix; the “plus over the matrix COSTS2″ gives the sum per row, so two values; the sum over that result gives the total sum, etc.

This just gives a feeling for APL. There are a lot of powerfull monadic and dyadic functions, which make it possible to program in a very compact way. For a mathematician it is a perfect language, but the level of abstraction is very often too high for most “normal” programmers. Another example:

This line of code calculates the prime numbers from 2 to the starting value of R, in this example 20.

the “iota funtion” of R filles a vector (and that will be R again) with numbers from 1 to the value of the variable (20 in this example), the first element is dropped (that is the 1); so to the right of the “/” there will be 2 3 4 5 … 18 19 20

the “small.circle-dot-multiply” defines an outer product so all elements of R are multiplied by all elements of R giving a matrix; check whether elements of R are in the matrix and make a vector containing “1″-s at the place where that is true and “0″-s where that is not true

inverse that vector and use it to grab that elements from R using the “over” function

If you like this, go and enjoy APL. If not, no problem, and forget this language. Because of the compact style, maintenance of old programs is very often a hard job. Nowadays one finds APL on nearly all computers, whether micro, mini or mainframe [1].

Notwithstanding its age, many ideas in APL are still unique, while others have found their way into other programming languages. Eg “inverted files” are sold as a new technology for data warehousing and data mining, but APLDI used this technology in the 1970-s. A inverted files can not only read rows of a table as records, but can also read columns as records.

 

Links

The largest archive of APL and J software can be found at Waterloo University. Interpreters, workspaces, information, and more! [2].

There are a lot of APL associations, clubs, etc. The community seemes small, but has a high spirit. Look at site from eg the British APL Association , the Finnish APL Association , etc, A fine overview of associations, vendors, books, etc can be found at all these sites and on a lot of personal sites, eg Jim W’s APL Information . These links proof the theorem, “Once an APL programmer, always an APL addict”.

 

Specifications

see above

 

Chronology

Author: programming on January 31, 2011
Category: Uncategorized

Last articles