-
Notifications
You must be signed in to change notification settings - Fork 0
Operators
João Pedro Neto edited this page Nov 10, 2020
·
38 revisions
check notes below for table interpretation
Action | Observations | |
---|---|---|
🡔 |
pass | stack pop |
🡖 |
push size of stack | size of stack |
🡗 |
stack = [] | clear stack |
½ |
1/2 |
push one half |
ẹ |
while stack not empty: result += pop push result
|
collapse stack content into a list |
¶ |
pass | outputs a newline |
Ȧ |
"abc...z" |
push lowercase alphabet |
Ạ |
"ABC...Z" |
push uppercase alphabet |
`` |
Assuming a
as the top of the stack
Fraction | Character | List | Observations | |
---|---|---|---|---|
, |
a |
a |
a |
output top |
. |
a |
a |
a |
output top and newlines |
↑ |
a +1 |
Map ↑ a
|
Map ↑ a
|
successor |
↓ |
a -1 |
Map ↓ a
|
Map ↓ a
|
predecessor |
🡕 |
push a twice |
ibid. | ibid. | duplicate top |
! |
Factorial of a
|
Factorial of ca
|
Map ! a
|
factorial function |
ṗ |
a -th prime |
ca -th prime |
Map ṗ a
|
get n-th prime |
p |
is a prime? |
is ca prime? |
Map p a
|
isPrime predicade |
l |
1 | 1 | length of a
|
length of data |
L |
[a ] |
a |
Map L a
|
make list of top |
… |
[0,1,...,↓a ] |
['a',..., ↓a ] if a lowercase['A',..., ↓a ] if a uppercase['0',..., ↓a ] if a is digit |
Map … a
|
range from 0 to a exclusive |
┅ |
[1,...,a ] |
['a',...,a ] if a lowercase['A',..., a ] if a uppercase['1',..., a ] if a is digit |
Map ┅ a
|
range from 1 to a inclusive |
ė |
a |
a |
for x in a push a
|
split list into single elements |
ḣ |
pass | pass | a[0] |
head of list |
ṫ |
pass | pass | a[1:] |
tail of list |
ḥ |
pass | pass | a[-1] |
last of list |
ṭ |
pass | pass | a[:-1] |
init of list |
ḷ |
1/a if a ≠0 else 1 |
a |
a[::-1] |
invert list |
Ḷ |
for i in range(a) result += pop push result
|
-- | -- | pops a elems from stack and list them |
ȧ |
b.insert(0,a) push b
|
ibid. | ibid. | add element at list's head |
ạ |
b.append(a) push b
|
ibid. | ibid. | add element at list's end |
`` |
Assuming b
as the top of the stack, a
below b
a×b |
Frac×Frac | Frac×Str | Str×Frac | Str×Str | Frac×List | List×Frac | Str×List | List×Str | List×List |
---|---|---|---|---|---|---|---|---|---|
↕ |
push a push b
|
ibid. | ibid. | ibid. | ibid. | ibid. | ibid. | ibid. | ibid. |
+ |
a+b |
M a+ b
|
M +b a
|
ab |
M a+ b
|
M +b a
|
M a+ b
|
M +b a
|
M + zip(a,b)
|
- |
a-b |
M -a b
|
M -b a
|
M ca-cb zip(a,b)
|
M a- b
|
M -b a
|
M a- b
|
M -b a
|
M - zip(a,b)
|
* |
a*b |
bbb...b |
aaa...a |
a×b |
M a* b
|
M *b a
|
M a* b
|
M *b a
|
M * zip(a,b)
|
÷ |
|||||||||
% |
|||||||||
/ |
|||||||||
^ |
|||||||||
B change base |
int(a,b) |
[int(a,bi)] |
int(a,b) |
[int(a,bi)] |
[int(a,bi)] |
[int(ai,b)] |
M aB b
|
[int(ai,b)] |
M B zip(a,b)
|
E |
|||||||||
i |
a |
a |
a |
a |
a |
a a[b]
|
a |
a a[cb%la]
|
a a[b[:]%la]
|
î |
same as i but pops the list |
||||||||
`` |
- Operator
×
is the cartesian product - c(char) is the value of char in the codebase; ca means c(a)
- u(n) is the char with codebase n; ua means u(a)
- l(list) is the size of the list; la means l(a)
- Fraction
x
rounds to⌊x⌋
when needed as int - Predicades push
1
for True,0
for False -
Map op
/M op
means map operationop
over elements of String/List (recursively with lists of lists) - Unless stated otherwise,
- operators initially pop values
a
,b
- character operators consider a circular codebase; eg. i=(i+1)%256
- zip functions cycle the smaller list
- operators initially pop values