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.
| Module | Contains |
|---|---|
physics/constants | CODATA 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/uk | double decker bus, Nelsons Column, football pitch, Wales, Olympic swimming pool, Wembley Stadium |
whimsy/us | football field, Empire State Building, Rhode Island, Texas, Michigan Stadium (Big House) |
whimsy/au | cricket pitch, Tasmania, Sydney Harbour, MCG crowd |
whimsy/core | barn, shake, jiffy, microfortnight, attoparsec, Dunbar, and so on |
finance/core | Profit(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/mortgage | Mortgage(principal, apr, term, period, arrangement fee), RepaymentTerm(principal, apr, payment), Overpayment(principal, apr, term, extra) |
finance/property | Rent(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/tax | VAT(net, rate), SalesTax(price, rate), Tip(bill, rate, people) |
finance/savings | Savings(deposit, apr, term, compounding), RegularSaving(monthly, apr, term), SavingsPlan(deposit, monthly, apr, term), DoublingTime(apr), Inflation(amount, rate, term) |
health/body | BMI, BMRMale, BMRFemale, TDEE(bmr, activity) with the activity ladder (sedentary … extra active), HeartRate(age), the bpm unit |
fitness/running | Pace(distance, time) with pace and speed, RacePrediction(distance, time, target), RunningEnergy(weight, distance), Strides(distance, stride), the marathon and half marathon units |
home/energy | Appliance(power, daily use, tariff), Bill(previous, current, unit rate, standing charge, period), Charging(battery, charger, tariff, losses), Solar(capacity, install cost, tariff, yield) |
home/diy | Room(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/cooking | Scale(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/trip | Drive(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/2d | Circle, Ellipse, Rectangle(width, height), Square(side), Triangle, TriangleSides, RightTriangle, Trapezoid, Polygon; every one runs backwards |
shapes/3d | Sphere, 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/mechanics | Fall(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/electrical | Ohm(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/moon | MoonPhase(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/sky | SkyDirection(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/sun | SunDirection(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/time | The 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/place | Place(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 lThe 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)::netAn 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.