>>> datetime("2022-07-20T21:52+0200")
+
+ = 2022-07-20 19:52:00 UTC [DateTime]
+
+
+>>> datetime("2022-07-20 21:52 Europe/Berlin")
+
+ = 2022-07-20 21:52:00 CEST (UTC +02), Europe/Berlin [DateTime]
+
+
+>>> datetime("2022/07/20 09:52 PM +0200")
+
+ = 2022-07-20 21:52:00 (UTC +02) [DateTime]
+
+
+>>> format_datetime("This is a date in %B in the year %Y.", datetime("2022-07-20 21:52 +0200"))
+
+ = "This is a date in July in the year 2022." [String]
+
+
+>>> get_local_timezone()
+
+ = "UTC" [String]
+
+
+>>> datetime("2022-07-20 21:52 +0200") -> tz("Europe/Amsterdam")
+
+ = 2022-07-20 21:52:00 CEST (UTC +02), Europe/Amsterdam [DateTime]
+
+
+>>> datetime("2022-07-20 21:52 +0200") -> tz("Asia/Taipei")
+
+ = 2022-07-21 03:52:00 CST (UTC +08), Asia/Taipei [DateTime]
+
+
+>>> datetime("2022-07-20 21:52 +0200") -> unixtime
+
+ = 1_658_346_720
+
+
+>>> from_unixtime(2^31)
+
+ = 2038-01-19 03:14:08 UTC [DateTime]
+
+
+>>> date("2022-07-20")
+
+ = 2022-07-20 00:00:00 UTC [DateTime]
+
+
+>>> calendar_add(datetime("2022-07-20 21:52 +0200"), 2 years)
+
+ = 2024-07-20 21:52:00 (UTC +02) [DateTime]
+
+
+>>> calendar_sub(datetime("2022-07-20 21:52 +0200"), 3 years)
+
+ = 2019-07-20 21:52:00 (UTC +02) [DateTime]
+
+
+>>> weekday(datetime("2022-07-20 21:52 +0200"))
+
+ = "Wednesday" [String]
+
+
+>>> julian_date(datetime("2022-07-20 21:52 +0200"))
+
+ = 2.45978e+6 day [Time]
+
+
+>>> century/1e6 -> human
+
+ = "52 minutes + 35.693 seconds" [String]
+
+
+>>> len([3, 2, 1])
+
+ = 3
+
+
+>>> head([3, 2, 1])
+
+ = 3
+
+
+>>> tail([3, 2, 1])
+
+ = [2, 1] [List]
+
+
+>>> cons(77, [3, 2, 1])
+
+ = [77, 3, 2, 1] [List]
+
+
+>>> cons_end(77, [3, 2, 1])
+
+ = [3, 2, 1, 77] [List]
+
+
+>>> is_empty([3, 2, 1])
+
+ = false [Bool]
+
+
+>>> is_empty([])
+
+ = true [Bool]
+
+
+>>> concat([3, 2, 1], [10, 11])
+
+ = [3, 2, 1, 10, 11] [List]
+
+
+>>> take(2, [3, 2, 1, 0])
+
+ = [3, 2] [List]
+
+
+>>> drop(2, [3, 2, 1, 0])
+
+ = [1, 0] [List]
+
+
+>>> element_at(2, [3, 2, 1, 0])
+
+ = 1
+
+
+>>> range(2, 12)
+
+ = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] [List]
+
+
+>>> reverse([3, 2, 1])
+
+ = [1, 2, 3] [List]
+
+
+>>> map(sqr, [3, 2, 1])
+
+ = [9, 4, 1] [List]
+
+
+>>> filter(is_finite, [0, 1e10, NaN, -inf])
+
+ = [0, 10_000_000_000] [List]
+
+
+>>> foldl(str_append, "", ["Num", "bat", "!"])
+
+ = "Numbat!" [String]
+
+
+>>> fn last_digit(x) = mod(x, 10)
+sort_by_key(last_digit, [701, 313, 9999, 4])
+
+ = [701, 313, 4, 9999] [List]
+
+
+>>> sort([3, 2, 7, 8, -4, 0, -5])
+
+ = [-5, -4, 0, 2, 3, 7, 8] [List]
+
+
+>>> intersperse(0, [1, 1, 1, 1])
+
+ = [1, 0, 1, 0, 1, 0, 1] [List]
+
+
+>>> sum([3 m, 200 cm, 1000 mm])
+
+ = 6 m [Length]
+
+
+>>> linspace(-5 m, 5 m, 11)
+
+ = [-5 m, -4 m, -3 m, -2 m, -1 m, 0 m, 1 m, 2 m, 3 m, 4 m, 5 m] [List]
+
+
+>>> join(["snake", "case"], "_")
+
+ = "snake_case" [String]
+
+
+>>> split("Numbat is a statically typed programming language.", " ")
+
+ = ["Numbat", "is", "a", "statically", "typed", "programming", "language."] [List]
+
+
+>>> id(8 kg)
+
+ = 8 kg [Mass]
+
+
+>>> abs(-22.2 m)
+
+ = 22.2 m [Length]
+
+
+>>> sqrt(4 are) -> m
+
+ = 20 m [Length]
+
+
+>>> cbrt(8 L) -> cm
+
+ = 20.0 cm [Length]
+
+
+>>> sqr(7)
+
+ = 49
+
+
+>>> round(5.5)
+
+ = 6
+
+
+>>> round(-5.5)
+
+ = -6
+
+
+>>> round_in(m, 5.3 m)
+
+ = 5 m [Length]
+
+
+Round in centimeters.
+>>> round_in(cm, 5.3 m)
+
+ = 530 cm [Length]
+
+
+>>> floor(5.5)
+
+ = 5
+
+
+>>> floor_in(m, 5.7 m)
+
+ = 5 m [Length]
+
+
+Floor in centimeters.
+>>> floor_in(cm, 5.7 m)
+
+ = 570 cm [Length]
+
+
+>>> ceil(5.5)
+
+ = 6
+
+
+>>> ceil_in(m, 5.3 m)
+
+ = 6 m [Length]
+
+
+Ceil in centimeters.
+>>> ceil_in(cm, 5.3 m)
+
+ = 530 cm [Length]
+
+
+>>> trunc(5.5)
+
+ = 5
+
+
+>>> trunc(-5.5)
+
+ = -5
+
+
+>>> trunc_in(m, 5.7 m)
+
+ = 5 m [Length]
+
+
+Truncate in centimeters.
+>>> trunc_in(cm, 5.7 m)
+
+ = 570 cm [Length]
+
+
+>>> mod(27, 5)
+
+ = 2
+
+
+>>> exp(4)
+
+ = 54.5982
+
+
+>>> ln(20)
+
+ = 2.99573
+
+
+>>> log(20)
+
+ = 2.99573
+
+
+>>> log10(100)
+
+ = 2
+
+
+>>> log2(256)
+
+ = 8
+
+
+>>> maximum([30 cm, 2 m])
+
+ = 2 m [Length]
+
+
+>>> minimum([30 cm, 2 m])
+
+ = 30 cm [Length]
+
+
+>>> mean([1 m, 2 m, 300 cm])
+
+ = 2 m [Length]
+
+
+>>> variance([1 m, 2 m, 300 cm])
+
+ = 0.666667 m² [Area]
+
+
+>>> stdev([1 m, 2 m, 300 cm])
+
+ = 0.816497 m [Length]
+
+
+>>> median([1 m, 2 m, 400 cm])
+
+ = 2 m [Length]
+
+
+>>> gcd(60, 42)
+
+ = 6
+
+
+>>> lcm(14, 4)
+
+ = 28
+
+
+>>> use numerics::diff
+fn polynomial(x) = x² - x - 1
+diff(polynomial, 1)
+
+ = 1.0
+
+
+Compute the free fall velocity after \\( t=2 s \\).
+>>> use numerics::diff
+fn distance(t) = 0.5 g0 t²
+fn velocity(t) = diff(distance, t)
+velocity(2 s)
+
+ = 19.6133 m/s [Velocity]
+
+
+>>> use numerics::solve
+fn f(x) = x² +x -2
+root_bisect(f, 0, 100, 0.01, 0.01)
+
+ = 1.00098
+
+
+>>> use numerics::solve
+fn f(x) = x² -3x +2
+fn f_prime(x) = 2x -3
+root_newton(f, f_prime, 0 , 0.01)
+
+ = 0.996078
+
+
+>>> use numerics::fixed_point
+fn function(x) = x/2 - 1
+fixed_point(function, 0, 0.01)
+
+ = -1.99219
+
+
+>>> hypot2(3 m, 4 m)
+
+ = 5 m [Length]
+
+
+>>> hypot3(8, 9, 12)
+
+ = 17
+
+
+>>> use extra::algebra
+quadratic_equation(2, -1, -1)
+
+ = [1, -0.5] [List]
+
+
+>>> is_nan(37)
+
+ = false [Bool]
+
+
+>>> is_nan(NaN)
+
+ = true [Bool]
+
+
+>>> is_infinite(37)
+
+ = false [Bool]
+
+
+>>> is_infinite(-inf)
+
+ = true [Bool]
+
+
+>>> is_finite(37)
+
+ = true [Bool]
+
+
+>>> is_finite(-inf)
+
+ = false [Bool]
+
+
+>>> unit_of(20 km/h)
+
+ = 1 km/h [Velocity]
+
+
+>>> value_of(20 km/h)
+
+ = 20
+
+
+>>> element("H")
+
+ = ChemicalElement { symbol: "H", name: "Hydrogen", atomic_number: 1, group: 1, group_name: "Alkali metals", period: 1, melting_point: 13.99 K, boiling_point: 20.271 K, density: 0.00008988 g/cm³, electron_affinity: 0.754 eV, ionization_energy: 13.598 eV, vaporization_heat: 0.904 kJ/mol } [ChemicalElement]
+
+
+Get the ionization energy of hydrogen.
+>>> element("hydrogen").ionization_energy
+
+ = 13.598 eV [Energy or Torque]
+
+
+>>> 5500 m |> unit_list([miles, yards, feet, inches])
+
+ = [3 mi, 734 yd, 2 ft, 7.43307 in] [List]
+
+
+>>> 46.5858° -> DMS
+
+ = [46°, 35′, 8.88″] [List]
+
+
+>>> 46.5858° -> DM
+
+ = [46°, 35.148′] [List]
+
+
+>>> 180 cm -> feet_and_inches
+
+ = [5 ft, 10.8661 in] [List]
+
+
+>>> 1 kg -> pounds_and_ounces
+
+ = [2 lb, 3.27396 oz] [List]
+
+
+>>> from_celsius(300)
+
+ = 573.15 K [Temperature]
+
+
+>>> 300K -> celsius
+
+ = 26.85
+
+
+>>> from_fahrenheit(300)
+
+ = 422.039 K [Temperature]
+
+
+>>> 300K -> fahrenheit
+
+ = 80.33
+
+
+>>> use extra::color
+rgb(125, 128, 218)
+
+ = Color { red: 125, green: 128, blue: 218 } [Color]
+
+
+>>> use extra::color
+color(0xff7700)
+
+ = Color { red: 255, green: 119, blue: 0 } [Color]
+
+
+>>> use extra::color
+cyan -> color_rgb
+
+ = "rgb(0, 255, 255)" [String]
+
+
+>>> use extra::color
+cyan -> color_rgb_float
+
+ = "rgb(0.000, 1.000, 1.000)" [String]
+
+
+>>> use extra::color
+rgb(225, 36, 143) -> color_hex
+
+ = "#e1248f" [String]
+
+
+>>> str_length("Numbat")
+
+ = 6
+
+
+>>> str_slice("Numbat", 3, 6)
+
+ = "bat" [String]
+
+
+>>> 0x2764 -> chr
+
+ = "❤" [String]
+
+
+>>> "❤" -> ord
+
+ = 10084
+
+
+>>> lowercase("Numbat")
+
+ = "numbat" [String]
+
+
+>>> uppercase("Numbat")
+
+ = "NUMBAT" [String]
+
+
+>>> str_append("Numbat", "!")
+
+ = "Numbat!" [String]
+
+
+>>> str_find("Numbat is a statically typed programming language.", "typed")
+
+ = 23
+
+
+>>> str_contains("Numbat is a statically typed programming language.", "typed")
+
+ = true [Bool]
+
+
+>>> str_replace("Numbat is a statically typed programming language.", "statically typed programming language", "scientific calculator")
+
+ = "Numbat is a scientific calculator." [String]
+
+
+>>> str_repeat("abc", 4)
+
+ = "abcabcabcabc" [String]
+
+
+>>> 42 |> base(16)
+
+ = "2a" [String]
+
+
+>>> 42 -> bin
+
+ = "0b101010" [String]
+
+
+>>> 42 -> oct
+
+ = "0o52" [String]
+
+
+>>> 0b111 -> dec
+
+ = "7" [String]
+
+
+>>> 2^31-1 -> hex
+
+ = "0x7fffffff" [String]
+
+
+");
+ print!("");
+ for l in example_input.lines() {
+ println!("{}", l);
+ }
+ println!();
+ for l in example_output.lines() {
+ println!("{}", l);
+ }
+ println!("
");
+ println!();
+ } else {
+ eprintln!(
+ "Warning: Example \"{example_code}\" of function {fn_name} did not run successfully."
+ );
+ }
+ }
+ println!(" ");
+ print!("