SletScript
Jump to navigation
Jump to search
Versions: 1 - 2 - 3 - 4 - 5 - 6
- This article is not detailed enough and needs to be expanded. Please help us by adding some more information.
![]() |
|
| Designed by | User:I am islptng |
|---|---|
| Appeared in | 2025 |
| Computational class | Turing-complete |
| Reference implementation | Python |
| Influenced by | GolfScript |
| File extension(s) | .slet |
SletScript is a programming language designed by User:I am islptng.
Examples
Hello World
.+(Hello, world!)[\@n]
A+B problem
.+::
Quine
.":\#s(.":\#s(!)(!)s 1)(!)s 1
Fibonacci
\#t 0\#a 0\#b 1'>15t{#t+1t.b.\@n\#c a#a b#b+a c}
Factorial
Iterative
!fact n\\n"!m 1"+1+1n 1i*m i
Recursive
!fact n\\n?=1n 1*fact+n-1n
Try fact 10.
brainfuck interpreter
by User:Redstoneboi.
Function definition:
\#TEXT -1
\#NUMERIC 1
\#OUTPUT_MODE TEXT
!bf s\\l f\\l {
\#b []
\#t"!t[]s c{
?=c@[ #b+b[<t];
?=c@]{
\#l +b+<b-1
\#d +l-<t
#b":b+<b-1 1[]
+":t l 1[-d][d]
}?<"*([]-+<>.,)[c] +t[c]
t
}
#b[\#i\#m\#p 0]
<'><t p{
\#c +t p
?`c\\n ?*c=0+b m#p+p c;
?=c@- #b":b m 1[%+-1+b m 256]
?=c@+ #b":b m 1[%+ 1+b m 256]
?=c@< ?>m 0 #m+m-1 #b+[0]b
?=c@> {#m+m 1 ?>< b m;#b+b[0]}
?=c@. ?OUTPUT_MODE {.+b m.@ } {.*+b m\\c}
?=c@, #b":b m 1[|*+f+-1#i+i 1\\n0]
;
#p+p 1;
}
}
Usage:
[} hello_world {]
#OUTPUT_MODE TEXT
\#iters bf(++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.)()
.(Took ).iters.( iterations.).\@n
[} cat program {]
#OUTPUT_MODE TEXT
\#iters bf(,[.,])(Hello, World!)
.\@n.\@n.(Took ).iters.( iterations.).\@n
[} numeric input and output demonstrated by multiplication {]
[} takes ~1 second on the SletScript Playground Online Python Interpreter {]
#OUTPUT_MODE NUMERIC
\#iters bf(
,. input a and print it
>,. input b and print it
<[->[->+>+<<]>>[-<<+>>]<<<] multiply
>>. print product
)[15 7]
.\@n.\@n.(Took ).iters.( iterations.).\@n
Lambda calculus interpreter
by User:Cycwin.
!lambda input\\l{!maxchr inpu\\l {\#counter 0 \#max 0 '-=counter*inpu\\n{
?=>*+inpu counter\\n max 1#max*+inpu counter\\n;
#counter +1counter
max
} max}
!alpha ori\\l rep\\l {\#counter 0 \# need []
'-=counter*ori\\n{
?=-4+++=+ori counter@λ=+ori counter@.=+ori counter@(=+ori counter@)?-=%rep+ori counter()#need+need[+ori counter];;
#counter+1counter
}
#counter 0
'-=counter*need\\n{
#rep":rep[+need counter][*+1maxchr+ori rep\\c];
#counter+1counter
}
rep
}
#input +input[@ ]
\#flam+%input@λ0
\#falf+input +flam 1
\#temp +flam 3
\#final ()
\#body ()
\#par 1
'-=0par{
?=@)+input temp #par +par-1;
?=@(+input temp #par +1par;
?-=0par#body+body[+input temp];
#temp +1temp
}
body
#par 1
#temp +1temp
\#arg ()
'-=0par{
?=@)+input temp #par +par-1;
?=@(+input temp #par +1par;
#arg+arg[+input temp]par
#temp +1temp
}
\#change+1\#counter #par 0
\#afinal()
'-=counter*body\\n{
#change 1
?=@)+body counter #par +par-1;
?=@(+body counter #par +1par;
?=1par{?=falf+body counter{#change 0
#afinal+afinal[*+1maxchr input\\c]};};
?change#afinal+afinal[+body counter];
#counter+1counter
}
\#body2 afinal
#arg +[@(]arg
\#arg2 alpha body2 arg
\#result":body2 [falf] arg2 ;
\#replaces++++++[@(](λ)[falf](.)body[@)]arg
#final":input replaces result;
#final":final +[@λ]arg2 +[@λ][falf];
final}
!isbeta b\\l {#b":b[@ ]();\#couner\#par 1'-=0par{?=@(+b couner#par+1par;
?=@)+b couner#par+-1par;
#couner+1couner}?=0>couner*b\\n1 -1}
!getline{\#i;'-=\@n#i,i}
\#r getline
isbeta ((λμ.μ))
'-isbeta r{.#r lambda r.\@n}
Game of Life on a torus
by User:Redstoneboi.
[} Conway's Game of Life but each grid row is a Base-18 number {]
\#BASE 18
\#RIGHT -1
!flatten l\\l "!o [] l r +o r
!pow base\\n exp\\n "!out 1 "+0 exp 1 i *out base
!sum list\\l "!acc 0 list num +acc num
!shl mid\\n list\\l ++list^mid; +list^;mid
!shr_num row\\n + "*row RIGHT *BASE %row RIGHT
!shl_num row\\n + "*row BASE *RIGHT %row BASE
!shr_grid grid\\l ~grid row shr_num row
!shl_grid grid\\l ~grid row shl_num row
!shu_grid grid\\l shl 1 grid
!shd_grid grid\\l shl-1 grid
!zip list\\l {
\#h<list
\#w<+list 0
~"+0 w 1 x
~"+0 h 1 y
++list y x
}
!map f\\f1 list\\l ~list item f item
!sum_grids grids\\l map \sum zip grids
!mul_grid n\\n grid\\l ~grid row *row n
!explode grid\\l {
\#l shl_grid grid
\#r shr_grid grid
[
shu_grid l
shu_grid grid
shu_grid r
l
mul_grid 9 grid
r
shd_grid l
shd_grid grid
shd_grid r
]
}
\#RULE [
0 0 0 1 0 0 0 0 0
0 0 1 1 0 0 0 0 0
]
\#W -1
\#H -1
\#GRID []
\#GENERATION 0
!new_grid w\\n h\\n {
#W w #H h
#GRID ~"+0 H 1 y "!r 0 "+0 W 1 x +*r BASE &0 1
#RIGHT pow BASE +W-1
}
!show_grid {
.(Generation ).GENERATION.\@n
~GRID old {
~"+0 W 1 x {
\#cur_old %old BASE
.|{+(.#)cur_old}{cur_old}
#old"*old BASE
.@
}
.\@n
}
.@ .\@n
}
!tick_and_show_grid {
#GENERATION+GENERATION 1
.(Generation ).GENERATION.\@n
#GRID sum_grids explode GRID
#GRID ~GRID old {
\#new 0
\#next 1
~"+0 W 1 x {
\#cur_old %old BASE
\#cur_new +RULE cur_old
.+(.#)cur_new
#new+new *next cur_new
#next*next BASE
#old"*old BASE
.@
}
.\@n
new
}
.@ .\@n
GRID
}
!sim gens\\n {
show_grid
~"+0 gens 1 i tick_and_show_grid
}
new_grid 16 16
sim 16
