esolang

Tarski

Six combinators on a stack of quoted programs, and no output at all. The program becomes its result.

Chase Roycroft, 2021 · Turing complete: yes · ●●● hard · esolangs.org

Tested with 4 known programs · Test method

Run it

Expected: Hello, world!

The idea

Chase Roycroft made Tarski in 2021, after Underload and the theory of concatenative combinators. Everything on the stack is a quotation, a piece of program in brackets. There are no numbers and no characters. Numbers are programs that make n copies of the top of the stack, as Church numerals do, and booleans are programs that keep one of two quotations.

Read the story

Tarski has no way to print. The specification says the program turns itself into its output, and this implementation shows what is left on the stack.

The machine

CommandDoes
[A]Push the quotation A
*Join the top onto the end of the one below
~Swap
?Drop
!Duplicate
'Quote the top: A becomes [A]
` | Run the top

Everything else does nothing. The output is the text of each quotation left on the stack, bottom first, one per line, without its outer brackets.

Example

The quine duplicates its quotation, quotes one copy, swaps and joins.
Expected: [!'~*]!'~*

The quine duplicates its quotation, quotes one copy, swaps and joins. What is left is the quoted program followed by the program, which is the source.

The truth machine picks with a boolean. [~?] is True, and it keeps the quotation that runs [0].

Expected: 0

The factorial from the specification takes its number as the count of ! in the first brackets and leaves the result as that many !. On 7 it leaves 5,040 of them; on 3 it leaves six.

Expected: !!!!!!

Patterns it teaches

Further

String-rewriting paradigm

Functional paradigm

Write your own in Run Convert a program from Tarski

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: tarski.

Command line

shib run tarski -e '[!'\''~*]!'\''~*'
shib manual tarski

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/tarski.js

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

Source esolangs.org (CC0) · Edit on esolangs.org