Atoms - GolfingSuccess/jelly GitHub Wiki

Atoms

Atoms are Jelly's built-in links. z will denote the only argument of a monadic function, x and y the left and right argument of a dyadic one.

Jump to:
Single-byte nilads
Single-byte monads
Single-byte dyads
Ø atoms (assorted nilads)
Æ atoms (arithmetic monads)
æ atoms (arithmetic dyads)
Œ atoms (other monads)
œ atoms (other dyads)
ƒ atoms (custom)

Single-byte nilads

Symbol Function
® Restore; retrieve the value of the register. Initially 0.
³ Return the third command line argument (first input) or 100.
Return the fourth command line argument (second input) or 16.
Return the fifth command line argument (third input) or 10.
Return the sixth command line argument (fourth input) or ' '.
Return the seventh command line argument (fifth input) or '\n'.
Return the link's left argument or [].
Return the link's right argument or 256.
Ɠ Read and evaluate a single line from STDIN.
ƈ Read a single character from STDIN.
ɠ Read a single line from STDIN.

Single-byte monads

Symbol Function
¬ Logical NOT: if z is zero or empty, then 1, else 0.
½ Square root.
! Factorial or Pi function.
A Absolute value.
B Convert from integer to binary.
C Complement; compute 1 − z.
D Convert from integer to decimal.
E Check if all elements of z are equal.
F Flatten list.
G Attempt to format z as a grid.
H Halve; compute z ÷ 2.
I Increments; compute the differences of consecutive elements of z.
J Returns [1 … len(z)].
K Join z, separating by spaces.
L Length.
M Return all indices of z that correspond to maximal elements.
N Negative; compute −z.
O Ord; cast to number.
P Product of a list.
Q Return the unique elements of z, sorted by first appearance.
R Inclusive range [1 … z].
S Sum of a list.
T Return all indices of z that correspond to truthy elements.
U Upend; reverse an array.
V Eval z as Jelly code, with no arguments. If z is a list, it maps Python's str function to all of z's elements, concatenates them and then eval's the result. Vectorizes at depth 1.
W Wrap; return [z].
X Random; choose a random item from z if z is a list, or from 1 to z inclusive if z is a positive integer. If z = 0, return z. Error if z is negative or a decimal.
Y Join z, separating by linefeeds.
Z Zip; push the array of all columns of z.
~ Bitwise NOT.
° Convert z from degrees to radians.
¹ Identity; return z.
² Square.
All; return 0 if z contains a falsey value, else 1.
Convert from binary to integer.
Convert from decimal to integer.
Double; compute 2z.
Insignificant; return abs(z) ≤ 1.
Split z at spaces.
Lowered range; return [0 … z−1].
Minimum.
Logical NOT. Does not vectorize.
Chr; cast to character.
Reverse array Does not vectorize.
Sort the list z.
Return a Boolean array with 1's at the indices in z.
Grade the list z up, i.e., sort its indices by their values.
Uneval; right inverse of V.
Split z at linefeeds.
Ȧ Any and all; return 0 if z is empty or contains a falsey value, else 1.
Bit; return z % 2.
Ċ Ceil; round z up to the nearest integer. Imag. part for complex z.
Dequeue; return z[1:].
Ė Enumerate; return [ [1,y[1]] , [2,y[2]], ... ].
Floor; round z down to the nearest integer. Real part for complex z.
Ġ Group the indices of z by their corresponding values.
Head; pop and return the first element of z. Modifies z.
İ Inverse; compute 1 ÷ z.
Maximum.
Print z and a linefeed. Returns z.
Ȯ Print z. Returns z.
Pop; return z[:-1].
Print a string representation of z, without a linefeed. Returns z.
Sign of z. Conjugate for complex z.
Tail; pop and return the last element of z. Modifies z.
Sublists; all non-empty contiguous slices of z.
Shuffle; return a random permutation of z.
Increment; compute z + 1.
Decrement; compute z − 1.

Single-byte dyads

