esolang

If(j)invert()if(l)change()if(q)input()if(t)output(x);

Four letters do something. Every other character prints itself.

2014 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 8 known programs · Test method

Run it

Expected: He11o Wor1d

The idea

The name is the whole manual. j inverts, l changes cell, q reads input and t outputs. There are two cells and no loops, so a program runs once from left to right. Every other character prints itself, which makes any text without those four letters a quine. The FizzBuzz is the list from 1 to 100.

Read the story

Without input a cell only holds 0 or 1, and t prints a cell as a character. So the Hello World writes 1 in place of l, or asks the user for the l. Input is read as a number, as in the Java interpreter, so the user types 108, the code of l.

The machine

CharDoes
jSet the cell to 1 if it is 0, else to 0
lMove to the other cell
qRead a whole number into the cell
tPrint the cell as a character
anything elsePrint itself

Example

The first is one of the Hello Worlds with commands mixed in.
Expected: Hello World
Expected: OK

The first is one of the Hello Worlds with commands mixed in. The two l after He swap the cells twice, and the j and l in the middle flip a cell and move on. None of them print. The second reads 108 once and prints it three times as l. The third is one round of the second cat, which reads two numbers into the two cells and prints both.

Patterns it teaches

  • Every text runs: any text is a program, and most text prints itself.
  • Quine: a text without j, l, q and t is its own output.

Further

Also in Jokes

Write your own in Run Convert a program from If(j)invert()if(l)change()if(q)input()if(t)output(x);

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: if-j-invert-if-l-change-if-q-input-if-t-output-x.

Command line

shib run if-j-invert-if-l-change-if-q-input-if-t-output-x -e 'qtqtqt' --input '72 105 33'
shib manual if-j-invert-if-l-change-if-q-input-if-t-output-x

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/if-j-invert-if-l-change-if-q-input-if-t-output-x.js

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

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