Packages

Packages you can install with cresset install. This registry is a plain folder of files served by this site, and every package in it is checked by its own tests before it is published. Installing shows you the permissions a package needs before you use it, and these are all pure: they can't read your files or use the network at all.

Every package here is released under the Apache License 2.0, like Cresset itself.

See the registry docs for how installing, publishing and the lock file work. The registry's address is https://cressetlang.org/registry, and you can browse the files directly: index.json.

stats 1.0.0

simple statistics for lists of numbers.

Permissions it needs: nothing (it is pure) · read the source · SHA-256 ec9ca8a83d14…

cresset install stats --registry https://cressetlang.org/registry
What it provides (9)
record Summary { count: num, mean: num, median: num, low: num, high: num, stdev: num }
mean(xs) -> result[num]
median(xs) -> result
mode(xs) -> result
the most common value; when several tie, the smallest
variance(xs) -> result[num]
variance of the whole list (divides by the count, not count - 1)
stdev(xs) -> result[num]
min_max(xs) -> result[list]
percentile(xs, p) -> result[num]
the p-th percentile, 0 to 100, with values between neighbours worked out in a straight line
summarize(xs) -> result[Summary]

textkit 1.0.0

everyday text helpers.

Permissions it needs: nothing (it is pure) · read the source · SHA-256 c3931d6e42f6…

cresset install textkit --registry https://cressetlang.org/registry
What it provides (11)
slugify(text) -> text
"Hello, World!" becomes "hello-world": lowercase, with runs of anything else turned into one dash
truncate(text, limit, ending = ...)
cut text down to at most `limit` characters, ending in `ending` when something was cut off
wrap(text, width) -> list
break text into lines of at most `width` characters, splitting only between words
words(text)
word_count(text)
center(text, width, fill = ...)
put `text` in the middle of a field `width` wide
indent(text, spaces = ...)
put `spaces` spaces in front of every line
capitalize(text)
camel_case(text) -> text
"hello big world" becomes "helloBigWorld"
snake_case(text)
"Hello Big World" becomes "hello_big_world"
is_palindrome(text) -> bool
does it read the same backwards, ignoring case, spaces and punctuation?

listkit 1.0.0

helpers for working with lists.

Permissions it needs: nothing (it is pure) · read the source · SHA-256 85f7b19cf1ca…

cresset install listkit --registry https://cressetlang.org/registry
What it provides (10)
windows(items, size) -> list
every run of `size` neighbouring items
pairwise(items) -> list
pairs of neighbours: [1, 2, 3] becomes [[1, 2], [2, 3]]
rotate(items, steps)
move items around the end: rotate([1, 2, 3, 4], 1) is [2, 3, 4, 1]
product(items) -> num
cartesian(a, b) -> list
every pairing of an item from `a` with one from `b`
transpose(rows) -> list
rows become columns
flatten_deep(items) -> list
lists inside lists inside lists, all flattened into one
frequencies(items) -> map
a map of each distinct item to how many times it appears
range_step(start, stop, step) -> list
numbers from `start` up to (not including) `stop`, `step` apart; a negative step counts down
best_by(items, score)
the item `score` likes best (the first one, when there is a tie), or none for an empty list

csvkit 1.0.0

read and write CSV text, including quoted fields.

Permissions it needs: nothing (it is pure) · read the source · SHA-256 7a0545e47dba…

cresset install csvkit --registry https://cressetlang.org/registry
What it provides (4)
parse(text, separator = ...) -> result[list]
Text becomes a list of rows, each a list of text fields. Handles "quoted, fields", "" for a quote inside quotes, line breaks inside quotes, and both \n and \r\n line endings. An err comes back when a quote is never closed.
with_header(rows) -> result[list]
rows with a header line become a list of maps: [{"name": "Ada", "score": "90"}, ...]
needs_quotes(field, separator)
stringify(rows, separator = ...) -> text
the other way: rows become CSV text, quoting only the fields that need it

datekit 1.0.0

calendar dates and the arithmetic on them.

Permissions it needs: nothing (it is pure) · read the source · SHA-256 8c3710a43991…

cresset install datekit --registry https://cressetlang.org/registry
What it provides (13)
is_leap(year) -> bool
days_in_month(year, month) -> num
is_valid(year, month, day) -> bool
to_days(date) -> num
whole days since 1970-01-01 (negative before it)
from_days(days) -> list[num]
the date that many days since 1970-01-01
add_days(date, n) -> list[num]
days_between(a, b) -> num
how many days from `a` to `b` (negative when b is earlier)
weekday(date) -> num
0 for Monday up to 6 for Sunday
weekday_name(date) -> text
is_weekend(date) -> bool
add_months(date, n) -> list
add months, keeping the day when it fits and otherwise using the last day of that month
format_date(date) -> text
2026-12-05
parse_date(text) -> result[list[num]]
"2026-12-05" becomes ok([2026, 12, 5]); anything else is an err

jsonkit 1.0.0

work with nested data (maps and lists, like the result of json_parse).

Permissions it needs: nothing (it is pure) · read the source · SHA-256 ec23144acf59…

cresset install jsonkit --registry https://cressetlang.org/registry
What it provides (6)
dig(data, path, fallback = ...)
Follow a path like "user.tags.1" through maps and lists. Numbers pick list items. Gives back `fallback` when any step is missing, so it never stops your program.
pick(data, keys) -> map
a copy of a map with only the listed keys
omit(data, keys) -> map
a copy of a map without the listed keys
deep_merge(a, b) -> map
put two maps together; where both have a key and both values are maps, merge those too. Otherwise the second map wins.
flatten_keys(data, prefix = ...) -> map
nested maps become one flat map with dotted keys: {"a": {"b": 1}} becomes {"a.b": 1}
set_at(data, path, value) -> map
a copy of the data with the value at the path replaced, creating maps along the way when needed

mathkit 1.0.0

number helpers that are not built in.

Permissions it needs: nothing (it is pure) · read the source · SHA-256 515ba9290fb3…

cresset install mathkit --registry https://cressetlang.org/registry
What it provides (11)
gcd(a, b) -> num
lcm(a, b) -> num
is_prime(n) -> bool
prime_factors(n) -> list
the prime factors in order, with repeats: prime_factors(12) is [2, 2, 3]
factorial(n) -> result[num]
choose(n, k) -> num
n things taken k at a time, in any order
fibonacci(count) -> list
the first `count` Fibonacci numbers
clamp_to(x, low, high)
keep a number inside [low, high]
lerp(a, b, t) -> num
the point `t` of the way from a to b: lerp(0, 10, 0.25) is 2.5
sign(x) -> num
digits(n) -> list
the digits of a whole number: digits(407) is [4, 0, 7]