Skip to content

Imports

The import keyword brings in a module. The bundled modules are always available. Names in the table are identifiers, so they carry no apostrophes: Nelsons Column stands for Nelson’s Column and agents fees for agents’ fees.

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 k_B, qe, NA, R, hbar, me, mp, eps0, mu0
whimsy/ukdouble decker bus, Nelsons Column, football pitch, Wales, Olympic swimming pool, Wembley Stadium
whimsy/usfootball field, Empire State Building, Rhode Island, Texas, Michigan Stadium (Big House)
whimsy/aucricket pitch, Tasmania, Sydney Harbour, MCG crowd
whimsy/corebarn, shake, jiffy, microfortnight, attoparsec, Dunbar, and so on
finance/coreProfit(incoming, outgoing) with profit and margin, Annuity(principal, rate, periods) with payment, RegularPayments(payment, rate, periods) with value. These are the fundamentals the other finance modules build on, alongside the prelude’s CompoundInterest. 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)
finance/savingsSavings(deposit, apr, term, compounding), RegularSaving(monthly, apr, term), SavingsPlan(deposit, monthly, apr, term), DoublingTime(apr), Inflation(amount, rate, term)
health/bodyBMI, BMRMale, BMRFemale, TDEE(bmr, activity) with the activity ladder (sedentary … extra active), HeartRate(age), the bpm unit
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
almanac/moonMoonPhase(time) with phase (“waxing gibbous”), illuminated, waxing and elongation; MoonDirection(time, place) with altitude, apparent altitude, azimuth and distance; MoonTimes(date, place) with the rise, transit and set on that date, to the minute, in the place’s time zone; MoonPosition(time), its place among the stars
almanac/skySkyDirection(right ascension, declination, time, place): where a body with those sky coordinates appears from a place, as altitude, apparent altitude and azimuth; refraction(altitude); sidereal time(time, longitude)
almanac/sunSunDirection(time, place) with the sun’s altitude, apparent altitude and compass azimuth; SunPosition(time), its place among the stars; SunTimes(date, place, elevation) with sunrise, sunset, solar noon, peak altitude, civil, nautical and astronomical dawn and dusk, the morning and evening golden and blue hours as Durations, day length, daylight and night length, in the place’s time zone; brings geo/place along
astronomy/timeThe astronomer’s lengths of day, month and year: sidereal day, sidereal year, tropical year, anomalistic year, gregorian year, julian year, julian century, synodic month (also lunar month), sidereal month, draconic month, anomalistic month
geo/placePlace(latitude, longitude, tz) (tz defaults to UTC), and Route either way: Route(origin, destination) gives the great-circle distance and initial bearing; Route(origin, bearing, distance) gives the destination
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 formulas in these modules 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.