The smallest Hello World
Every programming language introduces itself with the same ritual: make it say Hello, World. In Java that takes a class, a method, and a procession of keywords. In C, an include and a main. In Python, a function call. In a shell, five characters of echo and a space. Here is the complete Hello, World in kiki:
Hello, world
That is the whole program. Not a string handed to a print statement — there is nothing else in the file. A kiki document containing those two words evaluates to a page with those two words on it.
You can object that this is cheating, and you would be right. A plain text file "outputs" Hello, World in any viewer, and an HTML file with no tags renders its own text. If prose that displays itself counts as a program, every README ever written is one. But the objection is the interesting part. Why should a programming language's smallest program be indistinguishable from prose at all? That question has a forty-two-year-old answer that never quite got its way.
Knuth's bet
In 1984 Donald Knuth published a paper called Literate Programming, and its thesis still reads like a dare: "Let us change our traditional attitude to the construction of programs: Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do." A program, he argued, is a work of literature.
He didn't just argue it. His WEB system let him write TeX as a book — sections ordered for human understanding rather than for the compiler, prose and code interleaved on every page. Two processors turned that single source into its two lives: tangle extracted and reordered the code for the compiler, and weave typeset the whole thing for people.
Notice the shape of the machinery, though. One source, two compilers, two artifacts. The file Knuth actually edited was neither the book nor the program; the book was woven out of it and the program was tangled out of it. Both audiences read an export.
Two families of descendants
The idea survived in two lines of descent.
The first kept Knuth's direction and simplified the tooling. noweb (1989) made literate programming language-agnostic. Literate Haskell went further and flipped the default: in Bird notation, a .lhs file is prose, and only lines opening with > are code. Org-mode's Babel turned Emacs into a literate laboratory, and a whole subculture still maintains its system configuration as an essay that tangles into dotfiles.
The second family inverted the emphasis and won a much bigger territory: the notebook. Mathematica's notebooks (1988) came first; Sweave (2002) and its heirs knitr, R Markdown, and Quarto conquered statistics under the banner of reproducible research; IPython's notebook became Jupyter and the default surface of data science; Observable put the form on the live web. A notebook, though, is a session with paragraphs. Code carries the story and prose fills the gaps between cells — and the readable artifact is still an export, produced by a Render button or nbconvert, while the runnable artifact is kernel state that famously drifts out of sync with what's on screen.
Forty years on, the pattern held remarkably steady: at most one audience gets to read the source directly, and the other gets an export. Weave and tangle never went away. They just got renamed.
The document is the program
Kiki's answer is to stop exporting. A .ki file is the program and the document — one file that runs as-is and reads as-is.
- Prose is the base case of the language, not a comment syntax around code. An empty file is a valid program; add words and the words are the value. That is why Hello, World costs nothing.
- Code arrives on lines opening with
>— the same mark Bird notation chose for Literate Haskell, pointing the other way: here the code lines are the guests. - Computed values splice into sentences with
\( ), so a number in a paragraph can be a result rather than a claim. - And weave and tangle collapse into a switch. One source carries three views — editing, source, and display — so the typeset book and the bare program are projections you toggle, not artifacts you generate.
There is one more difference: the woven page can be alive. In the workspace, the reading view keeps computing while you read — values stay current and controls stay wired — where a woven listing or a rendered notebook is a photograph of a run that already happened. In fairness, the page you are reading right now is a snapshot: publishing to the open web is the one weave step we still perform, for the crawlers' sake. The living version is one link away, at the bottom.
This post is the demo
This post is itself a kiki document. Just above this paragraph, the source holds a code cell — > greeting = "world" — that you cannot see, because in the reading view definitions render nothing; only their consequences do. Here is the consequence:
Hello, world!
That sentence is computed, not typed. Open the source view and the machinery is all there; switch back and the essay reads clean. No tangle, no weave, no export.
Knuth asked us to concentrate on explaining to human beings what we want a computer to do. Forty years later, maybe the cleanest way to do that is for the explanation itself to be the instruction.
Open this post in the Kiki editor and flip the view switch to see for yourself.