-
Notifications
You must be signed in to change notification settings - Fork 0
Operators
João Pedro Neto edited this page Nov 9, 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 |
next char in codebase | Map ↑ a
|
successor |
↓ |
a -1 |
prev char in codebase | 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 |
Assuming b
as the top of the stack, a
below b
a×b |
Frac×Frac | Frac×Chr | Chr×Frac | Chr×Chr | Frac×List | List×Frac | Chr×List | List×Chr | List×List |
---|---|---|---|---|---|---|---|---|---|
↕ |
push a push b
|
ibid. | ibid. | ibid. | ibid. | ibid. | ibid. | ibid. | ibid. |
+ |
a+b |
u.a+cb |
u.ca+b |
u.ca+cb |
M +a b
|
M +b a
|
M +ca b
|
M +cb a
|
M + zip(a,b)
|
- |
a-b |
u.a-cb |
u.ca-b |
u.ca-cb |
M -a b
|
M -b a
|
M -ca b
|
M -cb a
|
M - zip(a,b)
|
`` | |||||||||
i |
a |
a |
a |
a |
a |
a a[b]
|
a |
a a[cb%la]
|
a a[b[:]%la]
|
`` |
push b
push b[a]
- 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