TacO
A two-dimensional tacit language. The program is a tree that grows out of one @.
TehFlaminTaco · Turing complete: unknown · ●●○ moderate
Tested with 9 known programs · Hello World on Try It Online: identical except the line end · Test method
Run it
The idea
TacO was written in Lua by TehFlaminTaco. A program is a grid with exactly one @ in it. Everything that touches the @ is an argument of the @, everything that touches those is an argument of them, and so on outwards. The shape of the text is the shape of the expression.
Read the story
Neighbours are taken in a fixed order, left, up, right, down. So p with 1 on its left, 2 above and 3 on its right prints 1 2 3. A branch blanks the cells it has passed, so it never crosses itself, but two branches can both reach the same cell, and then that cell is worked out twice.
The machine
| Cell | Does |
|---|---|
0-9 | Itself, or its digit with its arguments written after it, so 1 over 2 is 12 |
"text" | A list of bytes, read in the direction it was entered |
+ - | Sum, or join lists; subtract from the first |
* | Run the second argument as many times as the first says |
? | Run the second or the third argument, by the first |
% | Run the second for each of 1 to n, or each item of a list, as input 1 |
p w | Print the arguments with tabs and a newline; write them as they are |
l s n j g e i | Make a list, text as a list, length, join, index, spread, input |
< ^ > v | Let the branch go on in that direction only |
# and any other | Pass the arguments on |
Arguments are only worked out when the cell asks for them, which is how *, ? and % can repeat or skip a branch. At the end, whatever the @ gives is printed with a newline.
Example
In the third the * has 3 on its right and 5 below it, so it gives three fives, and the + adds them up.
In the third the * has 3 on its right and 5 below it, so it gives three fives, and the + adds them up. In the last the % runs the i below it once for every number from 1 to 5, and each time the input is that number.
Patterns it teaches
- Two-dimensional control flow: there is no instruction pointer at all, only a tree read off the grid.
- Code as data: an argument is passed as code, and the function decides when, and how often, to run it.
Try this
- Print the sum of 1, 2, 3 and 4 with one
+. - Print
yesornodepending on whether input 1 is 0. - Hard: print the squares of 1 to 5.
Further
- The reference interpreter, in Lua, with the rules in its README
See also
Also in Spatial (2D and up)
Write your own in Run Convert a program from TacO
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: taco.
Command line
shib run taco -e '@p1'shib manual tacoSource
- Module
langs/tio/ports.js- Interpreter
langs/tio/taco.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language