-
Notifications
You must be signed in to change notification settings - Fork 47
Atoms
Raghu Ranganathan edited this page Jan 25, 2021
·
106 revisions
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)
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. |
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. |
Ẹ |
Any; return 1 if z contains a truthy value, else 0. |
Ḥ |
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 z. Does not vectorize. |
Ṣ |
Sort the list z. |
Ṭ |
Return a Boolean array with 1s at the indices in z. |
Ụ |
Grade the list z up, i.e., sort its indices by their corresponding values. |
Ṿ |
Uneval; right inverse of V . |
Ẉ |
Get the length of each element of z. |
Ỵ |
Split z at linefeeds. |
Ẓ |
If z is a prime, then 1, else 0 (alias for ÆP ). |
Ȧ |
Any and all; return 0 if z is empty, or contains a falsey value when flattened, 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;Reciprocal; 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. |
Ẏ |
Tighten; dump all lists inside z. |
Ż |
Prepend 0 to z. For integers, return [0 … z]. |
§ |
Sum. Vectorizes at depth 1. |
Ä |
Cumulative sum. Vectorizes at depth 1. |
‘ |
Increment; compute z + 1. |
’ |
Decrement; compute z − 1. |
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. |
k |
Partition y after truthy indices of x. |
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 indices of all occurrences of y in x. |
ḥ |
Jelly hash function. x contains a magic number (akin to a salt, can also be a base-250 compressed integer as a string) concatenated with a collection of values. If there are more than two items in x, all but the first are concatenated into a single collection. If there are two items and the second is a number N, the range [1,N] is used as the collection. y is the input to the hash function. Depending on the resulting hash, an item from the collection is returned. |
ị |
Return the element of y at index x % len(y). If floor(x) and ceil(x) aren't equal, return the elements of y at indices floor(x) % len(y) and ceil(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. |
ḋ |
Dot product of two vectors (real/complex). Right pads the shorter argument with 0 . |
ḟ |
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:] . |
ẇ |
Sublist exists; return 1 if x is a contiguous sublist of y, else 0. |
ẋ |
Repeat list x y times. |
ż |
Zip; interleave x and y. |
« |
Minimum of x and y. |
» |
Maximum of x and y. |
Symbol | Function |
---|---|
ؽ |
Yield [1, 2] . |
Ø% |
Yield 4294967296 (232). |
Ø( |
Parentheses; yield '()' . |
Ø+ |
Signs; yield [1, -1] . |
Ø- |
Signs; yield [-1, 1] . |
Ø. |
Bits; yield [0, 1] . |
Ø0 |
Zeroes; yield [0, 0] . |
Ø1 |
Ones; yield [1, 1] . |
Ø2 |
Twos; yield [2, 2] . |
Ø< |
Angle brackets; yield '<>' . |
ØA |
Alphabet; yield 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' . |
ØB |
Base digits; yield '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' . |
ØḄ |
Consonants; yield 'bcdfghjklmnpqrstvwxyz' . |
ØḂ |
Consonants; yield 'BCDFGHJKLMNPQRSTVWXYZ' . |
ØC |
Consonants; yield 'BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz' . |
ØD |
Digits; yield '0123456789' . |
ØH |
Hexadecimal digits; yield '0123456789ABCDEF' . |
ØJ |
Yield 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' . |
Ø[ |
Square brackets; yield '[]' . |
Ø^ |
Slashes; yield '/\'
|
Ø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' . |
Ø{ |
Curly brackets; yield '{}' . |
Ø° |
Yield 360 . |
Ø⁵ |
Yield 250 (Jelly's integer compression base). |
Ø⁷ |
Yield 128 (27). |
ØẠ |
Alphabet; yield 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' . |
ØỴ |
Consonants; yield 'bcdfghjklmnpqrstvwxz' . |
Øẹ |
Vowels; yield 'aeiou' . |
Øỵ |
Vowels; yield 'aeiouy' . |
ØṖ |
Yield the set of printable ASCII chars. |
ØẎ |
Consonants; yield 'BCDFGHJKLMNPQRSTVWXZ' . |
Øė |
Vowels; yield 'AEIOU' . |
Øẏ |
Vowels; yield 'AEIOUY' . |
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 (has the shorter alias Ẓ ). |
Æ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. |
Æi |
Separate a number z into [real(z), imag(z)]. |
Æị |
Combines the first two elements of a list into a complex number, z[0] + 1j*z[1]. Missing values are replaced with zeroes and extra values are truncated. |
Æl |
Natural logarithm. |
Æm |
Arithmetic mean. |
Æ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. |
ÆĊ |
Returns the zth Catalan number |
ÆḌ |
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. |
ÆĿ |
Returns the zth Lucas number |
ÆṪ |
Totient function. |
Æḍ |
Proper divisor count. |
Æṃ |
Mode. Vectorizes. |
Æṛ |
Construct the polynomial with roots z. Returns list of coefficients. |
Æṣ |
Proper divisor sum. |
Æṭ |
Trace. |
Æṁ |
Median. Vectorizes. |
Æ° |
Convert z from radians to degrees. |
Ʋ |
If z is a square, then 1, else 0. |
Symbol | Function |
---|---|
æ. |
Dot product of two vectors (real/complex). Right pads the shorter argument with 1 . |
æ× |
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() . |
æC |
Convolution power. |
æR |
Inclusive prime range, from x to y. |
æc |
Convolution of x and y. |
æi |
Modular inverse of x, modulo y, or if none exists, 0. |
æị |
Combines x and y into a complex number as x + 1j*y. |
æ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. |
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. |
ŒĖ |
Multidimensional enumerate. |
ŒG |
GET request z. http:// is prepended by default. |
ŒĠ |
Group multidimensional indices by their corresponding values. |
ŒH |
Split z into two halves with similar length. |
ŒJ |
Multidimensional indices of z. |
Œb |
Like ŒṖ , but returns [[]] for the empty list. |
Œc |
Unordered pairs (œc2 ). |
Œċ |
Unordered pairs with replacement (œċ2 ). |
Œd |
Antidiagonals of a matrix. Starts with the main antidiagonal. |
Œḍ |
Reconstruct matrix from its antidiagonals. |
Œg |
Group runs of equal elements. Vectorizes at depth 1. |
Œɠ |
Group run lengths. Does not vectorize. |
Œl |
Lower case. |
ŒM |
Return all multidimensional indices of z that correspond to maximal elements. |
Œœ |
Odd-even. Same as s2Z . [1, 2, 3, 4] gives [[1, 3], [2, 4]] . |
Œr |
Run-length encode. “aab”Œr is [['a', 2], ['b', 1]] . |
Œṙ |
Run-length decode. Right inverse of Œr . |
Œs |
Swap case. |
Œt |
Title case. |
ŒỤ |
Grade the multidimensional array z up, i.e., sort its multidimensional indices by their corresponding values. |
Œ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). |
Œṗ |
Integer partitions of z (ways to sum positive integers to z) |
ŒḌ |
Reconstruct matrix from its diagonals. |
ŒḊ |
Depth. |
ŒQ |
Distinct sieve. (Replace each first occurrence of a value with 1, and all later occurrences with 0.) |
Œ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. |
ŒṪ |
Return all multidimensional indices of z that correspond to truthy elements, with depth 0. |
ŒṬ |
Return a multidimensional rectangular boolean array with 1s at the indices in z. |
ŒV |
Evaluate Python code z. |
Symbol | Function |
---|---|
œ! |
Permutations without replacement. |
œ& |
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. |
œẹ |
Return the multidimensional indices of all occurrences of y in x. |
œi |
Find the first multidimensional index of element y in x. Returns empty list if there are no occurrences. |
œị |
Element of y at multi-dimensional index x. If x is empty, return y. Otherwise, y is replaced by its element at index x[0] (behaves like ị ), x is replaced by x[1:], and the procedure is repeated. |
œ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 the indices in x. |
œṗ |
Partition y before truthy indices of x. |
œP |
Partition y at the indices in x, without keeping the borders. |
œp |
Partition y at truthy indices of x, without keeping the borders. |
œṡ |
Split x at the first occurrence of y. |