Skip to content
This repository was archived by the owner on Sep 29, 2025. It is now read-only.

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.

Single Byte Nilads

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

Single Byte Monads

Character Function
~ Bitwise NOT
Square Root
Decrement
Increment
¹ Identity
² Square
! Factorial(z) if z is an integer and z > 0, -Factorial(abs(z)) if z is an integer and z < 0, Gamma(z + 1) otherwise
A Absolute Value
B Convert integer to binary
D Convert integer to decimal
List Partitions
E 1 if all elements are equal, otherwise 0
Ė Enumerate; push [[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
İ 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

Clone this wiki locally