examples/

directory
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2026 License: Apache-2.0

README

Examples

Two layers, two jobs.

  • minimal/ — learn by copying. Small, single-mechanism notebooks (15–65 lines each) meant to be copied into your own project. Start here if you are building your first real notebook.
  • The corpus (this directory) — see what it can do. Larger notebooks that each put one design property under pressure — direct manipulation, linked views, typed units, document rendering, live feeds, native fan-out. 38 of them run live in the browser at go-notebook.dev.

New here? Read these five first, in order:

# Example What it teaches Run
1 minimal/hello the whole model on one screen: input → derived, wired by name+type go tool notebook run ./examples/minimal/hello
2 tempconv a complete notebook end-to-end: controls, an SVG view, a test go tool notebook run ./examples/tempconv
3 minimal/htmlcard rich output the easy way (text/html), and the optional nb package go tool notebook run ./examples/minimal/htmlcard
4 minimal/headless the differentiator: the same file as a browser app and a --headless --json batch job go tool notebook run ./examples/minimal/headless
5 capacity a real interactive planning tool that is also a schedulable job go tool notebook run ./examples/capacity

Then browse minimal/ for a copy-paste recipe per mechanism, or the corpus below for fuller demonstrations.

The corpus by theme

Every corpus notebook is an ordinary Go package — read it as Go. Those marked live run in the browser (their call graph touches no net/os/cgo, so they compile to WASM); the rest are the same file built as a native binary.

Controls and interactioncurvefit (draggable points), anscombe, boundary, fourier, kmeans.

Linked viewslotka, spectrogram, nbody (an invariant exposes "running is not passing").

Document output (HTML)invoice, simpson (a table is the right medium for Simpson's paradox), punchcard.

Systems and HPCcritpath, backfill, roofline, amdahl, fattree, cachepolicy, latencybw, aimd, bdp, reliability, retrystorm, fleet.

Advanced browser integrationsurface (a raw HTML/JS escape hatch), gpulife (WebGPU for browser-side parallelism), turing (native fan-out vs. single-threaded browser execution).

Live feedssensorfeed, homefeed, tickerfeed, apifeed (each is a pure notebook plus a driver/ that pushes data through the set port; see docs/live-feeds.md).

Native or heavyweightlego, seam, portfolio, taxi (DuckDB via cgo), queue.

Numerical and statisticalbayes (reversible recomputation), clt, simpson, curvefit, mandelbrot, percolation, pid, little (dimensional correctness through Go types), consistenthash.

For the full argument the corpus makes — and the design findings that came out of building it — see the paper.

Directories

Path Synopsis
driver command
Command driver is the poller for the apifeed notebook.
Command driver is the poller for the apifeed notebook.
driver command
Command driver is the bidirectional bridge feed for the homefeed notebook.
Command driver is the bidirectional bridge feed for the homefeed notebook.
minimal
csv
setport/driver command
Command driver is the minimal live feed: it increments an integer once a second and POSTs it to a served setport notebook's data-in port.
Command driver is the minimal live feed: it increments an integer once a second and POSTs it to a served setport notebook's data-in port.
driver command
Command driver is the live feed for the sensorfeed notebook.
Command driver is the live feed for the sensorfeed notebook.
driver command
Command driver is the price feed for the tickerfeed notebook.
Command driver is the price feed for the tickerfeed notebook.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL