We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
Insanity
Insanity is an esolang conceived of by User:PythonshellDebugwindow and finalised by User:A. It's based on Einstein's definition of insanity—doing the same thing over and over again and expecting a different result.
Program structure
The whole program is wrapped in an infinite loop, because in the body of the infinite loop the same thing is repeated over and over again. However, since there are mutable variables, you can expect a different result on every iteration of the loop, making you at least partially sane.
In the first line a set of variables is defined and is assigned to a specific value. Different variables are separated with commas. E.g.
1,1+2,5
They are assigned to a, b, and c, respectively. All assignable variables are a-z and A-Z, and operators are + - * /.
In the remaining lines an infinite loop is set to iterate these variables.
Example programs
Fibonacci sequence
0, 1 b, a+b
Factorial
The following program generates the factorial n! for each n ≥ 1, storing the result n! in the variable a, while the variable b maintains the multiplicand n + 1 for the next cycle.
1, 2 a * b, b + 1
Counter
This simple program counts from one (1) up to infinity, storing each result in the variable a:
1 a+1
Waves
The following program cycles the variable a between 1, 2, 3, and 2.
1, 2, 0, -1 a + b * 2/3 + c * 2/3 - 1/3, d - b * d - c, 1 - c, -d
A larger wave which cycles a between 1, 2, 3, 4, 5, 4, 3, and 2:
1, 0, 1, 1, 1, 1 a + f, b + c * 2/3 + d * 2/3 - 1/3, e - c * e - d, 1 - d, -e, f * b + f * d
External resources
- Common Lisp implementation of the Insanity programming language.
- An interpreter written in Node.js