Stereotyping the classical "high-power" programming languages
2023-04-29
There are several languages from the 60s-70s whose expressiveness has resulted in them being treated as "silver bullet" language families by their proponents and fans, even up to this day.
Lisp's idea is "code is data". Since the code is a data structure that can manipulate and generate itself, create a runtime for a domain-specific language suited for task. A good thesis for it might be Paul Graham's On Lisp.
Forth's idea is "data is code". Since arbitrary syntax and keywords can be defined on the fly, define enough primitives so that the input can be executed directly, becoming part of the program. It's somewhat described in Chuck Moore's own Programming a Problem-Oriented Language, but these two posts illuminate it better.
APL's idea is "code is composed of notation". With an expressive notation defining operations over multi-dimensional data structures, express the task in such a way that its underlying structure can be manipulated to produce the desired output. The seminal document is Kenneth Iverson's Notation as a Tool of Thought.
Commentary
Of the three, Lisp and Forth are similar in that their power derives from building up abstractions, while languages of the APL heritage tend to resist the creation of higher-level abstractions in favour of letting the structure of the problem exist as "idioms", which only works because the notation is so dense. Instead of defining a "most-common" function (operating on a list of input), in K (a descendant of APL I'm familiar with1) you could simply write the following:
*>#'=Which can be interpreted as "first-descending-count-each-group". If you're familiar with the symbols, that's shorter than writing most-common. If it were any more verbose, it would be a lot like any other programming language.
I'm not particularly proficient with any of these languages, but having fallen through several language rabbit holes, I'm now valuing tooling over language expressiveness2.
For serious business, choose boring technology that people actually use3 rather than trying to "beat the averages" – it can be fun to think in new ways, but you might want to spend that thought on solving problems at some point too.
Reading list
Regarding language choice:
- Choose boring technology by Dan McKinley
- A defense of boring languages by Dan Luu
- So you're using a weird language from morepablo.com
Peoples' experiences some of these languages:
- J Notation as a tool for thought by Hillel Wayne
- What to learn by Dan Luu
- My history with Forth stack machines by Yossi Kreinin