Sheet language
How a sheet is written and evaluated: notation, line forms, names, strict versus quiet lines, and the total command.
A Numlex sheet is a stack of logical lines. You type an ordinary line of notebook text, and a checked result appears in the answer column beside it.
This page is the formal starting point for the sheet language: the notation
used across the reference, every form a line can take, the rules for names
and assignments, the difference between strict lines and quiet prose, and the
built-in total command.
Notation
The reference uses a small set of placeholders:
| Placeholder | Meaning |
|---|---|
<expr> | any arithmetic expression |
<value> | a numeric value |
<unit> | a unit, or an expression over units |
<place> | free-text place name (up to 100 characters) |
<Answer Token> | an inserted answer token (marker U+FFFC) |
Syntax words are English. Where noted, they are case-insensitive — OF
works like of, Per Day like per day. The interface language and the
regional number format are independent settings: localization never changes
the syntax itself.
One line, one result
Each logical line produces one result in the right-hand column. Lines are evaluated from top to bottom, and a name declared on one line is visible to the lines below it.
Line forms
| Form | Example | Behavior |
|---|---|---|
| Empty line | No result. | |
| Heading | # Payroll sheet | A visual heading; skipped in calculations. |
| Comment | // week total | A skippable heading/comment line: no result, never part of a calculation (not an assignment, not a sheet name). |
| Label | Total: | A line ending in a colon is a label/divider; it evaluates as a skip. |
| Named value | base pay = 4500 | <name> = <expr>: the name is 1–6 ASCII words (or a single token word), ≤ 40 characters, the first word starts with a letter, and the name contains no operators. The value is mutable — a later <name> = <expr> line overwrites it for the lines below. |
| Built-in total | total | A command (case-insensitive) that sums the eligible lines of the current section — see The total command. |
| Numeric expression | 12 + 30 × 2 | See Operators & logic. |
| Percent & money | 15% of 490, $24 per day | See Percentages and Money & rates. |
| Units | 10 km to m, 90 km per 3 day | See Units & quantities. |
| Integer bases | 0x1F, 255 as hex | See Numbers & integer bases. |
| Dates | May 5 + 3 weeks | See Dates. |
| Network | weather in London, distance between … | See Live data & geography. |
| Plain text | bought cable | Quiet: no result. The only legacy fallback — in numeric lines, unknown Latin words are struck out (5 apples + 3 → 8). Prose without numbers, and words in other alphabets, are never evaluated. |
Strict lines and quiet prose
Most lines are allowed to be ordinary text: if Numlex cannot read a calculation, the line simply stays quiet. Three kinds of lines are strict instead — their shape claims the line completely, and a failed parse is an error rather than a fallback:
- Money lines. A line containing a currency marker (
$,€,100 USD…) must parse completely as a money expression; otherwise it is a hidden error and nothing is guessed. - Date-shaped lines.
May 5 + 43(no duration word) is an error — never “reduced” to plain numbers. - Call-shaped lines. A line shaped like a function call (
name() is strict: an unknown function is an error, not a parenthesized group.
Everything else stays quiet — including ordinary prose, which is never flagged.
Names and assignments
- Declare a value with
name = expression; the name then stands for that value in every line below. - Names are 1–6 ASCII words, at most 40 characters, the first word starting with a letter, with no operators inside.
- Assignments are mutable: writing the same name again overwrites it from that point down.
- Money values can be named too — declare
lunch = $45and later write2 people × lunch(see Money & rates). - Sheet names are separate from Settings constants; the constants mechanism is documented in Custom units & constants.
The total command
The exact command is a line whose entire content is total (case
insensitive). It evaluates the sum of the eligible results of the current
section — the lines under the same # heading — including the line holding
the command itself.
totallines do not re-count each other: a previously computed total is not part of the next total. An ordinary reference to a total line, however, is an ordinary line and is included.- Eligible: finite scalar numbers — including the percent and multiplier display kinds, named scalars, and exact integers (whose Double projection is exact for |v| ≤ 2^53).
- Not eligible: money, quantities with units, booleans, dates, errors and blank/label lines.
- Shadowing: an active named value or constant called
totaldisables the command — the line becomes an ordinary named value. - The
totalline is a section sum inside the sheet. It is distinct from the app’s bottom Total bar, which sums the whole sheet regardless of sections.
Where to go next
- Numbers & integer bases — literals, compact suffixes, exact Int64 bases.
- Operators & logic — precedence, booleans, the integer lane.
- Built-in functions — all 23 functions.
- Natural calculations — the approachable guide to everyday lines.