esolang

Multiply

Three numbers, -3, -2 and -1, and one operation. Every program is a product.

A, 2019 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 4 known programs · Test method

Run it

Expected: 12

The idea

A made Multiply in 2019 after a piece of math homework that wrote values as products of -3, -2 and -1. The language does only that. Each x, y or z is a factor, and the program prints the product of all of them.

Read the story

Everything else is ignored, so any text is a program. The XKCD random number program is a few lines of English that hold two y. It always prints 4.

The machine

CharDoes
xMultiply by -3
yMultiply by -2
zMultiply by -1

The number starts at 1 and is printed with a line feed at the end. The C interpreter on the specification keeps it in an int, so it wraps at 32 bits.

Example

Expected: -24
Expected: 4

Patterns it teaches

  • Every text runs: any text is a program, and its x, y and z decide what it prints.

Further

Also in Jokes

Write your own in Run Convert a program from Multiply

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run multiply -e 'xyyz'
shib manual multiply

Source

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

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

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