Symbol Function
× Multiplication.
÷ Floating point division.
% Modulus.
& Bitwise AND.
* Exponentiation with base x.
+ Addition.
, Pair; return [x, y].
: Integer division.
; Concatenate.
< If x is less than y, then 1, else 0.
= If x equals y, then 1, else 0. Vectorizes.
> If x is greater than y, then 1, else 0.
^ Bitwise XOR.
_ Subtraction.
a Logical AND. Vectorizes with depth 0.
b Convert from integer to base y.
c Combinations; compute xCy.
d Divmod.
e If x occurs in y, then 1, else 0.
f Filter; remove the elements from x that are not in y.
g Greatest common divisor (GCD, HCF).
i Find the first index of element y in list x, or 0.
j Join list x with separator y.
l Logarithm with base y.
m Modular; return every y th element of x. If y is zero, mirror: prepend x to its reverse.
n Not equals. If x equals y, then 0, else 1. Vectorizes.
o Logical OR. Vectorizes with depth 0.
p Cartesian product.
r Inclusive range. Descending if x > y.
s Split x into slices of length y.
t Trim all elements of y from both sides of x.
v Eval x as Jelly code, with argument y.
w Find the first index of sublist y within list x, or 0.
x Times; repeat the elements of x y times.
y Translate the elements of y according to the mapping in x.
z Zip; transpose x with filler y.
| Bitwise OR.
Equals. Does not vectorize.
Not equals. Does not vectorize.
Absolute difference.
Convert from base y to integer.
If x divides y, then 1, else 0.
Return the element of y at index x % len(y).
Left argument; return x.
Base decompression; convert x to base length(y) then index into y.
Order, multiplicity, valuation; how many times is x divisible by y?
Right argument; return y.
Split list x at occurrences of y.
Tack; append x to y.
ȧ Logical AND. Does not vectorize.
Convert from integer to bijective base y.
ċ Count the occurrences of y in x.
Filter; remove the elements from x that are in y.
Head; return x[:y].
Mold; reshape the content of x like the content of y. Reuses the content of x if necessary.
ȯ Logical OR. Does not vectorize.
Cartesian power.
Rotate x y units to the left.
Return all (overlapping) slices of length y of x.
Tail; return x[y - 1:].
Repeat list x y times.
Sublist exists; return 1 if x is a contiguous sublist of y, else 0.
ż Zip; interleave x and y.
« Minimum of x and y.
» Maximum of x and y.

Ø atoms (assorted nilads)

Symbol Function
ØA Alphabet; yield 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
ØB Base digits; yield '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.
ØC Consonants; yield 'BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz'.
ØD Digits; yield '0123456789'.
ØH Hexadecimal digits; yield '0123456789ABCDEF'.
ØJ Jelly's codepage.
ØP Pi
ØQ Qwerty; yield ['QWERTYUIOP', 'ASDFGHJKL', 'ZXCVBNM'].
ØV Yield 'ṘV' (a cheat for writing a quine.)
ØW Word; yield 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_'
ØY Consonants; yield 'BCDFGHJKLMNPQRSTVWXZbcdfghjklmnpqrstvwxz'.
Øa Alphabet; yield 'abcdefghijklmnopqrstuvwxyz'.
Øb Base64 digits; yield 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
Øc Vowels; yield 'AEIOUaeiou'.
Øe Euler's number
Øh Hexadecimal digits; yield '0123456789abcdef'.
Øp Phi (golden ratio)
Øq Qwerty; yield ['qwertyuiop', 'asdfghjkl', 'zxcvbnm'].
Øv Yield 'Ṙv'.
Øy Vowels; yield 'AEIOUYaeiouy'.

Æ atoms (arithmetic monads)

