Division
A language for one division, which it never does.
None1, 2023 · Turing complete: no · ●○○ easy · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
None1 made Division in 2023. A program is a single division, a/b, and whatever you write, the run ends in an error. There are three of them. Text that is not a/b is a syntax error. A division by zero says so. Any other division raises an error anyway, because you do not want it to.
Read the story
So every text is a program, and a syntax error is the language's normal answer. That gives a quine for free. The text Syntax error prints itself.
The machine
| Program | Prints |
|---|---|
| Not of the form a/b | Syntax error |
| a/b with b equal to 0 | You can't divide by zero! |
| Any other a/b | I'll raise an error because you don't want me to! |
a and b are numbers made of the digits 0 to 9. Each message ends with a line feed.
Example
Both Python interpreters in the specification test the first number for 0 rather than b, so they would…
Both Python interpreters in the specification test the first number for 0 rather than b, so they would answer 1/0 with the third message. This implementation follows the rule and its Division by Zero example.
Patterns it teaches
- Every text runs: no text is rejected; a syntax error is the answer.
- Quine: one of the error messages is its own program.
Further
See also
Also in Jokes
Write your own in Run Convert a program from Division
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: division.
Command line
shib run division -e '1/0'shib manual divisionSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/division.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org