-
Notifications
You must be signed in to change notification settings - Fork 0
Tokens
okx-code edited this page Jun 5, 2017
·
74 revisions
Here's the list of tokens that manipulate items on the stack. Nilads take no values from the stack, monads take one, and dyads take two.
The general rule for the character chosen for a function:
- Nilad/general maths; standard alphabetical character
- Monad taking
int; uppercase bold - Monad taking
list; lowercase bold - Dyads; double struck
- Loops, conditionals etc; uppercase greek
- Variables; lowercase greek.
Special Cases:
- For certain characters, the
)character is not required at the end if the end is the end of the file.
Additionally, if a token takes a list but instead an int is popped, the int will be exploded into a list and vice versa.
| Token | Input | Function |
|---|---|---|
₁ |
Get first input line | |
₂ |
Get second input line | |
₃ |
Get third input line | |
Γ .. ) |
any | Perform the operation(s) .. on each element in the list.Implicit exclusive range if integer. |
Δ .. ) |
any | If integer, create inclusive range or if list, add one to each value. Then perform the operation(s) .. on each element. |
Θ |
Push currently looped value or 100 if not in loop |
|
Λ .. ) |
list | Keep those in the list where <elem> .. is equal to 1
|
Ξ .. ) |
any | If int and equal to 1, or if list and contains 1, do ..
|
Π |
any | Assign the next variable to the top value in the stack |
Σ .. ) |
list | Keep those in the list where <elem> .. is equal to 0
|
Φ |
Push index in loop or 256 if not in loop |
|
Ψ |
list | Apply the next token to each element in the list |
& .. ) |
Create a list of the elements pushed in ..
|
|
$ |
Wrap stack to array | |
( .. ) |
Decompress a base 255 string | |
) |
Close loop/conditional etc. | |
_ |
list | Push each element to the stack |
> |
int | Increment |
< |
int | Decrement |
B |
int | Compress a number into base 255 |
D |
any | Duplicate |
I |
Take one line of input | |
Q |
Terminate program | |
R |
Randomly choose 1 or 0 | |
U |
any | Duplicate from underneath: a, b -> a, b, a
|
c |
Infinite list of perfect numbers (0-indexed) | |
f |
Infinite list of fibonacci numbers (well, up until 2^63-1) |
|
p |
int | Infinite list of polygonal numbers with side length a. |
t |
Shortcut for 3p
|
|
q |
Shortcut for 4p
|
|
𝐀 |
int | Absolute |
𝐁 |
int | Calculate all possible substrings |
𝐂 |
int | Get the characters |
𝐄 |
int | Check for palindromity |
𝐅 |
int | Get all factors |
𝐈 |
int | Inclusive range: (0 .. n] |
𝐋 |
int | Get the first n primes |
𝐌 |
int | Check for primality |
𝐍 |
int | Compute -a
|
𝐎 |
int | Logical NOT (in Neim, only 1 is truthy) |
𝐏 |
int | Prime factors |
𝐐 |
any | Check that all elements are equal |
𝐑 |
int | Exclusive range: [0 .. n) |
𝐒 |
int | Create a singleton list out of this |
𝐓 |
int | Factorial |
𝐔 |
int | Unique prime factors |
𝐝 |
list | Get deltas (differences) between elements |
𝐠 |
list | Get greatest element |
𝐣 |
list | Join elements into an int
|
𝐥 |
list | Length |
𝐦 |
list | Get smallest element |
𝐨 |
list | Sort |
𝐩 |
list | Product |
𝐬 |
list | Sum |
𝐮 |
list | Uniquify |
𝔸 |
any, any | Append b to the end of a
|
𝔻 |
int, int | Add |
ℂ |
int, int | Check for coprimality |
𝔼 |
int, int | Check for equality |
𝕄 |
int, int | Modulo |
𝕆 |
int, int | Logical OR |
ℙ |
int, int | Get the ath polygonal number for a polygon with b sides. |
ℝ |
int, int | Repeat a, b times |
𝕊 |
int, int | Subtract |
𝕋 |
int, int | Multiply |
𝕍 |
int, int | Integer division |
𝕎 |
int, int | Power |
𝕏 |
int, int | [first .. second) |
𝕒 |
int, int | Logical AND |
𝕔 |
list, int | Get closest value to int in list
|
𝕕 |
int, list | Get the ath element of b. |
𝕖 |
list, int | Get first b elements of a
|
𝕗 |
list, int | Get last b elements of a
|
𝕘 |
list, int | Remove the first b elements of a
|
𝕘 |
list | Remove the first element of a
|
𝕙 |
list, int | Remove the last b elements of a
|
𝕙 |
list | Remove the last element of a
|
𝕚 |
int, list | Check that the int is in the list
|
𝕞 |
int, int | Check that a is a multiple of b
|
𝕣 |
int, int | Repeat b, a times |