Joy (programming language)
Joy
Joy is the paradigmatic pure concatenative programming language — the theoretical answer to the question what would Forth look like as a purely functional language? Manfred von Thun of La Trobe University designed it, releasing the mature Joy1 system in 2001, and it occupies a genuinely unusual position in this catalogue: filed among the esolangs by habit, it is in fact a serious research language — the cleanest realization ever made of the idea that programs are just sequences of functions, composed by writing them in a row.[1]
A Joy program is a sequence of symbols, and the sequence is the meaning: 2 3 + pushes 2, pushes 3, adds them. There are no variables, no assignment, no lambda binding — functions compose by simple concatenation, which makes Joy programs look like sentences in a very small grammar. Square brackets create quotations — unevaluated programs-as-values — so [dup *] is a squaring function sitting on the stack waiting for a combinator to run it.[2]
Combinators instead of syntax
Where a conventional functional language abstracts with lambda expressions, Joy abstracts with combinators — higher-order functions that run quotations in structured ways. Recursion needs no names: the linrec combinator takes four quotations — a base test, a base case, a decomposition step, and a recombination step — and builds the recursive function inline. Factorial, in full, is:
factorial == [null] [succ] [dup pred] [*] linrec
Read: if the number is null (zero), take succ of it; otherwise duplicate and pred (decrement) it, recurse, then multiply. The whole of recursion — a thing most languages need a special form for — is one combinator applied to four little programs.linrec factorial as implemented in the surviving toolchain">[3]
The model is rigorous enough that Joy can derive its own primitives — von Thun showed even i (run a quotation) and the arithmetic layer are conveniences over a deeper combinatory core. It is the least "joke" entry in the esolang wing and arguably the most mathematical entry in this entire wiki.
Why it belongs in this wing anyway
Joy is not a joke — but it is an experiment in how far a single idea can be pushed, which is the esolang temperament in its serious form. Its answer to the wing's recurring question — what can a language do without? — is the most radical of all: it does without names entirely. Unlambda abolished variables by using combinatory logic; Joy abolished them with a stack and quotation marks. Two completely different machines arriving at the same conclusion: names were never necessary.
The original La Trobe project page is gone — Joy's reference implementation is defunct, the language survives through mirrors, the GitHub-archived source, and living descendants like Factor and the Kotlin-based Joy of Postfix. A language elegant enough that people keep rebuilding it is not dead; it is dormant.[4]
Check your understanding
- What is a quotation in Joy, and how is it written?
- How does Joy express recursion without named functions?
- What makes Joy "the pure Forth" — what did von Thun remove?
- Which three-combinator strategy replaces variables?
Show answers
1 — an unevaluated program-as-value written in square brackets: [dup *] is a squaring function waiting to run. 2 — via combinators like linrec, which take a base test, base case, decomposition, and recombination as four quotations and build the recursion inline. 3 — all side effects and imperative bits — Forth's mutation and named words give way to pure function composition on the stack. 4 — quotations plus combinators like i, dip, and linrec — names never appear because values are simply threaded through the stack.
Footnotes
- ↑ Joy, esoteric-languages wiki — von Thun, La Trobe, and the paradigmatic pure-concatenative design
- ↑ Von Thun's Joy documentation (mirrored from the defunct La Trobe site) — the quotation and combinator model
- ↑ Joy of Postfix documentation — the canonical
linrecfactorial as implemented in the surviving toolchain - ↑ Joy implementations — the archived La Trobe project, the GitHub source mirror, and surviving interpreters