CLASSIC LANGUAGES
APL: going strong after all these years
It might be almost 60 years old, but the APL programming language continues to have an enthusiastic following, as Mike Bedford reveals.
OUR EXPERT
Mike Bedford might not use it in anger, but he’s been fascinated by APL’s quirkiness since he first saw how it could generate prime numbers in just 20 characters.
QUICK TIP
The abandonment of strange symbols in later Iversonian languages, such as J and K, has been considered a retrograde step by some APL diehards. However, the BQN array processing language, introduced in 2020, makes a return to the use of largely unfamiliar symbols.
The classic IBM 5110 luggable, as we discovered in LXF291, ran APL, which stands for A Programming Language, yes really. Despite APL – according to the TIOBE index of the popularity of programming languages – languishing somewhere between the 50th and 100th positions, we were surprised to find that APL still has an enthusiastic following among enthusiasts and for developing commercial applications.
As always, the unexpected is the trigger for articles, and we’re delving into classic programming languages and why some coders choose APL over today’s latest and greatest languages, and what types of application benefit from its different approach to problem solving.
APL overview
Before starting to look at how and why APL is used today, we ought to paint a picture of it. Common descriptions range from unusual to downright bizarre. In fact, a professor of computer science at an American university is on record as saying that “APL is a language designed by a mad-man”. Part of the reason that APL is considered strange is its use of special symbols, instead of keywords, for many of its functions. We also have to say that it is terse in the extreme, as you can see from the following hieroglyphics: , which is a variant of the commonly cited code for displaying all prime numbers up to a maximum of X. Part of the reason that APL code is so concise is that, although some newer variants have added them, the original APL barely had any conditional or flow control statements, and APL code is still commonly written in that way. This omission is because it’s an array processing language. In other words, it can handle many of its operations on arrays, natively, which often eliminates the need for statements that are essential in other languages. APL is normally an interpreted language, too. When we also remember that so many jobs that would require many lines of code in most languages can be achieved on a single line, we can see why it’s sometimes been referred to as a glorified calculator.
APL’s first major implementation was for IBM 360 series mainframes, a paradigm shift from Fortran and COBOL, the workhorses of ’60s and ’70s mainframes.
While APL is, arguably, the best-known array processing language, it’s not the only one. In our discussion of APL, therefore, we’re including two more, which go by the imaginative names of J and K, and are sometimes referred to as Iversonian languages after Ken Iverson who developed APL. In many ways, J and K are similar to APL, although they don’t preserve APL’s use of a non-standard character set. However, they still don’t make extensive use of keywords and, instead, those strange looking characters in APL become ASCII characters, either singly or in combination.