10 modules · 146 declarations

The standard library

10 modules under lib/, 146 public declarations between them. A module arrives by name through import; nothing in it is ambient, and nothing is in scope that was not imported.

What counts as the standard library

Three tiers, distinguished by WHY a piece of code is where it is rather than by what it does. The distinction decides where a contributor puts something new, so it is stated here and not left to precedent.

tierwhatwherehow it arrives
1the pinned prelude++prelude in lib/jock.hoonambient — no import, frozen; see the ABI
2a library module written in Jocklib/*.jock — this pageimport <name>; with the directory on --data-dir
3a curated Hoon core, jammedpkgs/*.jam via tools/pkg.shimport <name>; against a built jam

Tier 1 is what a program cannot reasonably be written without, and an addition to it is an ABI event. Tier 2 is what is expressible in Jock without a new ABI arm and that two unrelated programs would both want. Tier 3 is for where substantial tested Hoon already exists and a Jock version would be a rewrite rather than a port — nothing in a tier 3 package is jetted, which is the argument for keeping the tier small.

The modules

modulewhat it istypesarmspinned
hofhigher-order functions over closures and List01818/18
httpthe NockApp http driver, from the Jock side31913/22
intervalinterval arithmetic over exact rationals133/4
nockappthe NockApp host's own effect vocabulary101/1
parserparser combinators73133/38
randdeterministic pseudo-random numbers11110/12
rationalexact rational arithmetic over Int099/9
timecivil dates, ISO 8601, and the Urbit @da102223/32
twoctwo's-complement signed integers at arbitrary bit width177/8
urbitUrbit-native conversions, in Jock022/2

How an arm is pinned

An arm is pinned when an example in examples/ names it. 7 modules have an examples/<name>-arms.jock — a sheet whose every line asserts one arm, which fails the lane if the arm stops doing what the line says. That is the strongest pin a reference can cite, and each arm page quotes the line.

one line of examples/hof-arms.jock

assert hof.compose(inc, dbl)(10) == 21;

An arm named only by an ordinary program is marked a use: the call shape is demonstrated but no assertion fixes the result. An arm named by nothing is marked — and listed on its module page, because a reference that quietly omitted it would read as though the coverage were complete.

What no lane pins

27 of 146 public declarations are named by no example — DIRECTLY; an arm reached only through a pinned caller is not counted. The gap is not spread evenly: 7 modules have an arms sheet and http, nockapp, urbit do not.

What is in the library and not on this site

4 modules are not documented here, and they are left out on purpose rather than pending. Each targets nockchain, and each one’s interface is half of a contract with a driver this project does not own — documenting an arm publishes a surface, and a surface nobody upstream has committed to is one these pages would be promising on someone else’s behalf.

They compile and they are built by tools/modules.sh on every push, so this is a documentation boundary and not a support one. A reader who needs them has the source.

What generates this

tools/stdlib.py parses every top-level declaration in crates/jockc/hoon/lib/*.jock for its kind, name, generic binders and signature, together with the comment block above it, and joins that against the examples that import the module. tools/refgen.py --check regenerates and fails on a diff, so a module that gains an arm reddens a lane until the page is rewritten.

The prose on each arm is the comment in the module source, reproduced and not paraphrased. A paraphrase would be a second copy to maintain, and it is the copy a reader of the source would never see go stale.