Iota
One combinator and one way to combine it. Two symbols, * and i, and that is the whole language.
Chris Barker, 2001 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
Unlambda needs S and K. Can one combinator do the job of both? Chris Barker showed that it can, with a single function ι (iota) that takes x and returns x S K.
Read the story
Feed ι to itself and the familiar combinators fall out:
ι ιbehaves like I;ι (ι (ι ι))is K;ι (ι (ι (ι ι)))is S.
Since S and K can build anything, so can ι. Barker published Iota together with its sister language Jot in a short article asking which languages are "the simplest".
The machine
There is no state except the expression itself. A program is a binary tree, written in prefix form:
| Symbol | Means |
|---|---|
i | The combinator ι, where ι x = x S K |
* | Apply: *FG applies F to G |
Running a program means reducing it with the rules of combinatory logic until nothing changes:
- ι x → x S K
- K x y → x
- S x y z → x z (y z)
- I x → x
Iota has no input or output. To see what a program does, give it some made-up arguments and look at what comes out.
Example
K takes two arguments and keeps the first.
K takes two arguments and keeps the first. In Iota, K is *i*i*ii:
Trace *ii applied to x by hand:
ι ι x → ι S K x → S S K K x → S K (K K) x → K x (K K x) → x
Five steps to do what I does in one. Iota pays for its minimal alphabet in length and in time.
Patterns it teaches
- Combinators: a single "universal combinator" is enough.
- Turing tarpit: about as small as a universal language gets.
- Turing completeness: Barker's proof translates S and K into ι and back.
- Every text runs: Iota almost has it. Any string of
*andiwith the right counts is a program, but**ioriiis not. Jot closes the gap.
Try this
- Check by hand that
ι (ι (ι ι))applied toa bgivesa. How many steps does it take? - Write an Iota program for K I (which returns its second argument), and run it on
a b. - Hard: find a short Iota program that has no normal form (this implementation will hit its step limit).
Further
- esolangs.org/wiki/Iota
- Chris Barker, "Iota and Jot: the simplest languages?" (2001), the original article.
- Jot and Lazy K, which accepts Iota as one of its four syntaxes.
See also
Functional paradigm
Write your own in Run Convert a program from Iota
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: iota.
Command line
shib run iota -e '*ii' --input 'x'shib manual iotaSource
- Module
langs/museum/ports.js- Interpreter
langs/museum/iota.js,langs/common.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org