Skip to content

The editor

The app at smoot.app is one document: your lines on the left, their answers on the right. Every keystroke recomputes the whole document.

Results. A line that names a value and a bare expression show in the same ink; the bare expression’s answer is bold. A line with an error shows its message in red where the answer would be, and the faulty span is underlined in the editor. A warning is a dashed grey underline; hover or tap it for the message. F8 jumps to the next problem.

The answer bar. Click a result, or focus it and press Enter, to see all of it in a bar at the foot of the window. Copy copies the result as displayed, digit grouping included, without the ≈ mark; text comes in quotes, so it pastes back. A what-if’s name and its record have no Copy. On a named line, Copy as a line copies the whole line, such as monthly rent = 1,350 (a name that needs them in backticks); Copy exact copies every digit of a rounded value whose decimal ends, which reads back exactly, such as 4.321942375150662009157288198886473341473378241062164306640625 for 1.05 ^ 30. A value whose decimal repeats, such as 10/3, has no Copy exact, and its Copy as a line carries the digits shown. A formula’s result, such as a Mortgage(…), copies as its call, without the fields the formula works out, so it pastes back as the same result. Both are in the menu behind ▾ beside Copy. A rounded value has ⓘ beside it: it says the value is rounded for display and shows it in full, with Copy exact. Under the value, Built from lists what the answer is made from and Used by what uses it, each with its value, in the colours the ledger tints them; click one to go there. When the document has what-ifs, a row in the bar shows the answer in every column, base first; click one to go there (on a phone, ‹ and › step between them). A line a what-if sets shows Set by with the what-if’s name; click it to go to where it is set. The name at the top of the bar is also how you rename it: click it, type the new name and press Enter (a name with an apostrophe or a word smoot reads, such as Dad's treat, is written in backticks for you), and every line that uses it, and every what-if that sets it, changes with it (one undo puts it back). A line that is only a calculation shows its own text there; click it to name the line. A name already in use, such as another line’s or a unit’s like m, is refused, and the bar says why above itself. The arrow keys step through the answers: up and down a column, left and right across columns. Esc closes the bar, and s opens a scrub; hover a button to see its key, such as Copy (⌘C or Ctrl+C). Copy in the header copies the whole document with its answers: pasted into a text field it is the document with // => answer after each line, so it reads back into smoot; pasted into a rich editor it is the same lines in a monospace block. Printing the page prints that block. On a phone, while you type, a strip on top of the keyboard shows the answer to the line you are on, with Copy; tap another result to see that one there. A long answer stays on one line; swipe it sideways to read the rest.

Starting a document. An empty document shows a dimmed example. Its Try button or Tab keeps the example; typing replaces it. The title field at the top names the document; an untitled document is listed by its first line.

Library. The Library menu has three tabs. Documents lists yours, newest first, with rename and delete; documents save automatically in this browser and nowhere else. Examples are grouped by topic and open read-only; “Edit a copy” makes an editable one. Add-ons lists the bundled modules by area, each with the formulas it provides; “Add import” puts the import line at the top of your document, and the name opens the module’s source. The search box searches all three tabs at once, and each tab shows how many matches it holds. New, beside Library, starts a fresh document.

Share. The Share button copies a link that carries the document’s text and title. Anyone who opens it gets their own editable copy. Nothing else travels, and nothing is stored on a server.

Settings. The gear opens a panel that overrides every document’s defaults: unit group, digit separator, grouping, and a number format (normal, 1 to 20 significant figures, or 0 to 20 decimal places). The browser remembers the choice, and every open tab follows it. Each setting’s “default” choice returns to the document’s own. The panel also holds “Suggest as I type” (see Completions, below).

Currency rates. The app fetches the day’s rates when it loads and falls back to a bundled snapshot if it cannot.

The clock. now and today are fixed when the page loads, in your browser’s time zone. Reload to advance them.

Dark mode. The app follows your system’s light or dark setting. The moon and sun button overrides it, remembers the choice, and switches every open tab.

As you type, a menu offers what could come next: names from your document and the prelude, units, a function’s or a formula’s parameters, a record’s fields after ::, operators after a value, time zones, and month names. It puts first what fits where you are typing. After 1 m/s +, a name that holds a speed comes before one that holds a length, and after a number, units come first, one of each kind of quantity before a second of any, led by the ones your document already uses. Where a duration is expected, the time units come first. After an hour, am and pm lead until you type a letter; then the units lead, starting with the one you spelled first. Nothing that matches what you typed is left out; what does not fit is only placed lower.

A time zone can be found by its city: ber offers Europe/Berlin. Zones are listed west to east.

The menu opens by itself once you have typed part of a name, after ::, and after ( or , in a call. Anywhere else, press Ctrl-Space (⌃Space on a Mac). A menu that opened while you typed has nothing selected, so Enter still ends the line: press Tab to take the top item, or an arrow key and then Enter. A menu that Ctrl-Space opened has its top item selected. Choosing a parameter inserts name: and opens the menu again for its value.

In the app, turning off “Suggest as I type” in the settings panel leaves the menu to Ctrl-Space alone: typing opens nothing, and choosing a parameter does not open the menu again.

To try it, add a line to this block: type 1 m/s + and press Ctrl-Space, or type Trip(.

formula Trip(speed: Speed, time: Time):
  distance = speed * time
pace = 3 m/s
gap = 5 m
wait = 2 s
force = 1 N

Every fenced smoot block on this site is a live editor with the same engine. In the reference and the examples each block is independent: the fences there are isolated. A page can also let blocks share one document, so a name defined in an earlier block is available in a later one. Edits last until you leave the page.

Tap a line to see the wash: amber for what fed it, blue for what it feeds, reaching across every shared block on the page. Tap an answer to copy it. On a block with dock=inspect or dock=full a tap opens a dock under the block instead, with what the answer is built from and what uses it.

A fence’s options, after ```smoot:

  • shared or isolated picks the block’s namespace; shared is the default.
  • readonly shows the block without letting you edit it.
  • static turns off the engine and shows plain code.
  • show=source or show=results shows half the block; show=none hides it.
  • foldable lets you open what show= hides.
  • dock=minimal, dock=inspect, dock=full or dock=none picks what a tap and a scrub show; minimal is the default. inspect and full open a dock under the block, so they need results to show: not with static, and not with show=source or show=none unless the block is foldable.