Symbol Function
Æ! Convert from integer to factorial base.
Æ¡ Convert from factorial base to integer.
Æ? Convert from integer to primorial base.
Æ¿ Convert from primorial base to integer.
ƽ Compute the integer square root of z.
ÆA Arccosine.
ÆC Count the primes less or equal to z.
ÆD Compute the array of z's divisors.
ÆE Compute the array of exponents of z's prime factorization. Includes zero exponents.
ÆF Compute z's prime factorization as [prime, exponent] pairs.
ÆN Generate the zth prime.
ÆP If z is a prime, then 1, else 0.
ÆR Range; generate all primes between 2 and z.
ÆS Sine.
ÆT Tangent.
Æc Carmichael function.
Æd Divisor count.
Æe Exponential function.
Æf Compute the array of primes whose product is z.
Æl Natural logarithm.
Æn Next; generate the closest prime strictly greater than z.
Æp Previous; generate the closest prime strictly less than z.
Ær Find the roots of a polynomial, given a list of coefficients.
Æs Divisor sum.
Æv Count distinct prime factors.
ÆẠ Cosine.
ÆḌ Proper divisors.
ÆẸ Inverse of ÆE.
ÆṢ Arcsine.
ÆṬ Arctangent.
ÆḊ Determinant. For non-square z, computes det(zzT)½; if z is a row vector, this is its norm.
ÆḞ Returns the zth item in the Fibonacci sequence.
ÆṪ Totient function.
Æḍ Proper divisor count.
Æṣ Proper divisor sum.
Æṛ Construct the polynomial with roots z. Returns list of coefficients.
ư Convert z from radians to degrees.
Ʋ If z is a square, then 1, else 0.

æ atoms (arithmetic dyads)

Symbol Function
æ. Dot product of two vectors (real/complex).
æ× Matrix multiplication.
æ% Symmetric modulo 2y; map x in the interval (−y, y]. Try 100Ræ%4 to get the hang of it.
æ* Matrix power.
æA Arctangent with two arguments, i.e., atan2().
æR Inclusive prime range, from x to y.
æi Modular inverse of x, modulo y, or if none exists, 0.
æl Lowest common multiple (LCM).
ær Round x to the nearest multiple of 10−y.
æp Precision; round x to y significant figures.
æċ Ceil x to the nearest power of y.
æḟ Floor x to the nearest power of y.
æ« Bit shift; compute x × 2y.
æ» Bit shift; compute x × 2−y. Returns an integer.

Œ atoms (other monads)

Symbol Function
Œ! All permutations of z. May contain duplicates.
Œ¿ Index of permutation z in a lexicographically sorted list of all permutations of z's items.
Œ? Shortest permutation of items [1,2,...,N] which would yield z via Œ¿.
ŒB Bounce; yield z[:-1] + z[::-1]. Vectorizes at depth 1.
ŒḄ Bounce; yield z[:-1] + z[::-1]. Does not vectorize.
ŒḂ Check if z is a palindrome. For integers, short for DŒḂ$.
ŒD Diagonals of a matrix. Starts with the main diagonal.
ŒG GET request z. http:// is prepended by default.
Œc Unordered pairs (œc2).
Œċ Unordered pairs with replacement (œċ2).
Œg Group runs of equal elements.
Œl Lower case.
Œr Run-length encode. “aab”Œr is [['a', 2], ['b', 1]].
Œṙ Run-length decode. Right inverse of Œr.
Œs Swap case.
Œt Title case.
Œu Upper case.
ŒP Powerset of z. May contain duplicates.
Œp Cartesian product of z's items.
ŒṖ Partition of z (z must be a list).
ŒḌ Reconstruct matrix from its diagonals.
ŒḊ Depth.
ŒR List from −abs(z) to abs(z) inclusive (shorthand for Ar@N$).
ŒṘ Python's string representation.
ŒT Format time: Let the last three bits of z be abc. If a is 1, include the time; if b is 1, include the minute; if c is 1, include the second.
ŒV Evaluate Python code z.

œ atoms (other dyads)

Symbol Function
œ& Multiset intersection.
œ- Multiset difference.
œ^ Multiset symmetric difference.
œ¿ Index of permutation x in a list of all permutations of x's items sorted by their index in y.
œ? Permutation at index x of the items in y (where y defines the sort order of those items).
œc Combinations without replacement.
œl Trim all elements of y from the left side of x.
œr Trim all elements of y from the right side of x.
œs Split x into y chunks of similar lengths.
œ| Multiset union.
œS After sleeping for y seconds, return x.
œṣ Split x around sublists equal to y.
œċ Combinations with replacement.
œṗ Partition y at all truthy indices of x.
œp Partition y at all truthy indices of x, without keeping the borders.
œṡ Split x at the first occurrence of y.

ƒ atoms (custom)

Symbol Function
ƒB Check if z is a palindrome.
ƒR Range; generate all primes between x and y.
⚠️ **GitHub.com Fallback** ⚠️