on master help sign in
Fixes #26: Adds proper anchor tags to sections for linking (#179)
f42f690Daryl Richter
docs/hoon/concepts.md+21−21
@@ -22,7 +22,7 @@ maps poorly onto its semantics. For example, although Hoon is a
22typed language, the term "type" is not formally defined in Hoon.
22typed language, the term "type" is not formally defined in Hoon.
23"Type" is a great word, but Hoon has three separate concepts
23"Type" is a great word, but Hoon has three separate concepts
24which could comfortably claim it. We say "type" all the time; we
24which could comfortably claim it. We say "type" all the time; we
25−mean `span`, or `mold`, or `mark`, or possibly all three.
25+mean [`span`](#span), or `mold`, or `mark`, or possibly all three.
26
26
27Other common programming concepts used only informally in Hoon
27Other common programming concepts used only informally in Hoon
28are "function," "object," "event," "expression," "variable,"
28are "function," "object," "event," "expression," "variable,"
@@ -38,8 +38,8 @@ a few new words is a small price for avoiding this pain point.
38## Concepts
38## Concepts
39
39
40A few major Hoon concepts: `noun` (data), `nock` (interpreter),
40A few major Hoon concepts: `noun` (data), `nock` (interpreter),
41−`mint` (compiler), `span` (type), `twig` (expression), `gate`
41+[`mint`](#mint) (compiler), [`span`](#span) (type), [`twig`](#twig) (expression),
42−(function), `mold` (constructor), `core` (object), `mark`
42+`gate` (function), `mold` (constructor), `core` (object), `mark`
43(protocol).
43(protocol).
44
44
45### `noun` (data value)
45### `noun` (data value)
@@ -82,11 +82,11 @@ it's still fun and useful to [learn more](../../nock).
82
82
83## Compilation concepts
83## Compilation concepts
84
84
85−### `mint` (compiler)
85+### <a name="mint">`mint`</a> (compiler)
86
86
87−[`mint`](mint) is the Hoon compiler. It maps a cell `{span twig}` to a
87+[`mint`](#mint) is the Hoon compiler. It maps a cell `{span twig}` to a
88−cell `{span nock}`, where a `span` is a type, a `twig` is a compiled
88+cell `{span nock}`, where a [`span`](#span) is a type, a [`twig`](#twig)
89−expression (AST), and a `nock` is a Nock formula. `mint` accepts
89+is a compiled expression (AST), and a `nock` is a Nock formula. `mint` accepts
90a subject type and a source expression; it produces a product type
90a subject type and a source expression; it produces a product type
91and an executable formula.
91and an executable formula.
92
92
@@ -105,9 +105,9 @@ which makes your program more readable anyway. Also, the dumber
105the compiler, the easier it is for a dumb human to understand
105the compiler, the easier it is for a dumb human to understand
106what the compiler is thinking.
106what the compiler is thinking.
107
107
108−### `twig` (expression)
108+### <a name="twig">`twig`</a> (expression)
109
109
110−A [`twig`](twig) is a Hoon AST node, the result of parsing a
110+A [`twig`](../reference) is a Hoon AST node, the result of parsing a
111source expression. A Hoon source file encodes one twig.
111source expression. A Hoon source file encodes one twig.
112
112
113As the noun that the parser produces, a twig is a tagged union of
113As the noun that the parser produces, a twig is a tagged union of
@@ -146,12 +146,12 @@ or the tall rune syntax (here on one line, with double spaces):
146%- a b
146%- a b
147```
147```
148
148
149−### `span` (type, as range)
149+### <a name="span">`span`</a> (type, as range)
150
150
151−A [`span`](span) is a Hoon type. It defines a set (finite or
151+A `span` is a Hoon type. It defines a set (finite or
152infinite) of nouns and ascribes some semantics to it. There is
152infinite) of nouns and ascribes some semantics to it. There is
153no syntax for spans; they are always defined by inference (ie, by
153no syntax for spans; they are always defined by inference (ie, by
154−`mint`), usually using a constructor (`mold`).
154+[`mint`](#mint)), usually using a constructor (`mold`).
155
155
156### `gate` (function)
156### `gate` (function)
157
157
@@ -179,7 +179,7 @@ A `mold` is a constructor function (`gate`). Its sample is any
179noun; its product is a structured noun. A mold is idempotent;
179noun; its product is a structured noun. A mold is idempotent;
180`(mold (mold x))` always equals `(mold x)`.
180`(mold (mold x))` always equals `(mold x)`.
181
181
182−Since there's no such thing as a span declaration, we use molds
182+Since there's no such thing as a [`span`](#span) declaration, we use molds
183to define useful spans by example; we also use them to validate
183to define useful spans by example; we also use them to validate
184untrusted network input.
184untrusted network input.
185
185
@@ -193,19 +193,19 @@ The Hoon equivalent is `:var foo atom`. But Hoon has a
193homoiconic heap; there is no inscrutable scope or environment.
193homoiconic heap; there is no inscrutable scope or environment.
194There is just the subject, which is one noun. To "declare a
194There is just the subject, which is one noun. To "declare a
195variable" is to make a cell `[variable old-subject]`, and use it
195variable" is to make a cell `[variable old-subject]`, and use it
196−as the subject of the twig below.
196+as the subject of the [`twig`](#twig) below.
197
197
198−So the label `foo` isn't a key in a symbol table; it's in the
198+So the labe[`twig`](#twig)l `foo` isn't a key in a symbol table; it's in the
199−type (`span`) of the new value. It's not a variable named `foo`,
199+type ([`span`](#span)) of the new value. It's not a variable named `foo`,
200whose value is of type `atom`; it's a subtree of type `foo:atom`.
200whose value is of type `atom`; it's a subtree of type `foo:atom`.
201
201
202−### `limb` (attribute or variable reference)
202+### <a name="limb">`limb`</a> (attribute or variable reference)
203
203
204A [`limb`](../twig/limb/limb), like `foo`, is Hoon's equivalent of a variable
204A [`limb`](../twig/limb/limb), like `foo`, is Hoon's equivalent of a variable
205−reference. A limb is a twig; given a subject span, `mint`
205+reference. A limb is a [`twig`](#twig); given a subject [`span`](#span),
206−resolves it to a Nock formula and a product span.
206+[`mint`](#mint) resolves it to a Nock formula and a product [`span`](#span).
207
207
208−To resolve limb `foo`, `mint` searches the subject depth-first,
208+To resolve limb `foo`, [`mint`](#mint) searches the subject depth-first,
209head-first for either a `face` named `foo`, or a `core` with the
209head-first for either a `face` named `foo`, or a `core` with the
210arm `foo`. If it finds a face, the product is a *leg*, or
210arm `foo`. If it finds a face, the product is a *leg*, or
211subtree of the subject. If it finds a core, it computes the arm
211subtree of the subject. If it finds a core, it computes the arm
@@ -213,7 +213,7 @@ formula with that core as the subject.
213
213
214A limb can also be a slot (direct tree address), like `+15`.
214A limb can also be a slot (direct tree address), like `+15`.
215
215
216−### `wing` (limb path)
216+### `wing` ([`limb`](#limb) path)
217
217
218A [wing](../twig/limb/wing) is a list of limbs. Like attribute references in a
218A [wing](../twig/limb/wing) is a list of limbs. Like attribute references in a
219conventional language, it uses the syntax `a.b.c`, but inside
219conventional language, it uses the syntax `a.b.c`, but inside