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.

Simpl

From Esolang
Jump to navigation Jump to search
This article is not detailed enough and needs to be expanded. Please help us by adding some more information.

Simpl is an esoteric programming language created by User:Cordership that is really simple.

Examples

Hello, world!

print (Hello, World!)

Fibonacci sequence

assign var a = 1
ask (The desired Fibonacci number is in what place?)
assign var n = ans
def fib(x) = fib(x) + fib(x - 1)
def fib(1) = 1
repeat n:
-> assign var a = fib(x)
-> print (a)
end program

Collatz sequence

ask (Input?)
assign var a = ans
def col (x) = 3x + 1 {mod(x, 2) = 1}, x/2 {mod(x, 2) = 0}
repeat until a = 1:
-> assign var a = col(a)
-> print (a)
end program

Truth-machine

ask (Input?)
assign var a = ans
check if a = 0
yes:
-> print (0)
-> end program
no:
-> end program
check if input is 1
yes:
-> repeat inf:
-> -> print (1)
-> no:
-> -> end program

Check even/odd

ask (Input?)
assign var a = ans
check if mod(a, 2)=0
yes:
-> print (join(a; is even))
-> end program
no:
-> print (join(a; is odd))
-> end program

Looping counter

assign var a = 1
def f(x) = x + 1
repeat inf:
-> print (num of (*) = a)
-> assign var a = f(a)

99 bottles of beer on the wall

assign var n = 99
def f(x) = x - 1
repeat until a = 2:
-> print (n bottles of beer on the wall, 
n bottles of beer.
Take one down, pass it around,
n bottles of beer on the wall.)
-> assign var n = f(n)
print (1 bottle of beer on the wall,
1 bottle of beer.
Take one down, pass it around,
No bottles of beer on the wall.)
print (No bottles of beer on the wall,
No bottles of beer.
Go to the store, buy some more,
99 bottles of beer on the wall.)
end program