APL is an interpreter-based programming language. This means that you need an interpreter to write and execute the code. When I first got to know and appreciate APL at the university in 1985, the APL interpreter and later the APL2 interpreter from IBM were used there. This tool had two drawbacks. First, it (at that time) ran only under DOS, which meant only on an (IBM) PC, and second, it was difficult to impossible for private users to acquire the interpreter. I vaguely remember playing around back then with a CP/M version on an Apple II computer. Although IBM eventually made a free version (TryAPL2) available, it also ran only under DOS. Additionally, under DOS there was generally a problem with the required character set. Over the years, APL has lost significance, and today there is basically only one serious version from Dyalog Ltd. Fortunately, this version is available free of charge for private users. Dyalog has further developed APL and extended it with very powerful functions and new programming concepts, which can sometimes be intimidating. The already cryptic syntax thus becomes even more incomprehensible and potentially off-putting.
APL!

Unique Characteristic
The difference between APL and “traditional” programming languages lies, simply put, in its power. The usual suspects, like C, Java, etc., essentially consist of a handful of control structures (if, while, for …) and some basic arithmetic operations. APL, on the other hand, can be programmed largely without control structures (loops, conditionals) and comes with a whole range of very powerful data manipulators and mathematical functions. Furthermore, functions can also be combined by operators to obtain even more powerful functions.
A Tool of Thought
In short, APL requires a completely different way of thinking. Once you have internalized it, your cognitive horizon is expanded by miles compared to conventional thinking. APL juggles data, functions, and operators all around itself. It is simply a fascinating programming language, or as its creator Ken Iverson said: A Tool of Thought.
Why I still use APL
Fascination, simply fascination. That’s enough.
Remarks
- Yes, I know that there are (or were) compilers for APL.
- Other programming languages include the powerful programming paradigm of object-oriented programming or have evolved in that direction.
- APL is completely unsuitable for programming microcontrollers.
- The barrier to learning APL is very high. Damn high.
- Should you ride a dead horse?

Prime Numbers
Many APL programs are not real programs at all, but so-called one-liners or idioms. There are several collections of one-liners out there in the wildness. A very extensive collection is the FinnAPL Idiom Library.
Idioms look like the program on the right side. The first two lines are comments and are not necessary. The third line is the idiom, and the last line is the result calculated by the interpreter.
The idiom works as follows: All APL commands are calculated from the right to the left. Thus here are the numbers from 1 to 30 generated (with the iota) and assigned to a variable named n. The slash is a function with two arguments. The right one is here the contents of the variable n ( a list of all numbers between 1 and 30), the left one is a list of 0s and 1s to select elements on the right. This list (also called a vector) is calculated with the functions inside the brackets on the left side. Also these functions are processed from the right to the left. n∘.|n results in a two dimensional array (a matrix) with the reminders of all numbers in n divided by all numbers in n. The reminders are compared with zero and then the zeros in each column are summed up. If the sum of zeros in one column is two, then the corresponending number in n is prime. This result is used to reduce the numbers in n.

The company Dyalog Ltd. (developer of an APL interpreter) publishes a weekly APL puzzle on its Facebook page. Each challenge consists of a one-liner, for which you have to determine the function or effect. Sometimes it’s an easy task, sometimes it’s (for me) unsolvable—especially when the code relies on language extensions that Dyalog has implemented. Challenge No. 78 is shown on the right. It works on a character array.
To make the solution easier to understand, I changed the code into an idiom without using a user-defined function and also replaced the space with an asterisk.
Challenge Week 78
