-
Notifications
You must be signed in to change notification settings - Fork 0
Commands
Victor Dumbrava edited this page Mar 17, 2018
·
12 revisions
Note that n represents the only argument of a function of arity 1, a and b represent the arguments of function of arity 2. Here is a list of Triangularity commands:
Symbol | Function | Notes / Usage Rules |
---|---|---|
! |
Logical negation of n. | – |
" |
Begin and end a string literal. | The whole string must be on the same line. There cannot be any " s in a string literal. |
) |
Push a 0 onto the stack. | Precedes an integer literal. |
+ |
Addition. Return a + b. | – |
/ |
Division. Return b / a. | – |
< |
Check whether b < a. | – |
= |
Check whether b equals a. | – |
> |
Check whether b > a. | – |
@ |
Increment. Return n + 1. | – |
^ |
Exponentiation. Push ba. | – |
_ |
Negative. Return - n. | – |
` |
Cast to string. Return str(n). | – |
C |
Count the occurrences of b in a. | – |
E |
Evaluate n. eval in Python. |
– |
I |
Input at index n. | Modular, 0-based. |
J |
Join a with separator b. | – |
L |
Length. Return len(n). | – |
O |
Sort. Return an ordered version of n. | – |
R |
Reverse. Push n reversed. | – |
c |
Chr (from ASCII value to character). Push chr(n). | Uses Python's built-in. |
d |
Divisors. | Only includes positive divisors. |
e |
Dumps all contents separately onto the stack. | – |
f |
Cast to an integer. Trims decimals. | – |
h |
Head. Return b[:a] . |
0-based. |
i |
Read all STDIN. | – |
l |
Return the indices of b where a occurs. | 0-based. |
m |
Indexing. Return b[a % len(b)] . |
Modular, 0-based. |
o |
Ord (from character to ASCII value). Push ord(n). | Uses Python's built-in. |
p |
Check whether n is prime. | – |
r |
List the integers in the range [b, a). | – |
t |
Tail. Return b[a:] . |
0-based. |
u |
Sum. Return the sum of n. | – |
w |
Wrap into an array. Return [n]. | – |
Symbol | Function |
---|---|
D |
Duplicate. Push n, n. |
P |
Pop. Discard n. |
W |
Wrap stack to an array. Return [stack]. |
s |
Swap. Push b, a. |