Skip to content

Imports

import brings in a module. The bundled modules are always available.

ModuleContains
physics/constantsCODATA 2022 constants: c, G, planck constant, boltzmann constant, avogadro constant, gas constant, electron mass, proton mass, elementary charge, g0, and short names kB, qe, NA, R, hbar, me, mp, eps0, mu0
whimsy/ukdouble decker bus, Nelsons Column, football pitch, Wales, Olympic swimming pool
whimsy/usfootball field, Empire State Building, Rhode Island, Texas
whimsy/aucricket pitch, Tasmania, Sydney Harbour
whimsy/cabinetsmoot, barn, shake, jiffy, fortnight, microfortnight, attoparsec, and friends
finance/coreProfit(incoming, outgoing) with profit and margin, Annuity(principal, rate, periods) with payment, RegularPayments(payment, rate, periods) with value; the fundamentals the other finance modules are built from, on the prelude’s CompoundInterest, and every one runs backwards
finance/mortgageMortgage(principal, apr, term, period, arrangement fee), RepaymentTerm(principal, apr, payment), Overpayment(principal, apr, term, extra)
finance/propertyRent(tenant pays, landlord costs, agents fees), RentalYield(price, rent), NetYield(price, rent, costs), Flip(purchase, refurb, sale, …); rents and costs are rates per month
finance/taxVAT(net, rate), SalesTax(price, rate), Tip(bill, rate, people)
health/bodyBMI, BMRMale, BMRFemale, TDEE(bmr, activity) with the activity ladder (sedentaryextra active), HeartRate(age), the bpm unit
finance/savingsSavings(deposit, apr, term, compounding), RegularSaving(monthly, apr, term), SavingsPlan(deposit, monthly, apr, term), DoublingTime(apr), Inflation(amount, rate, term)
fitness/runningPace(distance, time) with pace and speed, RacePrediction(distance, time, target), RunningEnergy(weight, distance), Strides(distance, stride), the marathon and half marathon units
home/energyAppliance(power, daily use, tariff), Bill(previous, current, unit rate, standing charge, period), Charging(battery, charger, tariff, losses), Solar(capacity, install cost, tariff, yield)
home/diyRoom(length, width, height, openings), Paint(area, coats, coverage, tin), Tiles(area, tile length, tile width, waste), Flooring(area, pack covers, waste), Wallpaper(perimeter, height, …), Concrete(length, width, depth, waste, bag makes)
kitchen/cookingScale(serves, want, quantity), Ingredient(volume, density) with the density ladder (flour, sugar, butter, …), Oven(temperature) with fan, fahrenheit and gas mark, Roast(weight, per kilo, plus) with the per-kilo ladder (chicken, beef rare, …), Dough(flour, hydration, salt share, yeast share)
travel/tripDrive(distance, speed, stops), Fuel(distance, economy, price), Electric(distance, economy, price), Range(tank, economy), Budget(nights, hotel, spending, flights, people), the mpg, UK mpg and night units
shapes/2dCircle, Ellipse, Rectangle(width, height), Square(side), Triangle, TriangleSides, RightTriangle, Trapezoid, Polygon; every one runs backwards
shapes/3dSphere, Cylinder, Cone, Pyramid (on a Square, with slant angle), Frustum (a Cone less a cone, with slant angle), Box(width, length, height) on its base rectangle, Cube; every one runs backwards, and importing it brings shapes/2d along
physics/mechanicsFall(height), Motion(acceleration, time, initial speed), Braking(speed, deceleration, reaction), Projectile(speed, angle), Kinetic, Potential, Momentum, Force, Lift, Pendulum; gravity defaults to standard gravity
physics/electricalOhm(voltage, current) with resistance and power, Series, Parallel, VoltageDivider(input, top, bottom), LED(supply, forward voltage, current), Battery(capacity, load, voltage), RC(resistance, capacitance), the Ah, kohm, Mohm and farad units
import "physics/constants"
earth mass = standard gravity * (6371 km)^2 / G to 3 sf
earth mass to kg
import "whimsy/uk"
1 Olympic swimming pool to l

The formula libraries run in either direction, like any formula.

import "finance/mortgage"
import "finance/tax"
Mortgage(principal = £300,000, apr = 5%)::monthly payment
Mortgage(monthly payment = £1,500/month, apr = 5%)::principal
VAT(gross = £120)::net

An imported module’s public names join your document. Names declared with let inside a module stay private to it. Two imports that define the same name are an error; a name you define yourself wins over an import.