This repository was archived by the owner on Sep 29, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Functions
alexander-liao edited this page Oct 30, 2017
·
16 revisions
Functions operate on data, which can either be an argument or the result of another function.
| Character | Function |
|---|---|
® |
Retrieve the value from the register |
³ |
First input (third command line argument) or 100
|
⁴ |
Second input (fourth command line argument) or 16
|
⁵ |
Third input (fifth command line argument) or 10
|
⁶ |
Fourth input (sixth command line argument) or " "
|
⁷ |
Fifth input (seventh command line argument) or "\n"
|
⁸ |
Sixth input (eighth command line argument) or []
|
⁹ |
Seventh input (ninth command line argument) or 256
|
⍺ |
Left Argument or 0.1
|
⍵ |
Right Argument or 1 (TODO) |
π |
Pi |
| Character | Function |
|---|---|
~ |
Bitwise NOT |
√ |
Square Root |
‘ |
Decrement |
’ |
Increment |
¹ |
Identity |
² |
Square |
! |
Factorial(z) if z is a nonnegative integer, -Factorial(abs(z)) if z is a negative integer, Gamma(z + 1) otherwise |
A |
Absolute Value |
B |
Convert integer to binary |
Ḅ |
Convert binary to integer |
D |
Convert integer to decimal |
Ḋ |
List Partitions |
Ḍ |
Convert decimal to integer |
E |
1 if all elements are equal, otherwise 0 |
Ė |
Enumerate; returns [[1, z[1]], [2, z[2]], ...]
|
F |
Flatten list completely |
G |
Format as a grid |
H |
Convert integer to hexadecimal |
Ḣ |
Pop and return the first value of a list |
Ḥ |
Convert hexadecimal to integer |
İ |
Inverse; 1 / z for integers and upside-down (wherever applicable) for characters |
J |
Range of length (range(len(z))) |
L |
Length |
Ḷ |
Lowered Range; 0 .. z - 1
|
Ṇ |
Logical NOT; does not vectorize |
P |
Product |
Ṗ |
Permutations |
R |
Range; 1 .. z
|
S |
Sum |
Ṣ |
Sort a list |
Ṡ |
Sign of a real number or conjugate of a complex number |
T |
Indices of truthy elements |
Ṫ |
Pop and return the last value of a list |
Ṭ |
Return an array of 1 and 0 with 1 at the indices of z |
U |
Return the unique elements of z in order by their first occurrence |
W |
Wrap; return [z] |
Ẇ |
Sublists; return all contiguous subslices of z |
X |
Random element of a list, random integer in the range 1 .. z if z is an integer, random float from 0 to z if z is a float |
Ẏ |
Tighten; flatten by 1 level |
Z |
Integer Partitions; all lists of positive integers that sum to z |
∆ |
Deltas; return differences of consecutive pairs |
↔ |
Reverse each sublist to the last level |
↕ |
Reverse a list; does not vectorize |
¬ |
Logical NOT; vectorizes |
↙ |
Transpose a matrix |
↘ |
Anti-transpose a matrix |
↶ |
Rotate a matrix by 90 degrees |
↷ |
Rotate a matrix by -90 degrees |
↻ |
Rotate a matrix by 180 degrees |
⁽ |
Prefixes |
⁾ |
Suffixes |
| Character | Function |
|---|---|
_ |
Subtraction |
+ |
Addition |
± |
[x + y, x - y] |
* |
Exponentiation |
× |
Multiplication |
÷ |
Floating-Point Division |
: |
Integer Division |
% |
Modulus |
& |
Bitwise AND |
| ` | ` |
^ |
Bitwise XOR |
< |
Less-than |
≤ |
Less-than or equal |
= |
Equals; does not vectorize |
e |
Equals; vectorizes |
≈ |
Similar; same length if lists, within 1 of each other if numbers |
n |
Not Equals; vectorizes |
≠ |
Not Equals; does not vectorize |
≥ |
Greater-than or equal |
> |
Greater-than |
» |
Maximum |
« |
Minimum |
, |
Pair; return [x, y]
|
; |
Concatenate/Append |
· |
Dot Product |
← |
Rotate rows left |
→ |
Rotate rows right |
↑ |
Rotate left; does not vectorize |
↓ |
Rotate right; does not vectorize |
b |
Convert x to base y |
ḃ |
Convert x to bijective base y |
ċ |
Combinations of x with y elements |
ė |
1 if x is an element of y, otherwise 0 |
ẹ |
0 if x is an element of y, otherwise 1 |
g |
GCD |
ḣ |
Head; get first y elements of x |
ḥ |
Head; get all but last y elements of x |
j |
Join x with separator y |
l |
LCM |
m |
Modular; get every yth element of x. Append to its reverse if y is 0 |
ṁ |
Mold; shape the contents of x like y. Repeats elements of x if necessary |
r |
Range [x, y]
|
ṙ |
Range (x, y)
|
ṛ |
Range [x, y)
|
s |
Slice x into lists of length y |
ṡ |
Return overlapping slices of length y of x |
ŝ |
Slice x into y lists of similar length |
ṣ |
Split x at occurrences of y |
ṫ |
Tail; get all but first y elements of x |
ṭ |
Tail; get last y elements of x |
ẏ |
Flatten x by y layers |
z |
Zip x with filler y |
ż |
Zip; Interleave x with y |
ẓ |
Zip x with y |
| Character | Function |
|---|---|
ØX |
Random float in the range [0, 1)
|
| Character | Function |
|---|---|
ÆC |
Count primes up to (including) z |
ÆĊ |
Count composites up to (including) z |
ÆR |
Inclusive Prime Range |
ÆS |
Sine |
ÆṢ |
Arcsine |
ÆT |
Tangent |
ÆṬ |
Arctangent |
ÆA |
Cosine |
ÆẠ |
Arccosine |
Æs |
Sinh |
Æṣ |
Arcsinh |
Æa |
Cosh |
Æạ |
Arccosh |
Æt |
Tanh |
Æṭ |
Arctanh |
ÆṪ |
Totient |
ÆU |
Remove adjacent equal elements |
Æṁ |
Median |
Æṃ |
Mode |
Æm |
Arithmetic Mean |
Æ∆ |
zth triangular number |
Æσ |
Standard Deviation |