2021-01-26 12:32:57
I am immersed into enterprise software world with its kingdom of nouns. It is an extreme verbosity in programming which is quite tiresome. But there is another extreme – the tense programming style of APL and its descendants (A+, J, K etc). Programs in these languages look like maths formulas. These languages pioneered the array programming language design long before it hit mainstream with NumPy. Well, APL stands for “array programming language” so it is no surprise that it is not based around scalar operations.
Anyway, I never found myself brave enough to learn and/or understand this style of programming. But I admire that people writing implementation for these languages transfer this style of programming to C (in which interpreters are typically written) which makes it some weird DSL. At first it seems unreadable, but it just needs careful reading (as opposed to skimming that we usually use to “read” code). K interpreter famously said to fit into 26 files named a.c … z.c, 80x24 each.
Here’s an example analysis of snippet of code that served as prototype for J language: https://zserge.com/posts/j/
A little more interesting example is the buddy memory allocator from A+ programming language: https://github.com/tavmem/buddy/blob/master/a/b.c
That contains 2 implementations: original 10-line in terse-style and rewritten in a more conventional style 700-line version. Though it is not a fair comparison because 700-line version also implements the combining of neighbouring segments and is massively commented. It is still fascinating that a real memory allocator that was used in production in one of the largest banks in the world can be written in 10 lines of code.
These snippets of code (as well as code in A+/J/K itself) steal the title of write-only programming language from Perl in my opinion.
493 viewsedited 09:32