zil
An expression calculator and scripting language with units, dates, exact fractions and big ints.
Example results generated on 2026-10-08. Ones using
now,todayor randomness will differ when you run them: press Run on any example to run it in your browser, after editing it if you like.
a taste
# 4th Thursday of November
date(2026, 11, 1).nth_weekday(4, "thu")
# → 2026-11-26
# cities are time zones
date("2026-12-25 18:30") to "Sao Paulo"
# → 2026-12-25 21:30:00 -03:00
# units combine and convert
100 km / 2 h to mph
# → 31.0686 mph
# cups to grams
1 cup * density("flour") to g
# → 125.392 g
# money
$25/h to USD/workyr
# → $52,000.00/workyr
# error bars
5 ± 0.1 m * 2
# → 5 ± 0.2 m
# exact decimals
0.1 + 0.2 == 0.3
# → true
# factoring big ints
factors(2 ** 32 + 1)
# → [641, 6700417]
# calculus
integrate(sin, 0, pi)
# → 2
# geography
great_circle("Paris", "Tokyo")
# → 9712.52 km
# fuzzy matching
"recieve".closest(["deceive", "receive", "recipe"])
# → "receive"
# subnets
in_cidr("10.0.3.7", "10.0.0.0/22")
# → true
# odds in plain words
odds(2 ** -64)
# → "1 in 1.84 × 10^19: about as likely as a perfect March Madness bracket (1 in 9.20 × 10^18)"
# charts
(0..20).map(|x| sin(x / 3)).sparkline
# → "▅▆▇▇███▇▆▅▄▃▂▁▁▁▂▂▄▅"
# syntax: x.f(y) is f(x, y) |x| x * 2 is a lambda xs |> sum pipes # comments
Modules
| module | about |
|---|---|
| core | values, printing, type conversions, parsing, help |
| fs | files, directories, paths, JSON and CSV |
| sys | script arguments, environment variables, shell commands, HTTP GET |
| text | case, splitting, search, regex; encodings, ciphers and more below |
| text.layout | pad, center, wrap, truncate, dedent; snake_case, camelCase, slugs; words |
| text.compare | edit distance, similarity, the closest of a list, line-by-line diffs |
| text.translation | translate text between languages online; cached translations work offline |
| text.encoding | base64, base32, base58, URL and hex encodings, UTF-8 bytes, hex dumps |
| text.hash | SHA-1/256/512, MD5, HMAC and CRC-32 of strings |
| text.ciphers | Caesar, ROT13, Atbash, Vigenère, Morse, Braille, NATO spelling |
| text.fancy | mock case, l33t, uwu, Pig Latin, zalgo, upside-down, 𝐛𝐨𝐥𝐝/𝒮𝒸𝓇𝒾𝓅𝓉/wide |
| text.placeholder | lorem ipsum placeholder text, random team and person names |
| data | sorting and searching any collection; lists, maps, tables, charts below |
| data.lists | ranges, map/filter/reduce, building lists |
| data.maps | keys, values, lookups, merging and transforming maps |
| data.sets | unique values in insertion order: union, intersection, difference |
| data.tables | rows under named columns: filter, pick columns, sort |
| data.charts | sparklines, bar charts, histograms, plots, heatmaps, progress bars and trees |
| math | rounding, roots, logs, interpolation, constants; exact fractions and big ints |
| math.stats | sums, averages, spread and extremes of lists; units welcome |
| math.trig | sine, cosine and friends; angles as units |
| math.numtheory | gcd, primes, factoring, factorials, modular powers; exact at any size |
| math.bits | count, test, set, rotate and swap bits |
| math.bases | hex, binary, octal and any base 2-36; digits of a number |
| math.formatting | printf and format specs, commas, numbers in words, ordinals, Roman numerals |
| math.random | random numbers and picks, dice, odds in plain words, fortunes, a magic 8-ball |
| math.uncertainty | measurements with an error, 5 ± 0.1 m, carried through arithmetic |
| math.complex | complex numbers, 2 + 3i; a number touching i is imaginary |
| math.linalg | dot and cross products, matrix multiply, determinant, inverse, linear systems |
| math.calculus | numeric roots, derivatives and integrals of functions |
| units | numbers with units, combined and converted; live currency rates |
| units.constants | physical constants (CODATA 2018); Planck’s constant is h_planck |
| units.money | currencies, live exchange rates, paid time like workday and workyr |
| units.goofy | bananas for scale, smoots, fortnights; every item also works as item_for_scale |
| units.kitchen | cups to grams with ingredient densities |
| finance | pay, interest and growth, loans, splitting bills, margins |
| time | dates, durations, date math, relative text |
| time.calendars | periods, weekdays, business days, week numbers, month grids, cron, zodiacs |
| time.zones | the same moment in UTC, local time, any IANA zone or a city; world clocks |
| time.sky | sunrise, sunset, day length and moon phase for a place and date |
| geo | countries and cities: lookups, distance, bearing, nearest city |
| dev | JWTs, URLs, semver, file permissions; networks, IDs, colors and codes below |
| dev.net | IP addresses, CIDR blocks, subnets, well-known ports |
| dev.ids | UUIDs, ULIDs and nano IDs; secure passwords and passphrases |
| dev.colors | colors as “#rrggbb”: RGB/HSL, mixing, lightening, WCAG contrast |
| dev.codes | check digits for cards, ISBNs and IBANs; HTTP status and MIME type lookups |
| art | clip art, gradients, QR codes, images, animation; frames, fractals, games below |
| art.frames | boxes, cowsay; art side by side, stacked, overlaid, mirrored, rotated, scaled |
| art.generative | L-systems, fractals, the Mandelbrot set, cellular automata, mazes, starfields |
| art.games | chess boards from FEN, playing cards, dice faces |
| art.figlet | big-letter banners in FIGlet fonts like slant and shadow, or any .flf file |