Small Programs and Languages
The Allure of Minimalist Software
Originally curated by ratfactor as a card in Dave's Virtual Box of Cards.
Timeline:
- Started: 2025-06-02
- Published: 2026-07-28
After receiving a wave of positive feedback on my piece about implementing Forth—specifically regarding the existence of "tiny" versions—I realized I share a common fascination with minimalism. Whether it is a compact language, a diminutive program, or just "small stuff" in general, there is a distinct magnetic pull to brevity.
The Psychology of Scale
My willingness to engage with code is often inversely proportional to its length.
- 20,000 lines: Intimidating; likely to be ignored.
- 2,000 lines: Manageable, but still a commitment.
- 200 lines: Highly likely to be read.
- 20 lines: If it accomplishes something I expected to take 2,000 lines, I am captivated.
Case Studies in Brevity
1. The Surprisingly Slim
While researching DOM diffing for the creation of RetroV, I encountered ijk by Luke Jackson. Having spent so much time wading through bloated "fat" JavaScript libraries, the sheer conciseness of ijk's source was a revelation.
2. The Micro-Forth
Philippe Brochard took this to an extreme, sharing a "Forth" implementation that occupies a mere 46 bytes. While few people enjoy reading raw machine code, the persistence of the curious allows them to eventually decode it.
The Hexdump:
50b8 8e00 31d8 e8ff 0017 003c 0575 00ea 5000 3c00 7401 eb02 e8ee 0005 0588 eb47 b8e6 0200 d231 14cd e480 7580 c3f4
3. The Cryptic Masterpiece
Hui’s "Incunabulum" (Appendix A of An Implementation of J) describes Arthur Whitney’s feat of writing an array-based language interpreter on a single page in one afternoon using an AT&T 3B1.
"I studied this interpreter for about a week for its organization and programming style..." — Hui
The result is 122 lines of incredibly dense C code. While I haven't solved this puzzle yet, it is exactly the kind of thing I would bring with me if I were exiled to a remote mountain.
Note on J: J belongs to the array language family (like APL). If you crave high-performance numerical computing wrapped in cryptic, brief syntax, this is for you.
4. The kOS Ecosystem
Arthur Whitney's influence extends to kOS, as detailed in a talk by Geo Carncross. This is a bootable image of only 90 Kb that includes:
- The
karray language. - The
kdbdatabase. - A GUI and window manager (written in a staggering 60 lines of C).
The "Most Beautiful" Logic
William Byrd once gave a talk titled "The Most Beautiful Program Ever Written." The subject was a Lisp interpreter written in Lisp.
(define eval-expr
(lambda (expr env)
(pmatch expr
[`,x (guard (symbol? x)) (env x)]
[`(lambda (,x) ,body)
(lambda (arg) (eval-expr body (lambda (y) (if (eq? x y) arg (env y)))))]
[`(,rator ,rand) ((eval-expr rator env) (eval-expr rand env)))])))
Theory: Beyond the "Game" of Code Golfing
Many view code golfing as a mere recreational hobby. However, when you see a ray tracer that fits on a business card, it ceases to be a game and becomes a statement of fact: a ray tracer can fit on a business card.
This leads us to the concept of Kolmogorov complexity. In formal terms, the Kolmogorov complexity of a string is the length of the shortest possible program that produces as output:
By pushing the limits of brevity, code golfers are actually discovering the fundamental complexity of a concept.
Examples of Fundamental Minimums:
| Project | Creator | Size | Key Feature |
|---|---|---|---|
| LISP | Justine Tunney | 436 Bytes | Includes Garbage Collection |
| 3D Browser Game | Frank Force | 2 Kb | Insanely compressed JS |
| Demoscene | Various | Variable | Visual/Audio wonders since the 80s |
Final Reflections
Miniature programs are more than just curiosities; they are meaningful. You don't necessarily need to spend a week decoding the "clockwork" of a golfed program to appreciate it. The mere existence of the miniature proves that the core concept is small enough to be held in the hand.
My "Mountain Exile" Study List:
- Decode the 46-byte Forth
- Master the 122 lines of J/C
- Analyze the 60-line kOS GUI
- Explore the Demoscene Assembly