-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvexoperators.txt
197 lines (179 loc) · 4.07 KB
/
convexoperators.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
Misc Operators:
! - boolean NOT
# - power, find index
$ - copy from stack, sort
% - mod, split, map
& - bitwise AND, set intersection, if-then
( - decrement, uncons from left
) - increment, uncons from right
* - multiply, join, repeat, fold (reduce)
+ - add, concat
, - range([0,N)), length, filter
- - subtract, remove
. - vectorize
/ - divide, split, each
: - set variable, quick map, quick fold
; - pop and discard
< - compare (less), slice before
= - compare (equal), get array item, find value
> - compare (greater), slice from
? - if (ternary)
@ - rotate top 3 elements on the stack
[ - start array
\ - swap top 2 elements on the stack
] - end array
^ - bitwise XOR, symmetric difference
_ - duplicate top element on the stack
` - string representation
a - wrap in array
b - base conversion
c - convert to char
d - convert to double
f - for loop, map with extra parameter
g - do-while loop that pops the condition, signum
h - do-while loop that leaves the condition on the stack
i - convert to integer
j - memoized recursion
l - read line
o - print
p - print string representation and newline
q - read the whole input
r - read token (whitespace-separated)
s - convert to string (char array)
t - set array item
w - while loop
z - zip (transpose), abs
| - bitwise OR, set union, if-else
~ - bitwise NOT, eval, dump array
¡ - factorial
½ - halve (n/2)
² - square (n^2)
³ - cube (n^3)
± - flip sign, change case
° - convert to degrees
þ - convert to radians
¹ - reciprocal (1/n)
¬ - floor, lowercase
¯ - ceiling, uppercase
¶ - pair
µ - nth prime
Ð - GCD
´ - range ((0,N])
æ - double duplicate
Û - type equality (typeof(a)==typeof(b))
× - fold with multiplication
ª - fold with addition
¿ - true if 0 or 1, reverse without popping
Å - unique list
Ä - connected unique list
¥ - reverse array
Ø - string formatting
£ - random
Ë - transliteration
« - min
» - max
¸ - LCM
¦ - Double
à - input line and eval
 - input all and eval
Ê - command line args (list)
ê - command line args (separate)
"Array" 2-char Operators:
e followed by numeric literal - scientific notation
e! - unique permutations
e# - line comment (not really an operator)
e% - string formatting a la printf
e& - logical and
e* - repeat each item in an array
e< - min of 2 values
e= - count occurrences
e> - max of 2 values
e[ - pad array to the left
e\ - swap 2 array items
e] - pad array to the right
e_ - flatten array
e` - RLE encode
ea - command-line args
ed - debug (show stack contents)
ee - enumerate array
el - lowercase
er - transliteration (element replacement)
es - timestamp (milliseconds from the epoch)
et - local time
eu - uppercase
ew - overlapping slices
e| - logical or
e~ - RLE decode
"Math" 2-char Operators:
m followed by numeric literal - subtract/remove (same as "-" but avoids the need for a space after it)
m! - factorial, permutations with duplicates
m* - cartesian product, cartesian power
m< - bit shift, rotate left
m> - bit shift, rotate right
mC - arccos
mF - factorization with exponents
mL - log with base
mO - round with precision
mQ - integer square root
mR - random choice
mS - arcsin
mT - arctan
m[ - floor
m] - ceil
ma - atan2
mc - cos
md - divmod
me - exp
mf - factorization
mh - hypot
ml - ln (natural logarithm)
mo - round
mp - prime
mq - sqrt
mr - random number, shuffle
ms - sin
mt - tan
Regex Operators:
® - start regex literal (ended by ")
þ - convert string to regex type
ø - first match
ð - amount of matches
ô - array of matches
õ - indexes of matches
ò - replace all occurances
ó - replace first occurance
ö - split
Quaternion/Imaginary Number Operators:
¤ - convert string/list to quaternion
n - norm of quaternion
String Compression Operators:
Ö - compress string
Ü - decompress string
Variables:
A=10
B=11
C=12
D=13
E=14
F=15
G=16
H=17
I=18
J=19
K=20
L="" (same as [])
M=""
N="\n" (newline string)
O=""
P=pi (3.141592653589793)
Q=""
R=0
S=" " (space)
T="abcdefghijklmnopqrstuvwxyz" (lowercase letters)
U="ABCDEFGHIJKLMNOPQRSTUVWXYZ" (uppercase letters)
V="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" (uppercase and lowercase letters)
W=-1
X=1
Y=2
Z=3
¢=phi (1.618033988749895)