SLet

From Esolang
Jump to navigation Jump to search

This esolang has 5 data types:

1.Set: e.g. {1,2,3}
2.Instruction: e.g. Print "Hello, world!"
3.List: e.g. [{1},{2},{3}]
4.Boolean: True or False
5.Nil: just like lua's

A program is written in 1 line. Comments are written between parentheses.

Symbols besides ( ) " and space are the same as space.

Commands are only

let [variable name] [value]
print [text/number] [value]
if [condition1] then [a list of instruction1] {elif [condition2] then [a list of instruction2]} {elif [condition3] then [a list of instruction3]} {...} {default [a list of instruction]} endif
loop [variable1] [value1] {[variable2] [value2]} {...} while [condition] do [a list of instruction]
return [value]
call [a list of instruction]

A single number is a set e.g.

29 (this is a set {29})

To create a set or combine sets, use this:

combine 29 30 31 all (a set {29,30,31})

To create a list, use this:

list 29 30 31 all (a list [29,30,31])
"Hello, world!" (a list of this string's ASCII)

Calculations:

lv 0 a b (addition a+b)
lv 1 a b (multiplication a*b)
lv 2 a b (a to the b'th power)
lvq1 0 a b (subtract b-a)
lvq1 1 a b (division b/a)
lvq1 2 2 b (sqrt(b))
lvq2 2 2 b (log2(b))
equal a b all (returns boolean type)
contain a b all (returns true if a and b both have at least 1 value)
is a [greater/less]than{orequal} b (returns boolean)
intersect a b all (intersection of two sets)
difference a b
select a with [a boolean, use "this" as the object in a]

index [index, start with 0] of [a list]
replace [a list] from [index] with [another list]
size [a list or set]

nor [boolean1] {boolean2} {...} all

calculation is did between every 2 numbers in the set e.g.{1,4}+{5,6}={6,7,9,10}

use

input [set/list/text]

to get input

Examples

Hello World

list print text "Hello, world!" all

A+B

list let a input set let b input set let c lv 0 a b print number c all

Truth machine (This program is written like Lisp for better understanding)

{list
  {let in input set}
  {if {equal in 0 all} then {list
    {print number 0}
  all}
  default {list
    {loop i 1 while true do {list
      {print number 1}
    all}
  all}
all}

Theoretically, this program prints Graham's number, but no computer in this world can compute this:

list let g lv 5 3 3 loop d 1 while is d less than 64 do list let g lv lv 0 g 1 3 3 let d lv 0 d 1 all print number g all

Editor's note: I'm working on a interpreter myself!