@@ -10,11 +10,11 @@ A `span` is a set of nouns and an interpretation of these nouns.
10Officially, we don't use the word "type" in Hoon. But if we had
10Officially, we don't use the word "type" in Hoon. But if we had
11to say "type," it would mean `span`.
11to say "type," it would mean `span`.
13−## Span and mold
13+## Type, span and mold
15There is no Hoon syntax for a span. The programmer never defines
15There is no Hoon syntax for a span. The programmer never defines
16a span explicitly. It is always produced as the inferred range
16a span explicitly. It is always produced as the inferred range
17−of an expression (twig).
17+of an expression (`twig`).
19But we still need simple, well-formed expressions that produce
19But we still need simple, well-formed expressions that produce
20regular and well-shaped ranges, for three reasons.
20regular and well-shaped ranges, for three reasons.
@@ -37,15 +37,13 @@ definition of a noun. Don't actually call a mold unless you're
37actually validating untrusted foreign data. As a beginner,
37actually validating untrusted foreign data. As a beginner,
38hopefully you aren't!
38hopefully you aren't!
40−## The `span` mold (simplified)
40+## `span`: a set of nouns
42−Usually in Hoon we define the semantics of a primitive by the
42+Below is the mold for `span`. You haven't seen this syntax before,
43−state the span of all nouns that implement that primitive. We
43+and we haven't explained it yet; just treat it as pseudocode.
44−state this span as the icon of a mold. That mold is produced by
47−This is a slightly simplified version of `span`. We'll undo and
45+This is a slightly simplified version of `span`. We undo and explain the
48−explain the simplifications below.
46+simplifications in the [advanced types](../advanced) section.
51++ term @tas
49++ term @tas
@@ -61,13 +59,11 @@ explain the simplifications below.
64−This is a syntactically correct Hoon twig, but treat it as
65−pseudocode. If a span is an atom, it's either the atomic string
62+If a span is an atom, it's either the atomic string `noun` or
66−`noun` or `void`; if a cell, it's a tuple with one of the heads
63+`void`; if a cell, it's a tuple with one of the heads `atom`,
67−`atom`, `cell`, `core`, etc. We'll go through each of these
64+`cell`, `core`, etc. We'll go through each of these cases below.
70−### `$noun` and `$void`
66+### `?($noun $void)`
72`$noun` is the set of all nouns. `$void` is the set of no nouns.
68`$noun` is the set of all nouns. `$void` is the set of no nouns.
@@ -76,7 +72,7 @@ cases below.
76`{$cell p/span q/span}` is the set of all cells with head `p` and
72`{$cell p/span q/span}` is the set of all cells with head `p` and
79−### `{$fork p/(set span)}
75+### `{$fork p/(set span)}`
81`{$fork p/(set span)}` is the union of all spans in the set `p`.
77`{$fork p/(set span)}` is the union of all spans in the set `p`.
@@ -89,17 +85,17 @@ the product when we compile `q` against subject `p`.
89This is "manual laziness." Hoon is a strict language, so we have
85This is "manual laziness." Hoon is a strict language, so we have
90to express
86to express
92−### `{$face p/term q/span}
88+### `{$face p/term q/span}`
94A `{$face p/term q/span}` wraps the label `p` around the span
90A `{$face p/term q/span}` wraps the label `p` around the span
95`q`. `p` is a `term` or `@tas`, an atomic ASCII string which
91`q`. `p` is a `term` or `@tas`, an atomic ASCII string which
96obeys symbol rules: lowercase and digit only, infix hyphen,
92obeys symbol rules: lowercase and digit only, infix hyphen,
97first character must be lowercase.
93first character must be lowercase.
99−See [`:limb`](twig/limb/limb) for how labels are resolved. It's
95+See [`:limb`](../twig/limb/limb) for how labels are resolved. It's
100nontrivial.
96nontrivial.
102−### `{%atom p/term q/(unit atom))}
98+### `{%atom p/term q/(unit atom))}`
104An `$atom` is an atom, with two twists. `q` is a `unit`, Hoon's
100An `$atom` is an atom, with two twists. `q` is a `unit`, Hoon's
105equivalent of a nullable pointer or a Haskell `Maybe`. If `q`
101equivalent of a nullable pointer or a Haskell `Maybe`. If `q`
@@ -161,7 +157,7 @@ statically, by casting through the empty aura `@`. Hoon is not
161dependently typed and can't statically enforce data constraints
157dependently typed and can't statically enforce data constraints
162(for example, it can't enforce that a `@tas` is really a symbol).
158(for example, it can't enforce that a `@tas` is really a symbol).
164−### `{$core p/span q/(map term span)}
160+### `{$core p/span q/(map term span)}`
166A `$core` is a code-data cell. The data (or *payload*) is the
162A `$core` is a code-data cell. The data (or *payload*) is the
167tail; the code (or *battery*) is the head. `p`, a span, is the
163tail; the code (or *battery*) is the head. `p`, a span, is the