esolang

HeacunQ9+×

HQ9+ with six more commands, enough for a truth machine and a cat.

AmNow, 2022 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 3 known programs · Test method

Run it

Expected: Hello, World!

The idea

AmNow made HeacunQ9+× in 2022 from HQ9+, the joke language whose H prints Hello World and whose 9 prints the whole of 99 bottles of beer. It keeps all four of HQ9+'s commands and adds six. One stores a function, two run it, one does arithmetic and two read or print the accumulator.

Read the story

esolangs.org files it under unusable for programming. It still has a truth machine and a cat.

The machine

CommandDoes
HPrint Hello, World!
QPrint the program
9Print the 99 bottles of beer song
+Add 1 to the accumulator
C...CWork out the arithmetic between the two C into the accumulator
A...AKeep the text between the two A as the function
ERun the function
×Run the function if the accumulator is not 0
URead a number if the accumulator is -1, else print it
NThe same with one character

The accumulator starts at 0. Every other character is ignored.

Example

The truth machine.
Expected: Q
Expected: 42

The truth machine. C-1C sets the accumulator to -1, so the first U reads the input. The function UE prints and runs itself again, and × starts it only on a number other than 0. On 0 the last U prints 0 once.

Expected: 0

Patterns it teaches

  • Quine: Q prints the program, so Q on its own is a quine.

Further

Also in Jokes

Write your own in Run Convert a program from HeacunQ9+×

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run heacunq9 -e 'H'
shib manual heacunq9

Source

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

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

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