User guide

Everything Reckon understands, with examples. New to it? Type a line such as 20% of $75 and the answer appears beside it.

Reckon evaluates a document line by line. Each line can be a calculation, a header, a comment or blank. A line can use variables and results from the lines above it.

Writing lines

You write Meaning
# Groceries Header (no result; also starts a new block for sum)
// note Comment line
Rent: $1,200 Rent: is a label and is not evaluated
$275 for the "Model 227" Text in double quotes is ignored
prev - 5% discount Unknown words are ignored, so prose is fine
sigmoyd(0), 989TFLOPZ Errors: an unknown word right before ( is taken for a misspelt function, and a word stuck to a number that is one letter off a unit for a misspelt unit ("did you mean TFLOPS?"). Other words, as in 2pcs or 1080p, are ignored as before
1 m 20 cm = 120 cm Anything after a top-level = is ignored, so you can paste annotated examples

A colon between digits (2:30) is a time, not a label.

In the desktop app a line too long for the window wraps onto the next line; its result stays beside its first line. ↑ and ↓ move through the wrapped lines one at a time, and Home and End (⌘← and ⌘→ on a Mac) go to the ends of the one the cursor is on.

Operators

Operation Symbols and words
Addition +, plus, and, with
Subtraction -, minus, subtract, without
Multiplication *, ×, times, multiplied by, mul
Division /, ÷, divide, divide by, divided by, per
Exponent ^, **
Modulo mod
Bitwise &, `
Factorial 5! or fact 5

Two values written next to each other are combined:

Numbers

Conversion

Use in, into, to or as. Conversions can be chained.

5 km in miles
$30 in Euro
60 mph in km/h
1 acre in sq m
0.25 in %

Units

Kind Units
Length meter (all SI prefixes: mm, cm, km, …), mil, point/pt, line, inch, hand, foot/ft, yard/yd, rod, chain, furlong, mile/mi, cable, nautical mile/nmi, league, light year
CSS px, pt, em. em defaults to 16 px and ppi to 96. Change them with em = 20px and ppi = 326.
Area hectare/ha, are, acre, plus any squared length: sq cm, square inches, sqm, m2, m²
Volume liter/L (ml, cl, dl, …), pint, quart/qt, gallon/gal, teaspoon/tsp (tea spoon), tablespoon/tbsp, cup, plus any cubed length: cu cm, cubic inches, cbm, m³
Mass gram (all SI prefixes: mg, kg, …), tonne/t, carat/ct, centner, pound/lb, stone/st, ounce/oz
Time second (ms, µs, ns), minute/min, hour/h/hr, day, week, month, year. A year is 365 days and a month is 1/12 of a year.
Temperature kelvin/K, celsius/°C/C, fahrenheit/°F/F
Data bit/b and byte/B with SI prefixes (kB = 1000 B) and binary prefixes (KiB = 1024 B). Lowercase b is bits and uppercase B is bytes.
Angle radian/rad, degree/deg/°
Speed mph, kph (km/h), knot/kn, or any compound such as km/h or m/s

Units multiply and divide: 2 m * 3 m → 6 m², 10 km / 2 h → 5 km/h, $120 / 4 h → $30/h. SI prefixes are case-sensitive: MB is megabytes, mb is not recognised.

Currency

Use ISO codes (USD, EUR, JPY, …), names (dollars, euros, yen, rupees, bitcoin) or signs ($ € £ ¥ ₹ ₽ ₩ ₺ ₪ ฿ ₫ ₱ ₴ ₦ ₸ ₾ ₿). $30 CAD means 30 Canadian dollars. In a sum of mixed currencies, the result is in the first value's currency: $30 CAD + 5 USD - 7 EUR → 25.64 CAD.

A sign and its code mean the same thing, so $5/h and 5 USD/h, or ₹200/h and 200 INR/h, give the same result. Money is shown with its sign where it has one, also per something: $5/h, ₹37.04/Mtok, £2/kg. Amounts are shown to the cent, except under ten cents, where a cent would be most of the amount: those get three significant digits, so a request costing 0.6¢ shows as $0.006.

The app refreshes rates when they are more than 12 hours old, at start and while it stays open. The CLI refreshes them with reckon --update-rates. Until the first refresh, built-in approximate rates are used. Rates are cached in the data folder (see Files).

Percentages

Operation Example Result
Add or subtract a percentage $10 - 40% $6
Percentage of a value 20% of $10 $2
Add a percentage 5% on $30 $31.50
Subtract a percentage 6% off 40 EUR €37.60
One value as a % of another $50 as a % of $100 50%
Increase as a % $70 as a % on $20 250%
Decrease as a % $20 as a % off $70 71.4286%
Value from its percentage 5% of what is 6 EUR €120
Value before an increase 5% on what is 6 EUR €5.71
Value before a decrease 5% off what is 6 EUR €6.32

Variables, previous result, sum and average

v = $20
v2 = 5%
v times 7 - v2        → $133
prev + $10            → $143

sum (or total) adds every result since the last blank line or header. avg (or average, mean) averages them. Lines that are themselves sum/avg are not counted again.

Variable names start with a letter and contain letters, digits or _. A variable shadows a unit or function with the same name.

Functions

Arguments go in parentheses separated by ; (or ,), or follow the function name directly.

Function Example
sqrt, cbrt sqrt 16, sqrt(16 m^2) → 4 m
root n (x) root 2 (8)
log x (base 10), log b (x) log 1000, log 2 (8)
ln, exp ln 3
abs, round, ceil, floor round(3.456; 2) → 3.46 (keeps units)
fact / factorial fact 5
sin, cos, tan sin 45°. Plain numbers are radians.
arcsin, arccos, arctan, sinh, cosh, tanh arctan 1
fromunix fromunix(1446587186)

Plugins can add more; see plugins.md.

Lists and statistics

A list is several values in square brackets, separated by commas or semicolons. It can be kept in a variable.

weights = [3 kg, 500 g, 2 kg]     → [3 kg, 0.5 kg, 2 kg]
median(weights)                   → 2 kg
stdev(weights)                    → 1.2583 kg

A list too wide for its result shows its first values and a count: [48 km, … 12 values]. In the desktop app a list's result takes whatever room its line leaves, so a short line shows more values. Clicking the result (or ⇧⌘C) copies every value, ready to paste into a spreadsheet or a sheet.

In the desktop app, a list too long for one line is drawn folded while the cursor is elsewhere: new = [405.6, 204.4, 95.3, … 200 values], with the count dimmed. Click it, or move the cursor onto it, to see and edit every value; it folds again when the cursor leaves.

The values of a list share one unit: the first unit written. Inside the brackets a comma always separates values, so [1,200] is two numbers; write 1200 for twelve hundred. A list can be built from other lists: all = [weights, 4 kg].

Function Result
sum, mean (or avg, average) Total and average
median Middle value
stdev (or stddev), variance Sample standard deviation and variance (divide by n − 1)
pstdev, pvariance The same for a whole population (divide by n)
count How many values

Each takes a list, several values, or both: median(3, 1, 2), mean(weights, 4 kg). median, stdev, variance, pstdev and pvariance written alone use the lines above, exactly as sum does:

10
20
60
median                → 20
stdev                 → 26.4575

Straight-line fit

These take the x values first and the y values second, as two lists of the same length. This is the opposite order to SLOPE and INTERCEPT in spreadsheets.

hours = [1 h, 2 h, 3 h, 4 h]
km = [48 km, 105 km, 149 km, 205 km]
slope(hours, km)                  → 51.5 km/h
intercept(hours, km)              → -2 km
predict(hours, km, 90 min)        → 75.25 km
correlation(hours, km)            → 0.9988
Function Result
slope(x, y) Change in y for each unit of x
intercept(x, y) Value of y where x is zero
predict(x, y, value) Value of y on the line at the given x
correlation(x, y) (or corr, correl) Pearson correlation, from −1 to 1
rsquared(x, y) (or r2) Share of the variation in y that the line explains

The line is fitted by ordinary least squares. count and the functions in this table are only functions when followed by (, so a note such as head count 12 still gives 12.

Comparing two methods

When x and y are the same quantity measured two ways, such as a reference method and a new analyser on the same samples, three line fits are usually read side by side. The methods agree when the slope's 95% confidence interval holds 1 and the intercept's holds 0. The sample sheet "Method comparison" shows all three on the same data.

slope_ci(reference, new)          → [0.986, 1.0576]
pb_slope(reference, new)          → 1.0262
pb_slope_ci(reference, new)       → [0.9994, 1.0602]
deming_intercept_ci(reference, new) → [-4.2115, 12.8468]
Function Result
slope_ci(x, y), intercept_ci(x, y) 95% confidence interval of the least-squares slope or intercept
pb_slope(x, y), pb_intercept(x, y) Passing-Bablok line
pb_slope_ci(x, y), pb_intercept_ci(x, y) Its 95% confidence intervals
deming_slope(x, y), deming_intercept(x, y) Deming line
deming_slope_ci(x, y), deming_intercept_ci(x, y) Its 95% confidence intervals
ba_bias(x, y), ba_bias_ci(x, y) Bland-Altman bias (mean difference) and its 95% confidence interval
ba_limits(x, y) 95% limits of agreement
ba_lower_ci(x, y), ba_upper_ci(x, y) 95% confidence interval of each limit

An interval is a list of two values, lower first. For Passing-Bablok and Deming, y is converted to x's unit, the slope has no unit, and the intercept is in x's unit.

Charts

A chart is a result: write it as a function and the desktop app draws it small where the result goes. The line grows to hold it, three lines for a scatter or Bland-Altman plot, two for bars and one for a line chart, so it never covers the lines below. The sample sheet "Charts" shows all four.

Function Chart
scatter(x, y) y against x, with a fitted line
bland_altman(x, y) Each pair's difference (y − x) against its average, with the bias and the 95% limits of agreement
bars(list) Bars for the values in order
line(list) A line through the values in order

line( and bars( are charts only when written as a call, so notes that use the words are unchanged.

Importing data

Columns of numbers from a spreadsheet become lists, one per column, named after the column headings:

# Data from glucose.xlsx
// 30 rows. Left out: “Sample” (not numbers).
reference_mg_dl = [398.8, 183.6, 88.2, …]
new_analyser_mg_dl = [405.6, 204.4, 95.3, …]

In the desktop app:

How a table is read:

The phone apps cannot import files yet.

AI and machine learning

Rough numbers for models: memory, compute, time and cost. The sample sheet "AI and GPU math" has a worked example of each.

Units

Unit Written as
Parameters params, parameters; 70B params is 70 billion
Tokens tokens, tok, ktok, Mtok, Btok, Ttok, million tokens; 2T tokens is 2 trillion
Floating-point operations FLOP or FLOPs, with prefixes: PFLOP, EFLOP, ZFLOP
Operations per second FLOPS or flops, with prefixes: TFLOPS, teraflops
Number formats fp64, fp32, tf32, fp16, bf16, fp8, int8, fp6, int4, fp4, nf4: the bytes one value takes

7B on its own is still seven bytes; it means billions only before params or tokens.

Parameters, tokens and FLOP are counts with no dimension, so they combine the way rough estimates do. Different kinds of count do not add up or convert into each other: 3 tokens + 2 params is an error.

70B params * bf16 in GB                     → 140 GB
kv = 2 * 80 * 8 * 128 * bf16 / token        → 327,680 B/tok
kv * 32768 tokens * 8 in GiB                → 80 GiB
6 * 70B params * 2T tokens in ZFLOP         → 840 ZFLOP
840 ZFLOP / (1024 * 989 TFLOPS * 40%) in days → 23.9999 days
1500 tokens/s * 1 h in Mtok                 → 5.4 Mtok
50M tokens * $3/Mtok                        → $150
$2.50/h / (1500 tokens/s) in $/Mtok         → $0.46/Mtok

A plain number converted to a count is taken as single units: 8.4e22 in EFLOP gives 84,000 EFLOP. Counts multiplied into a quantity are shown in that quantity's unit (parameters × bytes shows as bytes) and still cancel later.

Functions

Function Result
sigmoid(x), logit(p) The logistic function and its inverse
softmax(scores) A list of probabilities that sum to 1
logsumexp(scores) ln Σ eˣ, without overflow
log2(x) Logarithm base 2
perplexity(loss) e to the power of a loss in nats per token

Comparing models on an evaluation set

Function Result
accuracy_ci(correct, total) 95% interval for an accuracy (Wilson score), as percentages. accuracy_ci(82%, 500) also works.
mcnemar(b, c) p-value for two models scored on the same items, where b items only the first got right and c only the second. Exact below 25 disagreements, chi-squared with continuity correction above.
mcnemar(a, b) The same from two lists of per-item results, 1 for right and 0 for wrong
paired_ci(a, b) 95% interval for the mean difference b − a of per-item scores (Student's t)
items_needed(accuracy, margin) Items needed for the 95% interval of that accuracy to be ± margin: items_needed(80%, 2%) → 1,537
holm(p-values) Holm's adjustment for many comparisons, in the order given

These names are functions only when followed by (, except sigmoid, logit and log2, which work like sqrt. All were checked against R.

Dates and times

today, tomorrow, yesterday, now, time
today + 2 weeks           calendar-aware: Jan 31 + 1 month → Feb 28
3 days ago
2 hours from now
March 5 2027 - today      → 118 days
2026-12-25 - today
5 March 2025
2:30 pm - 9:15 am         → 5.25 h
fromunix(1446587186)

Adding whole days, weeks, months or years moves the calendar date, so it handles daylight saving time and month lengths. Fractional amounts are converted to seconds.

Time zones

PST time
New York time
time in Madrid
now in Tokyo
2:30 pm HKT in Berlin
3pm UTC+2

Zones can be city or country names (about 180 built in), abbreviations (PST, CET, IST, JST, …; uppercase only) or IANA names (Europe/Berlin). On macOS and Linux, offsets and daylight saving time come from the system zoneinfo database. Abbreviations follow the region's current clock, so PST gives Pacific time all year. On Windows, named zones use fixed standard offsets.

Subtracting two "current time" values gives the wall-clock difference: Tokyo time - London time → 9 h.

Desktop app shortcuts

The shortcuts follow each system's conventions. On Windows and Linux, use Ctrl instead of ⌘ unless the table gives a different key.

Action macOS Windows and Linux
Settings ⌘, Ctrl+,
Larger / smaller text ⌘+ / ⌘− Ctrl++ / Ctrl+−
Text back to its normal size ⌘0 Ctrl+0
Show or hide the sheets sidebar ⌃⌘S (or the sidebar button in the toolbar) Ctrl+B
Full screen ⌃⌘F F11
Minimize the window ⌘M the title bar's button
Close the window ⌘W Alt+F4
Hide Reckon / hide other apps ⌘H / ⌥⌘H
Quit ⌘Q Ctrl+Q

Editing and sheets:

Action Shortcut
Copy result of current line ⇧⌘C (or click a result)
Copy all lines with results ⌥⌘C
Wrap line or selection in parentheses ⇧⌘0
Delete all ⌥⌘⌫
Open (import) a file ⌘O
Import data from CSV or Excel ⇧⌘I
Paste copied cells as lists ⇧⌘V
Export to a file ⌘S
Undo / redo ⌘Z / ⇧⌘Z
Choose a theme ⌘K then ⌘T (or click the theme name in the status bar)
New sheet ⌘N
Find a sheet (search) ⌘P
Quick calc from any app ⌃⌥Space (Ctrl+Alt+Space on Windows)

Sheets save automatically. Opening a file copies its text into the current sheet but never modifies the original; use Export to write a file.

The window

A toolbar runs along the top of the window. From left to right: a button that shows or hides the sheets sidebar, the open sheet's title, a + for a new sheet and a gear that opens Settings.

Reckon remembers the window's size and position and opens there next time. If that screen is no longer connected, the window moves back into view.

Settings

Press ⌘, (Ctrl+, on Windows and Linux), click the gear in the toolbar, or choose Reckon › Settings… on macOS. Esc, the ✕ or a click outside closes it. Changes apply at once and are saved.

Sheets

Reckon keeps any number of sheets (separate pages), like a notes app: one for a trip budget, one for splitting rent, one for an invoice.

A sheet's title is its first line (# Trip budget → "Trip budget"). Each sheet is a plain .reckon file named after its title; the file is renamed when you switch to another sheet, never while you type. Deleted sheets move to a .trash folder inside the sheets folder rather than being erased.

Sample sheets

A new installation starts with a welcome sheet. When a version of Reckon brings a feature worth showing, it also adds one sample sheet for it, on a new installation and on the first start after the update: so far "Lists and statistics", "Method comparison" and "AI and GPU math".

A sample appears in the list just below the sheet you had open; it never replaces the sheet you are working on. It is an ordinary sheet: edit it, or delete it and it does not come back. Reckon records which samples a sheets folder has had in a hidden .samples file inside the folder, so a folder synced between devices gets one copy, not one from each device.

Syncing between devices

Sheets are ordinary files, so any folder-syncing service keeps them in step across devices; Reckon has no server or account.

Edits made on two devices at the same moment are not merged: the last one saved wins.

Quick calc

Press ⌃⌥Space (Ctrl+Alt+Space on Windows) in any app to open a small Reckon box over whatever you are doing. Type a calculation, e.g. 15% of $240 in EUR; the answer appears as you type. Enter copies the answer and closes the box, Esc closes it, and clicking elsewhere closes it too. Nothing is saved to your sheets.

Themes

Every Reckon app (macOS, Windows, Linux, iOS and Android) has the same twelve themes, each built around one idea:

Light Dark
Paper (default) Warm graph paper and fountain-pen ink Graphite (default) White chalk on charcoal, mint answers
Ledger Bookkeeper's green paper with red rules Chalkboard Slate green board, coloured chalk
Dune Sand, terracotta and desert sage Blueprint Drafting-table blue with a white grid
Fjord Crisp Nordic air, slate and glacier teal Nocturne Indigo midnight, violet and aqua
Blossom Petal pink with plum ink and jade Ember Espresso dark with glowing amber
Delft Porcelain white glazed in cobalt Phosphor Green-screen terminal, scanlines and a block cursor

Some themes add a texture (Paper and Blueprint draw a grid, Ledger rules each line, Phosphor has scanlines), a double rule before the results, or a heavier result weight. In every theme, text has at least 7:1 contrast with the background and results and highlights at least 4.5:1; a test checks this.

On the desktop, choose a theme in Settings (⌘,), or press ⌘K then ⌘T (Ctrl+K then Ctrl+T on Windows and Linux), click the theme name at the right of the status bar, or use View › Theme on macOS. In the picker, hovering over a theme or pressing ↑ and ↓ previews it; clicking or Enter keeps it, and Esc (or clicking outside) goes back. The current theme has a ✓, in the picker and in the menu.

On iOS and Android, tap the theme name at the right of the status bar. The list opens over the lower part of the screen without dimming the document, so tapping a theme shows it straight away; the ✓ marks the current one. Phosphor's block cursor is drawn on the desktop and Android; iOS draws its own caret, so there it is a green bar.

Match System switches between a light and a dark theme with the system's appearance. It uses the last light theme and the last dark theme you picked (Paper and Graphite at first). Picking any other theme uses that theme regardless of the system's appearance.

On the desktop the choice is saved in app.conf in the data folder (the phone apps keep it in their own settings):

theme_mode = system        # or "fixed"
theme = Blueprint          # used when theme_mode = fixed
light_theme = Ledger       # used when theme_mode = system
dark_theme = Nocturne
font_size = 16.5           # text size (10.5 to 30.5)
window = 286,191,940,600   # last window position and size: x,y,width,height

Files

Platform Data folder
macOS ~/Library/Application Support/Reckon
Windows %APPDATA%\Reckon
Linux $XDG_CONFIG_HOME/reckon or ~/.config/reckon

The folder contains sheets/ (your sheets, unless you chose another folder), app.conf (settings: theme, sheets folder, quick-calc shortcut), rates.txt (cached exchange rates) and plugins/. An old single document.reckon is moved into the sheets folder on first start. Set RECKON_HOME to use a different folder.

Limits

These keep a damaged or hostile file from hanging or crashing the app; you are unlikely to meet them in normal use.

CLI

reckon '20 inches in cm'
reckon -a -f budget.reckon      print each line next to its result
cat notes.reckon | reckon       one result per input line
reckon                          interactive REPL
reckon -d samples.csv 'pb_slope_ci(reference, new)'
                                load a CSV or Excel file's columns as lists
reckon --import samples.xlsx    print a file's columns as sheet lines
reckon --update-rates           download current exchange rates
reckon --rates | --plugins      show rate source / loaded plugins

Run reckon --help for all options (--precision, --24h, …).

Plugins

A plugin is a plain-text file with the .reckon extension in the plugins folder inside the data folder:

Platform Plugin folder
macOS ~/Library/Application Support/Reckon/plugins
Windows %APPDATA%\Reckon\plugins
Linux ~/.config/reckon/plugins

Plugins load when the app or CLI starts, in file-name order. To list what loaded and any errors, run:

reckon --plugins

The app also shows the first plugin error in its status bar.

Plugins use Reckon's own expression language rather than JavaScript. That keeps the engine free of an embedded script runtime, and anything you can type in a document works in a plugin.

Syntax

Each non-empty line is one definition. Lines starting with # or // are comments.

Units

unit <id> "<phrase>, <phrase>, ..." = <value with a unit>
unit floz  "fl oz, fluid ounce, fluid ounces" = 29.5735 ml
unit horse "horse, horses" = 2.4 m
unit grand "grand, grands" = 1000 USD
unit dozen "dozen, dozens" = 12

Variables

var <name> = <expression>
var tax = 8.25%
var rent = $1,450

let works too. Variables are visible in every document. A variable defined in the document itself takes priority.

Functions

fn <name>(<param>; <param>; ...) = <expression>
fn hypot(a; b) = sqrt(a^2 + b^2)
fn compound(principal; rate; years) = principal * (1 + rate) ^ years
fn tip(bill) = bill * 18%

Call them like built-ins: hypot(3; 4), compound($1000; 5%; 10). Note that inside an arithmetic expression, 5% used with + adds a percentage of the left side (1 + 5% is 1.05), so (1 + rate) above works as expected.

Parameters are evaluated before the call, keep their units, and are visible only in the function body. Functions can call other functions; nesting is limited to 32 levels.

Examples

See examples/plugins. To install one:

mkdir -p ~/Library/Application\ Support/Reckon/plugins
cp examples/plugins/*.reckon ~/Library/Application\ Support/Reckon/plugins/