Skip to content

list

an ordered collection of values

1
# list
2
[1, 2, 3]
3
# a range
4
1..5[1, 2, 3, 4]
Example outputCtrl+Enter to run
1
# xs[i] and xs[a..b] pick items
2
[10, 20, 30][1]20
3
# xs.f(...) calls f with the list first
4
[3, 1, 2].sort[1, 2, 3]
Example outputCtrl+Enter to run
  • list convert to a list: a string’s characters, a map’s [key, value] pairs, a set’s items, a table’s rows as maps, or a copy of a list
  • exec run a program directly, without a shell, given as a list of its name and arguments
  • join join a list’s items into one string, with sep between them
  • grep the lines of a string, or items of a list, that contain pat
  • bytes a string’s UTF-8 bytes, bytes made from a list of integers 0-255, or an integer’s bytes
  • from_bytes a string from UTF-8 bytes, given as bytes or as a list of integers
  • byte_len how many bytes the text takes in UTF-8, rather than how many characters it has
  • hexdump bytes shown as a hex dump, like the xxd tool, or just n bytes around address at
  • entropy how unpredictable the bytes are (Shannon entropy)
  • crc32 the CRC-32 checksum, as an integer, the same one zip files and PNG images use
  • freq how often each symbol appears in s, as a table of symbol, count and percent, the most common first
  • ngrams every run of n symbols in s with how often it appears, as a table of gram and count, the most common first
  • ioc the index of coincidence of s: the chance that two symbols picked from it at random are the same
  • chi_squared how far the letters of s are from English letter frequencies, as a chi-squared value, where lower is closer
  • friedman the length of a repeating key, estimated from the index of coincidence by Friedman’s formula
  • key_lengths each key length up to max with the average index of coincidence of the columns it splits s into, as a table of length and ioc, the highest first
  • kasiski the Kasiski examination of s: runs of n symbols that appear more than once, and the key lengths their distances point to, as {repeats, factors}
  • analyze a quick look at the statistics of s, as a map of length, symbols, entropy, ioc, chi_squared, top and likely
  • aes_encrypt encrypt with AES, the standard block cipher, in mode “ecb”, “cbc”, “ctr” or “gcm”
  • aes_decrypt decrypt AES, the reverse of aes_encrypt with the same key, mode and IV
  • des_encrypt encrypt with DES, or Triple DES given a 16- or 24-byte key, in mode “ecb”, “cbc” or “ctr”
  • des_decrypt decrypt DES or Triple DES, the reverse of des_encrypt
  • chacha20 encrypt or decrypt with ChaCha20 (RFC 8439), a 32-byte key and a 12-byte nonce, as the same call does both
  • rc4 encrypt or decrypt with RC4, as the same call does both
  • len how many items a list, map or set has, characters a string has, or bytes a bytes value has
  • contains whether x is in v: text (or a regex match) in a string, an item in a list or set, or a key in a map
  • find the position of the first x in v, counting from 0, or nil if it isn’t there
  • count how many times x appears in a string or list
  • reverse reverse a string or list
  • sort a sorted copy, smallest first
  • sort_desc a sorted copy, largest first, with the function working as in sort
  • unique drop repeated items, keeping the first of each in its place
  • first the first item, or nil if the list is empty
  • last the last item, or nil if the list is empty
  • take the first n items or characters
  • drop everything except the first n items or characters
  • any whether at least one item passes the test f, or without f, whether any item is itself truthy
  • all whether every item passes the test f, or without f, whether every item is itself truthy
  • push add v to the end of the list, changing it, and return the list
  • pop take the last item off the list, changing it, and return that item, or nil if the list is empty
  • shift take the first item off the list, changing it, and return that item, or nil if the list is empty
  • unshift add v to the front of the list, changing it, and return the list
  • map a new list of f(item) for every item
  • filter keep only the items that pass the test f
  • reduce combine the items into one value
  • flatten replace each list inside the list with its items, one level deep
  • zip pair up items by position: the first of each list, then the second, and so on, stopping when the shortest list runs out
  • enumerate each item paired with its position, as [index, item], counting from 0
  • group_by sort items into groups by what f returns for each
  • count_by count items by what f returns for each
  • chunks split into lists of n items each, where the last one may be shorter
  • windows every run of n items in a row, sliding along one at a time: [1, 2, 3] with 2 gives [1, 2] and [2, 3]
  • rotate the list with its items shifted left by k places, the ones that fall off the front coming back at the end
  • step every nth item, starting with the first
  • from_entries a map from a list of [key, value] pairs, the reverse of entries
  • set a set of a list’s items or a string’s characters, or of all the arguments, with repeats dropped
  • cartesian every pair [x, y] with x from a and y from b
  • table a table from a list of maps, one map per row
  • to_csv CSV text from a table, a list of maps, or a list of lists
  • sparkline a chart one line tall: one bar character per number, the smallest number lowest and the largest highest
  • bars a horizontal bar chart
  • histogram split the range of the numbers into bins of equal width, count how many numbers fall in each, and draw the counts as bars
  • tree_view nested maps and lists drawn as a tree with branch lines, like the tree command draws folders
  • heatmap a grid of numbers, given as a list of rows, drawn as shades from ░ for the lowest to █ for the highest
  • sum add up a list, units included
  • avg the mean (average), or with weights, the mean where each item counts as many times as its weight
  • trimmed_mean the mean after dropping the lowest and highest fraction p of the items, so outliers count less
  • winsorized_mean the mean after replacing the lowest and highest fraction p of the items with the nearest items kept
  • product multiply all the items together
  • median the middle value once sorted, or with an even count, halfway between the middle two
  • mode the item that appears most often, or on a tie, the one that appears first
  • percentile the value p% of the way through the sorted data (p from 0 to 100), so the 90th percentile is above 90% of it
  • variance how spread out the numbers are
  • stdev how spread out the numbers are, in the same units as them
  • geo_mean the geometric mean: the nth root of the product, the right average for growth factors
  • harmonic_mean the harmonic mean: the reciprocal of the average reciprocal, the right average for rates
  • rms the root mean square: the square root of the average of the squares
  • mad the median absolute deviation: the median distance from the median, a spread that outliers barely move
  • sem the standard error of the mean: the standard deviation divided by the square root of the count
  • iqr the interquartile range: the 75th percentile minus the 25th
  • spread the largest minus the smallest (range makes a list of numbers)
  • cov the sample covariance of two lists: positive when they rise together
  • ranks each item’s place in the sorted order, starting at 1, with ties sharing the average place
  • spearman how closely two lists rise and fall together in order, not necessarily in a straight line (rank correlation)
  • min the smallest of a list, or of the arguments
  • max the largest of a list, or of the arguments
  • describe a summary in one map
  • corr how closely two lists rise and fall together (Pearson correlation)
  • fit the straight line y = slope × x + intercept that best fits the points (least squares), as {slope, intercept, r2}
  • zscore each item as how many standard deviations above (positive) or below (negative) the mean it is
  • normalize rescale the list so the smallest becomes 0, the largest 1, and the rest fall in between
  • cumsum running totals: each item plus everything before it
  • deltas the difference between each item and the one before
  • gcd greatest common divisor: the largest integer that divides all of them evenly
  • lcm least common multiple: the smallest positive integer they all divide evenly
  • permutations how many ways there are to pick k things from n when order matters, exact
  • perm the same as permutations
  • combinations every way to pick k of the list’s items when order doesn’t matter, each as a list in the original order
  • crt the number that leaves remainder rs[0] when divided by ms[0], rs[1] when divided by ms[1], and so on (the Chinese remainder theorem)
  • t_test whether two groups of measurements really differ, as a map with t, df and the two-sided p
  • paired_t_test whether paired measurements, like before and after, really differ, as a map with t, df and the two-sided p
  • from_digits put digits back together into a number, the reverse of digits
  • choice a random item from the list
  • shuffle a copy of the list in random order
  • dot the dot product: multiply matching items of two equal-length vectors and add the results
  • cross the cross product of two 3D vectors: a vector at right angles to both
  • norm the length of a vector: the square root of the sum of its squared items
  • transpose a matrix with its rows and columns swapped
  • matmul the matrix product of a and b, where a must have as many columns as b has rows
  • det the determinant of a square matrix
  • inv the inverse of a square matrix: the matrix that multiplies with it to give the identity
  • reshape the items of xs laid out as a matrix of the given rows and columns, filling row by row
  • row row i of matrix m, counting from 0
  • col column j of matrix m, counting from 0
  • hcat two matrices side by side, which need the same number of rows
  • vcat two matrices one above the other, which need the same number of columns
  • triple the scalar triple product of three 3D vectors, the signed volume of the box they span
  • rref the reduced row echelon form of a matrix: the simplest matrix its row operations can reach
  • rank the rank of a matrix: how many of its rows are independent of the others
  • cofactor the cofactor of m at row i and column j: the determinant of what is left without them, signed
  • adjugate the adjugate of a square matrix: the transposed cofactors, which divided by the determinant give the inverse
  • kron the Kronecker product of two matrices: every item of a times the whole of b, in blocks
  • permanent the permanent of a square matrix: the determinant without the alternating signs
  • solve solve linear equations: the list x for which matmul(a, x) gives b
  • solve_system the point where every function in fs is 0 at once, found from a starting guess (Newton’s method)
  • poly_eval the polynomial’s value at x, from its coefficients highest power first
  • poly_mul the product of two polynomials
  • poly_div divide polynomial a by b, giving the list [quotient, remainder]
  • poly_deriv the derivative of a polynomial, as a coefficient list
  • poly_roots every root of the polynomial, real or complex, found numerically
  • polygon_area the area of a polygon from its corners in order, each a list [x, y]
  • irr the rate at which a list of cash flows has a net present value of zero (internal rate of return), per flow period
  • clock the time right now in each zone or city
  • color a color in “#rrggbb” form, from a CSS name, “#rgb”, “#rrggbb” or a list [r, g, b]
  • rgb make a color from red, green and blue amounts (0-255), or give one argument to get a color’s three amounts
  • hsl make a color from hue, saturation and lightness, or give one argument to get a color’s three values
  • mix blend two colors, where t is how far to go from a toward b, 0 to 1
  • lighten make a color lighter, keeping its hue
  • darken make a color darker, keeping its hue
  • invert for a color, the opposite color on the color wheel, like white for black
  • grayscale the gray that looks as bright as the color does
  • contrast how readable one color is on the other, as the WCAG contrast ratio from 1 (identical) to 21 (black on white)
  • swatch a block of the color followed by its hex code, to preview it
  • animate play an animation in the terminal at fps frames a second
  • cards draw several playing cards side by side, written as for card
  • dice draw a die showing 1 to 6, or several side by side for a list

Example results generated on 2026-11-04. Ones using now, today or randomness will differ when you run them.