A Shocking Brevity
APL (A Programming Language) takes its name from the eponymous book in which Ken Iverson, then teaching mathematics at Harvard, introduced his revised notation for linear algebra. From Harvard he became an IBM Fellow. At IBM, ‘Iverson notation’ became A Programming Language, distinguished by a shocking brevity.
This brevity originates in
- applying functions to arrays of values, abstracting away the work of controlling loops and counters;
- single-character glyphs used to represent primitive functions;
- weak data-typing, so that a small number of powerful primitive functions generalise over many kinds of data.
It leads to a fast, informal and exploratory style of programming quite unlike the ‘waterfall’ approach of Software Engineering.
The single-character APL glyphs have frequently been cited as evidence of APL being unintelligible, or “a write-only language”. This can also be said of any unfamiliar language (do Regular Expressions attract similar comment?)
The glyphs are largely unnecessary and can easily be replaced by reserved words. This can be helpful for a novice who wishes to separate learning syntax and semantics from mastering a keyboard mapping. However most writers prefer the ‘power shorthand’. For example, in J:
sum divide tally
The density of APL expressions helps writers identify and accumulate abstractions, a crucial part of refactoring.
It is possible to write as unintelligibly in APL as it is in Java or English. But APL’s great expressiveness also allows solutions of great simplicity and clarity.