Simplify

From Esolang
Jump to navigation Jump to search

Simplify(Also can be called as simp, just because it's funny) is an interpreted esolang made by User: Justaweirdodev, written entirely in Python.
Simplify essentially simplifies common functions and methods to one char only, including the \n char, that was replaced by the space char, mainly to be able to write everything in just one line, another proposal of the language.

Syntax

The syntax is pretty much based on Python since it was written in python but there's important chars replacements you should check.

Simplify char Actual char
\ Newline char(\n).
Mandatory for every line of code since the one line
converter actually removes all actual newline. characters.
Tab char(\t).
To make the code cleaner, indents are mandatory on this language.
| Space char( ).
Alternative to space char because of the replacement done above.
* Comment char(in Python: #).
All comments should start and end with asterisks.

Commands

Variable and function names can have more than one char, so the replacement wont affect them.

Simplify keyword Actual keyword
^ **(exponentiation)
& and(&&)
@ or(||)
~ not
? range
# reversed(range doesn't support decreasing orders)
b break
d function
e else
f for
F false
i if
p print
r return
s input
t f(format used before strings)
T true
w while

This tokenization in essence doesn't really improve the ease of programming in it but slightly decreases the time needed to write code.

How I can program in it?

Everything sounds too confusing for now but here's some features you can do with Simplify:

f|_|n|r(0, 100):\
 p(_)

This is a for loop that prints all numbers from 0 to 99.
To do it backwards, you only need to do this:

f|_|n|#(r(0, 100)):\
 p(_)

Now with while loops, you can do something like this:

var=s("Insert the nice number: ")\
w|T:\
 i|var=="69":\
  p("Nice.")\
  b\
 e:\
  var=s("Not nice. Insert the nice number: ")

It picks the user input and waits if he inputs 69 as result and doesn't halt until the user puts it.
Now a basic reminder that since all the codes are resumed into just one line at the end, never forget to add the backslash char(\) at the end of each line you do.
Now another example of code:

var=T\
i|var==T:\
 p("not sus")\
e:\
 p("sus")

It uses the boolean type to check whenever a variable is True or False.

Now the final step is defining functions:

d|calculator(num1, op, num2):\
 i|op=="+":\
  r|num1+num2
 e|i|op=="-":\
  r|num1-num2
 e|i|op=="*":\
  r|num*num2
 e|i|op=="/":\
  r|num/num2
 e|i|op=="^":\
  r|num^num2
 e:\
  r|"invalid value"

Here was a simple calculator made by using the operators disponible on the language.
Now you basically understood the hardest parts of this programming language.

Example Codes

Hello World

p("Hello, world!")

Cat Program

cat=s()\p(cat)
*reads input in cat var*

Collatz Conjecture

d|collatz(num):\ p(num)\  w|n>1:\  i|num%2==1:\   num=3*num+1\   p(n)\  e:\   n=n//2\   p(n)
*all spaces chars can't be removed since they all represent the mandatory indents
it seems confusing at first but you can always create as many newlines as necessary*

FizzBuzz

f|j|n|?(1,100):\ i|j%3==0:\  p("Fizz")\ e|i|j%5==0:\  p("Buzz")\ e:\  p(j)
*this for loop is a mess, i know... *

Factorial

d|factorial(num):\ i|num==1:\  r|1\ e:\  r|num*factorial(num-1)

Quine

p("p()")

Truth Machine

a=s()\i|a=="0":\ p("0")\ b\e:\ w|T:\  p("1")

External Source