Skip to content

Overview

1
# 4th Thursday of November
2
date(2026, 11, 1).nth_weekday(4, "thu")2026-11-26
3
# cities are time zones
4
date("2026-12-25 18:30") to "Sao Paulo"2026-12-25 21:30:00 -03:00
5
# units combine and convert
6
100 km / 2 h to mph31.0686 mph
7
# cups to grams
8
1 cup * density("flour") to g125.392 g
9
# an hourly wage as a yearly salary
10
$25/h to USD/workyr$52,000.00/workyr
11
# measurements with error bars
12
5 ± 0.1 m * 25 ± 0.2 m
13
# exact decimals
14
0.1 + 0.2 == 0.3true
15
# factoring big ints
16
factors(2 ** 32 + 1)[641, 6700417]
17
# calculus: the area under a sine curve
18
integrate(sin, 0, pi)2
19
# the distance from Paris to Tokyo
20
great_circle("Paris", "Tokyo")9712.52 km
21
# the closest spelling
22
"recieve".closest(["deceive", "receive", "recipe"])"receive"
23
# is this IP address in that network?
24
in_cidr("10.0.3.7", "10.0.0.0/22")true
25
# odds in plain words
26
odds(2 ** -64)"1 in 1.84 × 10^19: about as likely as a perfect March Madness bracket (1 in 9.20 × 10^18)"
27
# charts made of text
28
(0..20).map(|x| sin(x / 3)).sparkline"▅▆▇▇███▇▆▅▄▃▂▁▁▁▂▂▄▅"
29
# reading these: x.f(y) means f(x, y), |x| x * 2 is a small function of x, xs |> sum passes xs to sum, and # starts a comment
Example outputCtrl+Enter to run

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