esolang

Fueue

There is one queue. The program is put in it, the data goes in it, and the functions eat whatever happens to stand behind them.

Nathan van Doorn, 2012 · Turing complete: yes · ●●● hard · esolangs.org

Tested with 4 known programs · Hello World on Try It Online: identical · Test method

Run it

Expected: Hi

The idea

Nathan van Doorn made Fueue in 2012. A program is read into a single queue and then the queue is turned over, one element at a time. A number at the front is printed. A function at the front looks at the values right behind it; if they are the kind it needs, it takes them and puts its result at the back. If not, the function itself goes to the back and waits for a better moment.

Read the story

Since results always land at the back, timing is everything. A value made now is only usable a full round later, and a number standing at the front is printed whether that was wanted or not. Blocks, queues inside square brackets, are how values are kept safe until they are needed.

The machine

FunctionTakesPuts at the back
+ * /two numbersTheir sum, product or quotient
- %a numberIts negation; its logical not
: ~ !one or two valuesTwo copies; the two swapped; nothing
$a number a, a valuea copies of the value
( < )a value; a block and a value; a block[value]; the block with the value added; the block's contents
HHalts

Input only arrives when the queue has gone a whole round without anything changing. Then one character is read and its code is put at the back. Making a program sit still long enough for that is hard, and esolangs.org's truth machine is the proof that it can be done.

Example

Both are from esolangs.org, the first one shortened.
Expected: ABCDEFGHIJKLMNOPQRSTUVWXYZ

Both are from esolangs.org, the first one shortened. The second loops from 65 to 90, printing each letter, and stops by comparing against 91.

Further

Ideas it shows

Queue-based

Write your own in Run Convert a program from Fueue

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run fueue -e '72 101 108 108 111 44 32 87 111 114 108 100 33H'
shib manual fueue

Source

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

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

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