Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
371 lines (362 sloc) 12.1 KB
These are all the operations that have been defined so far. It is still very much a work in progress.
×
☻ : push 16
♥ : push 32
♦ : push 64
♣ : push 128
♠ : push 256
• : push 512
◘ : push 1024
○ : push 2048
◙ : push 4096
♂ : push 10
♀ : push 100
♪ : push 1000
♫ : push 10000
☼ : push 100000
► : push 1000000
◄ : push 10000000
↕ : push 100000000
‼ : apply next 2 operators to the stack separately
¶ : is_prime(n)
§ : get from array
▬ : pop a, b : push(b**a)
↨ : pop a, b, loop from a to b (inclusive)
↑ : while true without popping
↓ : while false without popping
→ : while true with pop
← : while false with pop
∟ : do while true without popping
↔ : do while false without popping
▲ : do while true with pop
▼ : do while false with pop
: space character
! : gamma(n+1), lowercase for strings
" : string notation
# : pop a, b : push(a**b)
$ : pop(a), push ord(a) or char(a)
% : modulo
&
' : push single character
( : decrement
) : increment
* : pop a, b : push(a*b)
+ : pop a, b : push(a+b)
, : pop a, b : push(b-a)
- : pop a, b : push(a-b)
. : pop a, b : push(b*a)
/ : pop a, b : push(a/b), split strings
0 : push
1 : push 1
2 : push 2
3 : push 3
4 : push 4
5 : push 5
6 : push 6
7 : push 7
8 : push 8
9 : push 9
:
; : discard TOS
< : pop(a, b), push(a<b), slicing for lists/strings
= : pop(a, b), push(a==b)
> : pop(a, b), push(a>b), slicing for lists/strings
? : rot3
@ : rrot3
A : push 11
B : push 12
C : push 13
D : push 14
E : push 15
F : push 17
G : push 18
H : push 19
I : push 20
J : push 21
K : push 22
L : push 23
M : push 24
N : push 25
O : push 26
P : push 27
Q : push 28
R : push 29
S : push 30
T : push 31
U : push 33
V : push 34
W : push 35
X : push 36
Y : push 37
Z : push 38
[ : start array
\ : swap top elements
] : end array / wrap stack in array
^ : zip top two elements on stack
_ : duplicate TOS
` : duplicate the top two items
a : wrap in array
b : push -1
c : push -2
d : push -3
e : push e (2.71828...)
f : pop a, push fibonacci(a)
g : pop a, (b), pop operator from code, filter
h : length of array/string without popping
i : convert to integer (implicit map)
j : read float from input
k : read integer from input
l : read string from input
m : explicit map
n : newline char, or map array with newlines
o : print TOS without popping
p : print with newline
q : print without newline
r : range(0, n)
s : sort(array)
t : unix timestamp as integer milliseconds
u : join with separator
v : random integer in [-2**31, 2**31-1]
w : random integer in range, random item from list
x : reverse int/array/string
y : join array without separator to string or number
z : reverse sort(array)
{ : start block or arbitrary length
|
} : end block
~ : evaluate string, dump array, negate integer
⌂ : asterisk character (for challenges where a printable character is needed)
Ç : inverted filter
ü : ceiling with implicit map
é
â : convert to binary
ä : convert from binary
à : convert to binary string
å : convert from binary string
ç : implicit faulty filter
ê : read entire input as int array
ë : read entire input as float array
è : read entire input as string array
ï : index of current loop, or length of last loop
î : index of current loop (1-based)
ì : get loop value in foreach loop
Ä : start block of length 1
Å : start block of length 2
É : start block of length 3
æ : start block of length 4
Æ : start block of length 5
ô : start block of length 6
ö : start block of length 7
ò : start block of length 8
û : start string of length 2
ù : start string of length 3
ÿ : start string of length 4
Ö
Ü
¢ : convert to/from hexadecimal
£ : length of array/string with pop
¥ : modulo 2
ƒ : random float in range [0,1]
á : sort by comparator
í : get total number of iterations of for loop
ó : pop(a), push(2**a)
ú : pop(a), push(10**a)
ñ : pop(a), push palindromize(a) string/list/number
Ñ : check if palindrome
ª : push [1]
º : push [0]
¿ : if/else (uses one of the next two characters/blocks in the code)
⌐ : rotate entire stack
¬ : rotate entire stack in reverse
½ : pop a : push(a//2 if int else a/2)
¼ : pop a : push(a//4 if int else a/4)
¡ : push a, b, push a != b
« : end compressed string (etaoinsrdluczbfp)
» : end compressed string (gwymvkxjqh ?*#.,)
░ : convert to string (implicit map)
▒ : split to list of chars/digits
▓ : get average of list
│ : get differences of list
┤ : pop from right of string/array
╡ : discard from right of string/array
╢ : start compressed string of length 2 (etaoinsrdluczbfp)
╖ : start compressed string of length 3 (etaoinsrdluczbfp)
╕ : start compressed string of length 4 (etaoinsrdluczbfp)
╣ : start compressed string of length 2 (gwymvkxjqh ?*#.,)
║ : start compressed string of length 3 (gwymvkxjqh ?*#.,)
╗ : start compressed string of length 4 (gwymvkxjqh ?*#.,)
╜ : else without if
╛ : if without else
┐ : push TOS-1 without popping
└ : push TOS+1 without popping
┴ : check if equal to 1
┬ : check if equal to 0
├ : pop from left of string/array
─ : flatten array
┼ : duplicate second item from top and push to top
╞ : discard from left of string/array
╟ : push 60
╚ : push 3600
╔ : push 86400
╩ : fetch single dictionary word (top 256)
╦ : fetch single dictionary word (all)
╠ : pop a, b, push b/a
═ : pad list elements to equal length
╧ : pop a, b, a.contains(b)
╨ : closest power of two above
╤ : range(-n, n+1)
╥ : closest power of two below
╙ : maximum of two elements, max of list, maximum by filter
╘ : discard everything in stack
╒ : range(1,n+1)
╓ : minimum of two elements, min of list, minimum by filter
╫ : left-rotate bits in int, list/str
╪ : right-rotate bits in int, list, str
┘ : convert to boolean
┌ : convert to inverted boolean
▄ : lowercase alphabet as string
▌ : prepend to start of list
▐ : append to end of list
▀ : unique elements of string/list
α : wrap last two elements in array
ß : wrap last three elements in array
Γ : wrap last four elements in array
π : pi (3.14159...)
Σ : sum(list), digit sum(int)
σ : remove leading zeroes
µ : swap array/string items
τ : tau (2*pi)
Φ : increment array/string item
Θ : decrement array/string item
Ω : center string/int
δ : capitalize string
∞ : pop a, push 2*a
φ : golden ratio (1.618...)
ε : reduce list with operator
∩ : pop a : push 1/a (implicit map)
± : absolute value
≥ : greater or equal, slicing for lists/strings
≤ : lesser or equal, slicing for lists/strings
⌠ : increment twice
⌡ : decrement twice
÷ : is divisible
° : is perfect square
∙ : triplicate TOS
· : quadruplicate TOS
√ : pop a : push(sqrt(a)), split string to list
ⁿ : pop a : push(a*a*a)
² : pop a : push(a*a)
■ : cartesian product with itself for lists, next collatz item for numbers
Þ : discard everything but TOS
Note: "x" means that there is an implementation for the operator in combination with the data type
i: integer
f: float
l: list
s: string
+-+-+-+-+
Monads: |i|f|l|s|
+-+-+-+-+
¶ : is_prime(n)/split string |x| |x|x| x
! : gamma(n+1), lowercase for strings |x|x|x|x| x
( : decrement |x|x|x| | x
) : increment |x|x|x| | x
f : pop a, push fibonacci(a) |x| |x| | x
h : length of array/string without popping | | |x|x| x
i : convert to integer (implicit map) |x|x|x|x| x
n : newline char, or map array with newlines | | |x| |
r : range(0, n) |x| |x| | x
s : sort(array) | | |x|x| x
w : random integer in range, random item from list |x| |x| | x
x : reverse int/array/string |x| |x|x| x
z : reverse sort(array) | | |x|x| x
~ : evaluate string, dump array, negate integer |x| |x|x|
â : convert to binary |x| |x| | x
ä : convert from binary |x| |x| | x
à : convert to binary string |x| |x| | x
å : convert from binary string |x| |x| | x
ç : implicit faulty filter |x|x|x|x|
¢ : convert to/from hexadecimal |x| |x|x| x
¥ : modulo 2 |x|x|x| | x
ó : pop(a), push(2**a) |x|x|x|x| x
ú : pop(a), push(10**a) |x|x|x|x| x
ñ : pop(a), push palindromize(a) |x| |x|x| x
Ñ : check if palindrome |x| |x|x| x
½ : pop a : push(a//2 if int else a/2) |x|x|x| | x
¼ : pop a : push(a//4 if int else a/4) |x|x|x| | x
░ : convert to string (implicit map) |x|x|x| | x
▒ : split to list of chars/digits |x| |x|x| x
┤ : pop from right of string/array | | |x|x| x
╡ : discard from right of string/array | | |x|x| x
┐ : push TOS-1 without popping |x|x|x|x| x
└ : push TOS+1 without popping |x|x|x|x| x
├ : pop from left of string/array | | |x|x| x
╞ : discard from left of string/array | | |x|x| x
─ : flatten array/ get divisors |x| |x| | x
╦ : fetch single dictionary word (all) |x| |x| | x
╨ : closest power of two above |x|x|x| | x
╤ : range(-n, n+1) |x| |x| | x
╥ : closest power of two below |x|x|x| | x
╒ : range(1,n+1) |x| |x| | x
╫ : left-rotate bits in int, list/str |x| |x|x| x
╪ : right-rotate bits in int, list, str |x| |x|x| x
┘ : convert to boolean |x|x|x|x| x
┌ : convert to inverted boolean |x|x|x|x| x
▀ : unique elements of string/list | | |x|x| x
Σ : sum(list), digit sum(int) |x| |x| | x
σ : remove leading zeroes, sign of int/float | | |x|x| x
δ : capitalize string | | |x|x| x
∞ : pop a, push 2*a |x|x|x| | x
ε : reduce list with operator | | |x| |
⌠ : increment twice |x|x|x|x| x
⌡ : decrement twice |x|x|x|x| x
° : is perfect square |x| |x| | x
√ : pop a : push(sqrt(a)), split string to list |x|x|x|x| x
ⁿ : pop a : push(a*a*a) |x|x|x| | x
² : pop a : push(a*a) |x|x|x| | x
■ : cartesian self-product, next collatz |x| |x| | x
+-+-+-+-+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|i|i|i|i|f|f|f|f|l|l|l|l|s|s|s|s|
Dinads: |i|f|l|s|i|f|l|s|i|f|l|s|i|f|l|s|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
§ : get from array, concatenate |x| |x|x| | | | |x| | | |x| | | |
# : pop a, b : push(a**b) |x| |x| | | | | |x| | | | | | | |
% : modulo |x| |x|x| | | | |x| | | | | | | |
* : pop a, b : push(a*b) |x| |x|x| | | | |x| |x|x|x| | | |
+ : pop a, b : push(a+b) |x| |x|x| | | | |x| |x|x|x| |x|x|
- : pop a, b : push(a-b) |x| |x| | | | | |x| |x| | | | | |
/ : pop a, b : push(a/b) |x| |x| | | | | |x| |x| | | | | |
< : pop(a, b), push(a<b) |x| | | | | | | | | | | | | | | |
= : pop(a, b), push(a==b) |x| | | | | | | | | | | | | | | |
> : pop(a, b), push(a>b) |x| | | | | | | | | | | | | | | |
g : pop a, (b), pop op from code, filter | | | | | | | | | | | | | | | | |
m : explicit map | | | | | | | | | | | | | | | | |
u : join with separator | | | | | | | | | | |x|x| | |x|x|
¡ : push a, b, push a != b |x| | | | | | | | | |x| | | | |x|
▌ : prepend to start of list | | |x| | | | | |x| | |x| | |x| |
▐ : append to end of list | | |x| | | | | |x| | |x| | |x| |
Φ : increment array/string item | | |x|x| | | | |x| | | |x| | | |
Θ : decrement array/string item | | |x|x| | | | |x| | | |x| | | |
÷ : is divisible |x| |x| | | | | |x| | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
TODO:
make ` work with implicit input
make dictionary fetches work with strings, and have it wrap around (perhaps one more operator for dictionary)
equality operators without popping?
add more flags for different behavior (double math, non-popping, etc)?
Make loop operators close loops (will only work for while/do-while)
Restructure input operators, just one to read next input
transpose operator for 2D lists and lists of strings/2D strings
DONE:
implement sign operator
make halve/quarter work with strings/lists
fix flatten operator to work with deeper nesting
lowercase mapping for strings
Operator which applies next 2 commands to TOS
You can’t perform that action at this time.