esolang

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

Expected: Hello, World!

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

CellDoes
0-9Itself, 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 wPrint the arguments with tabs and a newline; write them as they are
l s n j g e iMake a list, text as a list, length, join, index, spread, input
< ^ > vLet the branch go on in that direction only
# and any otherPass 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.
Expected: 1 2 3
Expected: 15
Expected: 1 2 3 4 5

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

  1. Print the sum of 1, 2, 3 and 4 with one +.
  2. Print yes or no depending on whether input 1 is 0.
  3. Hard: print the squares of 1 to 5.

Further

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 taco

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/taco.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language