on master help sign in
Update most of the docs to Hoon 143, renaming /docs/hoon/twig/cen-call/tis-make/ to /docs/rune/cen/tis/; move atom and limb docs out into /docs/hoon/; move /docs/byte/ to /docs/urbyte/; various formatting and additions
commit9bc0b515faa99b103bfe2e672494aa2dfd014540 authorKeaton Dunsford <keaton@tlon.io> dateThu 14 Dec 2017, 07:41 (9 years ago) parent46df806
178 files changed+2677−3373
docs.md+2−2 docs/about/glossary.md+10−10 docs/arvo/generators.md+2−2 docs/hoon/advanced.md+47−47 docs/hoon/twig/atom.md → docs/hoon/atom.md+3−2 docs/hoon/twig/atom/knit.md → docs/hoon/atom/knit.md+4−4 docs/hoon/twig/atom/path.md → docs/hoon/atom/path.md+7−6 docs/hoon/twig/atom/rock.md → docs/hoon/atom/rock.md+4−4 docs/hoon/twig/atom/sand.md → docs/hoon/atom/sand.md+3−3 docs/hoon/basic.md+23−23 docs/hoon/cheat-sheet.md+38 docs/hoon/concepts.md+2−2 docs/hoon/examples.md+146−147 docs/hoon/exercises.md+2−1 docs/hoon/irregular.md+74−90 docs/hoon/library.md+1−1 docs/hoon/twig/limb.md → docs/hoon/limb.md+5−3 docs/hoon/twig/limb/limb.md → docs/hoon/limb/limb.md+13−12 docs/hoon/twig/limb/wing.md → docs/hoon/limb/wing.md+4−3 docs/hoon/mission.md+1−1 docs/hoon/reference.md+27−25 docs/hoon/rune.md+77 docs/hoon/rune/bar.md+27 docs/hoon/twig/bar-core/cab-door.md → docs/hoon/rune/bar/cab.md+7−24 docs/hoon/twig/bar-core/cen-core.md → docs/hoon/rune/bar/cen.md+6−18 docs/hoon/rune/bar/col.md+26 docs/hoon/rune/bar/dot.md+58 docs/hoon/rune/bar/hep.md+52 docs/hoon/twig/bar-core/ket-cork.md → docs/hoon/rune/bar/ket.md+6−21 docs/hoon/rune/bar/sig.md+31 docs/hoon/rune/bar/tar.md+57 docs/hoon/rune/bar/tis.md+49 docs/hoon/twig/bar-core/wut-tray.md → docs/hoon/rune/bar/wut.md+5−15 docs/hoon/twig/buc-mold.md → docs/hoon/rune/buc.md+9−8 docs/hoon/rune/buc/base.md+34 docs/hoon/rune/buc/cab.md+42 docs/hoon/rune/buc/cen.md+45 docs/hoon/twig/buc-mold/col-bank.md → docs/hoon/rune/buc/col.md+8−19 docs/hoon/rune/buc/hep.md+35 docs/hoon/rune/buc/ket.md+41 docs/hoon/twig/buc-mold/pat-claw.md → docs/hoon/rune/buc/pat.md+6−17 docs/hoon/rune/buc/tis.md+41 docs/hoon/rune/buc/wut.md+49 docs/hoon/rune/cen.md+16 docs/hoon/rune/cen/cab.md+39 docs/hoon/rune/cen/dot.md+29 docs/hoon/twig/cen-call/hep-call.md → docs/hoon/rune/cen/hep.md+10−20 docs/hoon/rune/cen/ket.md+28 docs/hoon/rune/cen/lus.md+28 docs/hoon/rune/cen/sig.md+42 docs/hoon/twig/cen-call/tar-bake.md → docs/hoon/rune/cen/tar.md+9−13 docs/hoon/twig/cen-call/tis-make.md → docs/hoon/rune/cen/tis.md+9−7 docs/hoon/rune/col.md+16 docs/hoon/rune/col/cab.md+27 docs/hoon/rune/col/hep.md+51 docs/hoon/rune/col/ket.md+32 docs/hoon/rune/col/lus.md+31 docs/hoon/rune/col/sig.md+47 docs/hoon/rune/col/tar.md+54 docs/hoon/twig/dot-nock.md → docs/hoon/rune/dot.md+4−3 docs/hoon/twig/dot-nock/ket-wish.md → docs/hoon/rune/dot/ket.md+4−3 docs/hoon/twig/dot-nock/lus-bump.md → docs/hoon/rune/dot/lus.md+5−3 docs/hoon/twig/dot-nock/tar-nock.md → docs/hoon/rune/dot/tar.md+6−19 docs/hoon/twig/dot-nock/tis-same.md → docs/hoon/rune/dot/tis.md+8−8 docs/hoon/rune/dot/wut.md+27 docs/hoon/rune/ket.md+19 docs/hoon/twig/ket-cast/bar-iron.md → docs/hoon/rune/ket/bar.md+6−11 docs/hoon/twig/ket-cast/hep-cast.md → docs/hoon/rune/ket/hep.md+8−24 docs/hoon/rune/ket/lus.md+26 docs/hoon/twig/ket-cast/sig-burn.md → docs/hoon/rune/ket/sig.md+5−9 docs/hoon/twig/ket-cast/tis-name.md → docs/hoon/rune/ket/tis.md+9−6 docs/hoon/twig/ket-cast/wut-lead.md → docs/hoon/rune/ket/wut.md+5−11 docs/hoon/twig/sem-make.md → docs/hoon/rune/sem.md+3−3 docs/hoon/twig/sem-make/col-wad.md → docs/hoon/rune/sem/col.md+13−19 docs/hoon/twig/sem-make/fas-nub.md → docs/hoon/rune/sem/fas.md+3−6 docs/hoon/twig/sem-make/sem-fry.md → docs/hoon/rune/sem/sem.md+5−25 docs/hoon/twig/sem-make/sig-dip.md → docs/hoon/rune/sem/sig.md+16−14 docs/hoon/twig/sig-hint.md → docs/hoon/rune/sig.md+4−3 docs/hoon/twig/sig-hint/bar-show.md → docs/hoon/rune/sig/bar.md+8−7 docs/hoon/twig/sig-hint/buc-poll.md → docs/hoon/rune/sig/buc.md+5−8 docs/hoon/twig/sig-hint/cab-lurk.md → docs/hoon/rune/sig/cab.md+8−7 docs/hoon/twig/sig-hint/cen-fast.md → docs/hoon/rune/sig/cen.md+8−6 docs/hoon/twig/sig-hint/fas-funk.md → docs/hoon/rune/sig/fas.md+6−8 docs/hoon/rune/sig/gal.md+34 docs/hoon/twig/sig-hint/gar-hint.md → docs/hoon/rune/sig/gar.md+7−16 docs/hoon/twig/sig-hint/lus-memo.md → docs/hoon/rune/sig/lus.md+8−6 docs/hoon/twig/sig-hint/pam-dump.md → docs/hoon/rune/sig/pam.md+7−6 docs/hoon/twig/sig-hint/tis-ddup.md → docs/hoon/rune/sig/tis.md+8−6 docs/hoon/twig/sig-hint/wut-warn.md → docs/hoon/rune/sig/wut.md+15−9 docs/hoon/rune/sig/zap.md+38 docs/hoon/rune/tis.md+35 docs/hoon/rune/tis/bar.md+36 docs/hoon/rune/tis/col.md+31 docs/hoon/twig/tis-flow/dot-set.md → docs/hoon/rune/tis/dot.md+7−18 docs/hoon/twig/tis-flow/fas-var.md → docs/hoon/rune/tis/fas.md+7−30 docs/hoon/rune/tis/gal.md+39 docs/hoon/twig/tis-flow/gar-per.md → docs/hoon/rune/tis/gar.md+4−9 docs/hoon/rune/tis/hep.md+36 docs/hoon/twig/tis-flow/ket-sip.md → docs/hoon/rune/tis/ket.md+6−17 docs/hoon/rune/tis/lus.md+35 docs/hoon/rune/tis/sem.md+32 docs/hoon/rune/tis/sig.md+36 docs/hoon/twig/tis-flow/tar-aka.md → docs/hoon/rune/tis/tar.md+7−18 docs/hoon/rune/wut.md+35 docs/hoon/rune/wut/bar.md+45 docs/hoon/twig/wut-test/col-if.md → docs/hoon/rune/wut/col.md+23−12 docs/hoon/rune/wut/dot.md+42 docs/hoon/twig/wut-test/gal-deny.md → docs/hoon/rune/wut/gal.md+8−14 docs/hoon/twig/wut-test/gar-sure.md → docs/hoon/rune/wut/gar.md+8−14 docs/hoon/twig/wut-test/hep-case.md → docs/hoon/rune/wut/hep.md+12−33 docs/hoon/twig/wut-test/ket-ifcl.md → docs/hoon/rune/wut/ket.md+7−19 docs/hoon/rune/wut/lus.md+57 docs/hoon/rune/wut/pam.md+45 docs/hoon/twig/wut-test/pat-ifat.md → docs/hoon/rune/wut/pat.md+5−19 docs/hoon/rune/wut/sig.md+34 docs/hoon/twig/wut-test/tis-fits.md → docs/hoon/rune/wut/tis.md+9−13 docs/hoon/twig/wut-test/zap-not.md → docs/hoon/rune/wut/zap.md+7−17 docs/hoon/twig/zap-wild.md → docs/hoon/rune/zap.md+4−3 docs/hoon/rune/zap/gar.md+30 docs/hoon/twig/zap-wild/tis-code.md → docs/hoon/rune/zap/tis.md+5−12 docs/hoon/twig/zap-wild/wut-need.md → docs/hoon/rune/zap/wut.md+4−12 docs/hoon/rune/zap/zap.md+29 docs/hoon/syntax.md+3−3 docs/hoon/troubleshooting.md+22−25 docs/hoon/twig.md−75 docs/hoon/twig/bar-core.md−30 docs/hoon/twig/bar-core/col-gasp.md−30 docs/hoon/twig/bar-core/dot-trap.md−85 docs/hoon/twig/bar-core/hep-loop.md−74 docs/hoon/twig/bar-core/sig-port.md−38 docs/hoon/twig/bar-core/tar-gill.md−74 docs/hoon/twig/bar-core/tis-gate.md−73 docs/hoon/twig/buc-mold/base.md−33 docs/hoon/twig/buc-mold/cab-shoe.md−58 docs/hoon/twig/buc-mold/cen-book.md−54 docs/hoon/twig/buc-mold/hep-lamb.md−49 docs/hoon/twig/buc-mold/ket-bush.md−55 docs/hoon/twig/buc-mold/tis-coat.md−49 docs/hoon/twig/buc-mold/wut-pick.md−60 docs/hoon/twig/cen-call.md−15 docs/hoon/twig/cen-call/cab-keep.md−55 docs/hoon/twig/cen-call/dot-lace.md−37 docs/hoon/twig/cen-call/ket-calq.md−36 docs/hoon/twig/cen-call/lus-calt.md−36 docs/hoon/twig/cen-call/sig-open.md−45 docs/hoon/twig/col-cell.md−15 docs/hoon/twig/col-cell/cab-scon.md−34 docs/hoon/twig/col-cell/hep-cons.md−51 docs/hoon/twig/col-cell/ket-conq.md−44 docs/hoon/twig/col-cell/lus-cont.md−42 docs/hoon/twig/col-cell/sig-conl.md−68 docs/hoon/twig/col-cell/tar-conp.md−78 docs/hoon/twig/dot-nock/wut-deep.md−32 docs/hoon/twig/ket-cast.md−17 docs/hoon/twig/ket-cast/lus-like.md−29 docs/hoon/twig/sig-hint/gal-thin.md−39 docs/hoon/twig/sig-hint/zap-peep.md−38 docs/hoon/twig/tis-flow.md−34 docs/hoon/twig/tis-flow/bar-new.md−52 docs/hoon/twig/tis-flow/col-fix.md−42 docs/hoon/twig/tis-flow/gal-rap.md−35 docs/hoon/twig/tis-flow/hep-nip.md−47 docs/hoon/twig/tis-flow/lus-pin.md−46 docs/hoon/twig/tis-flow/sem-rev.md−43 docs/hoon/twig/tis-flow/sig-tow.md−50 docs/hoon/twig/wut-test.md−31 docs/hoon/twig/wut-test/bar-or.md−54 docs/hoon/twig/wut-test/dot-lest.md−57 docs/hoon/twig/wut-test/lus-deft.md−79 docs/hoon/twig/wut-test/pam-and.md−54 docs/hoon/twig/wut-test/sig-ifno.md−44 docs/hoon/twig/zap-wild/gar-wrap.md−33 docs/hoon/twig/zap-wild/zap-fail.md−32 docs/nock.md+1−1 docs/byte.md → docs/urbyte.md docs/byte/0.md → docs/urbyte/0.md docs/byte/1.md → docs/urbyte/1.md docs/byte/2.md → docs/urbyte/2.md+6−7
docs.md+2−2
@@ -7,7 +7,7 @@ sort: 4
77
88<div class="lead">
99 <div class="logo inverse"></div>
10− <h1 class="blue i-b">Urbit docs</h1>
10+ <h1 class="i-b">Urbit docs</h1>
1111</div>
1212
1313<div class="col-md-12 head">
@@ -19,7 +19,7 @@ sort: 4
1919Check out the [technical overview](about/overview) for a high-level
2020architecture description. To install and run Urbit, head to the Using section, starting with the [installation guide](using/install) and continuing forward.
2121
22−To begin developing for Urbit, start by walking through [Urbytes](byte/0). After that, delve into Hoon [syntax](hoon/syntax) directly, then walk through the [Arvo tutorials](arvo). The examples and exercises in Arvo will teach you to build high-level programs and interact with the network.
22+To begin developing for Urbit, start by walking through [Urbytes](urbyte/0). After that, delve into Hoon [syntax](hoon/syntax) directly, then walk through the [Arvo tutorials](arvo). The examples and exercises in Arvo will teach you to build high-level programs and interact with the network.
2323
2424Dig into the mechanics of Urbit with [Core Hoon](hoon). Refer back
2525there for pure-code exercises and functions in the [standard library](hoon/library).
docs/about/glossary.md+10−10
@@ -140,7 +140,7 @@ Some common auras and their aliases:
140140- <h6 id="-aura-char">char:</h6> (`@tD`): a character, a single unicode byte (for multi-byte
141141 characters and codepoints, see `@c`)
142142
143−You can find the list of all auras [here](../../hoon/twig/atom/sand/).
143+You can find the list of all auras [here](../../hoon/atom/sand/).
144144
145145*See [basic types](../../hoon/basic/#-atom-p-term-q-unit-atom)*.
146146
@@ -173,7 +173,7 @@ A face is a type that wraps a named symbol (of [aura](#-aura)
173173
174174A _gate_ is a [core](#-core) with one [arm](#-arm) -- Hoon's closest
175175analog to a function/lambda/closure. To call a gate on an argument,
176−replace the sample (at [tree address](../../hoon/twig/limb/limb/) `+6`
176+replace the sample (at [tree address](../../hoon/limb/limb/) `+6`
177177in the core) with the argument, and then compute the arm.
178178
179179The payload of a gate has a shape of `[sample context]`.
@@ -181,8 +181,8 @@ The payload of a gate has a shape of `[sample context]`.
181181- <h6 id="-gate-sample">sample:</h6> the argument tuple
182182- <h6 id="-gate-context">context:</h6> the subject in which the gate was defined
183183
184−*See [basic types](../../hoon/basic/#-core-p-span-q-map-term-span),
185−[`%-` ("cenhep")](../../hoon/twig/cen-call/hep-call/) (the
184+*See [basic types](../../hoon/basic/#-core-p-type-q-map-term-type),
185+[`%-` ("cenhep")](../../hoon/rune/cen-call/hep-call/) (the
186186[rune](#-rune) for calling a `gate`).*
187187
188188#### <h4 id="-a-hoon">hoon</h4>
@@ -234,7 +234,7 @@ found, the result is the product of the arm.
234234- <h6 id="-limb-wing">wing:</h6> a list of limbs, searched from right to left (`a.b` means
235235 `b` within `a`).
236236
237−*See [Limbs and wings](../../hoon/twig/limb/)*
237+*See [Limbs and wings](../../hoon/limb/)*
238238
239239#### loobean
240240
@@ -284,7 +284,7 @@ Here's some common mold terminology:
284284 sample
285285- <h6 id="-mold-icon">icon:</h6> the type of the mold's range
286286
287−*See [mold hoons](../../hoon/twig/buc-mold/).*
287+*See [mold hoons](../../hoon/rune/buc-mold/).*
288288
289289#### nest
290290
@@ -302,10 +302,10 @@ error. This is one of the most commons errors in Hoon programming.
302302A Hoon _rune_ is a pair of ASCII symbols used to begin a
303303[Hoon expression](#-a-hoon).
304304
305−For example, the rune [`?:`](../../hoon/twig/wut-test/col-if/) is
305+For example, the rune [`?:`](../../hoon/rune/wut-test/col-if/) is
306306Hoon's most common conditional, a branch on a boolean test. The first
307307symbol in a rune represents a family of related runes. For example, the
308−[`?` family](../../hoon/twig/wut-test/) are all conditionals.
308+[`?` family](../../hoon/rune/wut-test/) are all conditionals.
309309
310310The result of parsing a Hoon source expression&mdash;the rune, followed
311311by its respective children&mdash;into an AST node is simply called
@@ -338,7 +338,7 @@ Tall hoons can contain flat hoons, but not vice versa. All irregular
338338forms are flat.
339339
340340*See [hoon concept](../../hoon/concepts/#-hoon),
341−[expressions](../../hoon/twig/), and [syntax](../../hoon/syntax/)*.
341+[expressions](../../hoon/rune/), and [syntax](../../hoon/syntax/)*.
342342
343343#### slot
344344
@@ -361,5 +361,5 @@ All types are assembled out of base types defined in `++type`.
361361does type-inference on a program, it assembles complex types out
362362of the simpler built-in types.
363363
364−*See [basic types](../../hoon/basic/#-type-span-and-mold).*
364+*See [basic types](../../hoon/basic/).*
365365
docs/arvo/generators.md+2−2
@@ -1,6 +1,6 @@
11---
2−navhome: '/docs'
3−next: True
2+navhome: /docs/
3+next: true
44sort: 18
55title: Using generators with apps
66---
docs/hoon/advanced.md+47−47
@@ -1,13 +1,13 @@
11---
22navhome: /docs/
3−sort: 16
43next: true
4+sort: 20
55title: Advanced types
66---
77
88# Advanced types
99
10−As we noted, the definition of `span` in the last chapter is a
10+As we noted, the definition of `type` in the last chapter is a
1111subset. The Hoon type system is simple, but not *that* simple.
1212
1313The good news is that you can *skip this section*, at least when
@@ -15,73 +15,73 @@ you're first learning Hoon. Polymorphism and aliasing are mainly
1515for advanced programmers writing complex infrastructure and/or
1616large functions. Don't worry about them for a little while.
1717
18−## The complete, uncensored `span`
18+## The complete, uncensored `type`
1919
2020```
21−++ span $@ $? $noun
22− $void
23− == $% {$atom p/term q/(unit atom)}
24− {$cell p/span q/span}
25− {$core p/span q/coil}
26− {$face p/$@(term tune) q/span}
27− {$fork p/(set span)}
28− {$hold p/span q/twig}
21+++ type $@ $? %noun
22+ %void
23+ == $% [%atom p=term q=(unit atom)]
24+ [%cell p=type q=type]
25+ [%core p=type q=coil]
26+ [%face p=$@(term tune) q=type]
27+ [%fork p=(set type)]
28+ [%hold p=type q=hoon]
2929 ==
3030::
31−++ coil $: p/?($gold $iron $lead $zinc)
32− q/span
33− r/{p/?($~ ^) q/(map term foot)}
31+++ coil $: p=?(%gold %iron %lead %zinc)
32+ q=type
33+ r=[p=?(~ ^) q=(map term foot)]
3434 ==
35−++ foot $% {$dry p/twig}
36− {$wet p/twig}
35+++ foot $% [%dry p=hoon]
36+ [%wet p=hoon]
3737 ==
3838++ tune
39− $: p/(map term (unit twig))
40− q/(list twig)
39+ $: p=(map term (unit hoon))
40+ q=(list hoon)
4141 ==
4242```
4343
44−If you compare this to the basic `span`, you'll see that we've
45−changed two stems: `$core` and `$face`. We added polymorphism to
46−`$core`, aliases and bridges to `$face`.
44+If you compare this to the basic `type`, you'll see that we've
45+changed two stems: `%core` and `%face`. We added polymorphism to
46+`%core`, aliases and bridges to `%face`.
4747
48−## `$core`: advanced polymorphism
48+## `%core`: advanced polymorphism
4949
5050If cores never changed, we wouldn't need polymorphism. Of
5151course, nouns are immutable and never change, but we use them as
5252templates to construct new nouns around.
5353
54−Suppose we take a core, a cell `{battery payload}`, and replace
54+Suppose we take a core, a cell `[battery payload]`, and replace
5555the payload with a different noun. Then, we invoke an arm from
5656the battery.
5757
5858Is this legal? Does it make sense? Every function call in Hoon
5959does this, so we'd better make it work well.
6060
61−The full core stores both payload spans. The span that describes
62−the payload currently in the core is `p`. The span that describes
61+The full core stores both payload types. The type that describes
62+the payload currently in the core is `p`. The type that describes
6363the payload the core was compiled with is `q.q`.
6464
6565In the Bertrand Meyer tradition of type theory, there are two
6666forms of polymorphism: variance and genericity. In Hoon this
6767choice is per arm, which is why our battery went from `(map term
68−twig)` to `(map term foot)` when it went into the coil. A `foot`
69−is `$dry` or `$wet`. Dry polymorphism relies on variance; wet
68+hoon)` to `(map term foot)` when it went into the coil. A `foot`
69+is `%dry` or `%wet`. Dry polymorphism relies on variance; wet
7070polymorphism relies on genericity.
7171
7272### Dry arms
7373
7474For a dry arm, we apply the Liskov substitution principle: we
7575ask, "can we use any `p` as if it was a `q.q`?" This is the same
76−test as in `:cast` or any type comparison (`nest`). Intuitively,
76+test as in `^-` ("kethep") or any type comparison (`nest`). Intuitively,
7777we ask: "is the new payload compatible with the old payload?"
7878
7979For a core `a`, if `p.a` fits in `q.q.a`, we can use arms on the
80−core. The product of a dry arm whose twig is `b` is always
81−defined as `{$hold a(p q.q.a, p.q %gold) b}`.
80+core. The product of a dry arm whose hoon is `b` is always
81+defined as `[%hold a(p q.q.a, p.q %gold) b]`.
8282
8383In other words, the subject of the arm computation is the
84−original core span. The span of the modified payload, `p`, is
84+original core type. The type of the modified payload, `p`, is
8585thrown away. This is of course the normal behavior of a function
8686call in most languages.
8787
@@ -94,7 +94,7 @@ replaces it with another core which does something useful.
9494For core `b` to nest within core `a`, the batteries of `a` and
9595`b` must have the same tree shape, and the product of each `b`
9696arm must nest within the product of the `a` arm. Wet arms (see
97−below) are not compatible unless the twig is exactly the same.
97+below) are not compatible unless the hoon is exactly the same.
9898
9999But we also apply a payload test that depends on the rules of
100100variance. Again, this is traditional Meyer type theory; don't
@@ -102,8 +102,8 @@ worry if you don't know it. These rules should make sense if you
102102just think about them intuitively.
103103
104104Each core has a "metal" `p.q` which defines its variance model.
105−A core can be *invariant* (`$gold`), *bivariant* (`$lead`),
106−*covariant* (`$zinc`), or *contravariant* (`$iron`). The default
105+A core can be *invariant* (`%gold`), *bivariant* (`%lead`),
106+*covariant* (`%zinc`), or *contravariant* (`%iron`). The default
107107is gold; a gold core can be cast or converted to any metal, and
108108any metal can be cast or converted to lead.
109109
@@ -132,29 +132,29 @@ For a wet arm, we ask: "suppose this core was actually compiled
132132using `p` instead of `q.q`?" Would the Nock formula we generated
133133for `q.q` actually work for a `p` payload?
134134
135−A wet arm with twig `b` in core `a` produces the span `{$hold a
136−b}`. Assuming `a` has a modified payload, this will (lazily)
135+A wet arm with hoon `b` in core `a` produces the type `[%hold a
136+b]`. Assuming `a` has a modified payload, this will (lazily)
137137analyze the arm with the caller's modified payload, `p`.
138138
139139But of course, we don't actually recompile the arm at runtime.
140140We actually run the formula generated for the original payload,
141141`q.q`.
142142
143−When we call a wet arm, we're essentially using the twig as a
143+When we call a wet arm, we're essentially using the hoon as a
144144macro. We are not generating new code for every call site; we
145145are creating a new type analysis path, which works as if we
146146expanded the callee with the caller's context.
147147
148148Consider a function like `turn` (Haskell `map`) which transforms
149149each element of a list. To use `turn`, we install a list and a
150−transformation function in a generic core. The span of the list
151−we produce depends on the span of the list and the span of the
150+transformation function in a generic core. The type of the list
151+we produce depends on the type of the list and the type of the
152152transformation function. But the Nock formulas for transforming
153153each element of the list will work on any function and any list,
154154so long as the function's argument is the list item.
155155
156156Again, will this work? A simple (and not quite right) way to ask
157−this question is to compile all the twigs in the battery for both
157+this question is to compile all the hoons in the battery for both
158158a payload of `p` and a payload of `q.q`, and see if they generate
159159exactly the same Nock. The actual algorithm is a little more
160160interesting, but not much.
@@ -171,22 +171,22 @@ use them unless you know what you're doing.
171171
172172There's only one field of the `coil` we haven't explained yet:
173173`p.r.q`. This is simply the compiled battery, if available. (Of
174−course, we compile the twigs in a core against the core itself,
174+course, we compile the hoons in a core against the core itself,
175175and the formulas can't be available while we're compiling them.)
176176External users of the core want this battery constant, though: it
177177lets us fold constants by executing arms at compile time.
178178
179−## `$face`: aliases and bridges
179+## `%face`: aliases and bridges
180180
181−In the advanced `tune` form, the `$face` span also has a couple
181+In the advanced `tune` form, the `%face` type also has a couple
182182of secret superpowers for hacking the namespace. Remember that
183183Hoon doesn't have anything like a symbol table; to resolve a
184−limb, we just search the span depth-first.
184+limb, we just search the type depth-first.
185185
186186If a name is in the `p.p` map, it's an alias. The map contains a
187−`(unit twig)`; if the unit is full, the name resolves to that
188−twig (compiled against the `q` span). If the unit is empty,
189−the name is blocked / skipped (see [limb](../twig/limb) for what
187+`(unit hoon)`; if the unit is full, the name resolves to that
188+hoon (compiled against the `q` type). If the unit is empty,
189+the name is blocked / skipped (see [limb](../limb/) for what
190190this means).
191191
192192If a name is in the `q.p` map, it's a bridge. When we search for
docs/hoon/twig/atom.md → docs/hoon/atom.mdrenamed+3−2
@@ -1,7 +1,8 @@
11---
22navhome: /docs/
3−sort: 1
4−
3+next: true
4+sort: 15
5+title: Atoms and strings
56---
67
78# Atoms and strings
docs/hoon/twig/atom/knit.md → docs/hoon/atom/knit.mdrenamed+4−4
@@ -1,17 +1,17 @@
11---
22navhome: /docs/
33sort: 3
4−
4+title: Knit
55---
66
7−# `:knit`
7+# Knit
88
9−`{$knit p/(list (each @t seed))}`: text string with interpolation.
9+`[%knit p=(list (each @t hoon))]`: text string with interpolation.
1010
1111### Produces
1212
1313A list-shaped string (`tape`) of the items in `p`, which are
14−either constant `@t` multibyte UTF-8 strings (`cord`) or twigs
14+either constant `@t` multibyte UTF-8 strings (`cord`) or hoons
1515producing a `tape`.
1616
1717### Syntax
docs/hoon/twig/atom/path.md → docs/hoon/atom/path.mdrenamed+7−6
@@ -1,30 +1,31 @@
11---
22navhome: /docs/
33sort: 4
4+title: Path
45---
56
6−# `:path`
7+# Path
78
8−`{$path p/(list (each @ta seed))}`: path with interpolation.
9+`[%path p=(list (each @ta hoon))]`: path with interpolation.
910
1011### Produces
1112
1213A null-terminated list if of the items in `p`, which are either constant
13−`@ta` atoms (`knot`), or twigs producing a `knot`.
14+`@ta` atoms (`knot`), or hoons producing a `knot`.
1415
1516### Syntax
1617
1718Irregular: `/foo/bar/baz`.
1819
19−Irregular: `"foo{(weld "moo" "baz")}bar"`.
20−
2120### Examples
2221
2322```
2423~zod/dojo> /foo/bar/baz
2524/foo/bar/baz
26−~zod/dojo> /foo/[`@ta`(cat 3 %moo %bar)]/baz
25+
26+~zod/dojo> `path`/foo/[`@ta`(cat 3 %moo %bar)]/baz
2727/foo/moobar/baz/
28+
2829~zod:dojo> /
2930~
3031```
docs/hoon/twig/atom/rock.md → docs/hoon/atom/rock.mdrenamed+4−4
@@ -1,12 +1,12 @@
11---
22navhome: /docs/
33sort: 2
4−
4+title: Rock
55---
66
7−# `:rock`
7+# Rock
88
9−`{$rock p/term q/@}`; a constant, cold atom.
9+`[%rock p=term q=@]`; a constant, cold atom.
1010
1111### Produces
1212
@@ -14,7 +14,7 @@ A cold (fixed) atom `q` with aura `a`.
1414
1515### Syntax
1616
17−Irregular: any warm atom (`:sand`) form, prefixed with `%`.
17+Irregular: any warm atom [(`%sand`)](../sand/) form, prefixed with `%`.
1818
1919Irregular: `%foo`, `@tas`, symbol. Character constraints: `a-z`
2020lowercase to start, `a-z` or `0-9` thereafter, with infix
docs/hoon/twig/atom/sand.md → docs/hoon/atom/sand.mdrenamed+3−3
@@ -1,12 +1,12 @@
11---
22navhome: /docs/
33sort: 1
4−
4+title: Sand
55---
66
7−# `:sand`
7+# Sand
88
9−`{$sand p/term q/@}`; a constant, warm atom.
9+`[%sand p=term q=@]`; a constant, warm atom.
1010
1111### Produces
1212
docs/hoon/basic.md+23−23
@@ -1,6 +1,6 @@
11---
22navhome: /docs/
3−sort: 15
3+sort: 19
44next: true
55title: Basic types
66---
@@ -68,9 +68,9 @@ the type `atom`. On the other hand,
6868...this should result in a `nest-fail`, because `[17 18]` is a cell,
6969not an atom.
7070
71−See the documentation on the [`^` family](../twig/ket-cast/) of runes
71+See the documentation on the [`^` family](../rune/ket/) of runes
7272for more information on casts. See the documentation on the
73−[`$` family](../twig/buc-mold/) of runes for building molds.
73+[`$` family](../rune/buc/) of runes for building molds.
7474(Also check out the irregular `,` operator.)
7575
7676## `type`: a set of types
@@ -94,14 +94,14 @@ section.
9494```
9595++ term @tas
9696++ type
97− $@ $? $noun
98− $void
99− == $% {$atom p/term q/(unit atom)}
100− {$cell p/type q/type}
101− {$core p/type q/(map term hoon)}
102− {$face p/term q/type}
103− {$fork p/(set type)}
104− {$hold p/type q/hoon}
97+ $@ $? %noun
98+ %void
99+ == $% [%atom p=term q=(unit atom)]
100+ [%cell p=type q=type]
101+ [%core p=type q=(map term hoon)]
102+ [%face p=term q=type]
103+ [%fork p=(set type)]
104+ [%hold p=type q=hoon]
105105 ==
106106```
107107
@@ -110,23 +110,23 @@ the `type`-tree is a cell, it's a tuple with one of the heads `%atom`,
110110`%cell`, `%core`, etc. We'll go through each of these cases below.
111111these cases below.
112112
113−### `?($noun $void)`
113+### `?(%noun %void)`
114114
115115`%noun` is the label for the set of all nouns. `%void` is the label
116116for the empty set.
117117
118118(For now, don't worry too much about the switch from `$` to `%`.)
119119
120−### `{$cell p/type q/type}`
120+### `[%cell p=type q=type]`
121121
122122`[%cell p=type q=type]` is for the set of all cells with head `p` and
123123tail `q`.
124124
125−### `{$fork p/(set type)}`
125+### `[%fork p=(set type)]`
126126
127127`[%fork p=(set type)]` is for the union of all types in the set `p`.
128128
129−### `{$hold p/type q/hoon}`
129+### `[%hold p=type q=hoon]`
130130
131131A `%hold` type, with type `p` and hoon `q`, is a lazy reference
132132to the type of `(mint p q)`. In English, it means: "the type of
@@ -135,17 +135,17 @@ the product when we compile `q` against subject `p`."
135135Note that this means we can have parsed Hoon AST data in the
136136`type`-tree.
137137
138−### `{$face p/term q/type}`
138+### `[%face p=term q=type]`
139139
140140A `[%face p=term q=type]` wraps the label `p` around the type
141141`q`. `p` is a `term` or `@tas`, an atomic ASCII string which
142142obeys symbol rules: lowercase and digit only, infix hyphen,
143143first character must be lowercase.
144144
145−See [`%limb`](../twig/limb/limb) for how labels are resolved. It's
145+See [`%limb`](../limb/limb/) for how labels are resolved. It's
146146nontrivial.
147147
148−### `{%atom p/term q/(unit atom))}`
148+### `[%atom p=term q=(unit atom))]`
149149
150150`%atom` is for an atom, with two twists. `q` is a `unit`, Hoon's
151151equivalent of a nullable pointer or a Haskell `Maybe`. If `q`
@@ -191,8 +191,8 @@ here are some conventions bound to constant syntax:
191191 @sw signed base64
192192 @sx signed hexadecimal
193193@t UTF-8 text (cord)
194− @ta ASCII text (span)
195− @tas ASCII symbol (term)
194+ @ta ASCII text (knot)
195+ @tas ASCII text symbol (term)
196196@u unsigned integer
197197 @ub unsigned binary
198198 @ud unsigned decimal
@@ -206,7 +206,7 @@ statically, by casting through the empty aura `@`. Hoon is not
206206dependently typed and can't statically enforce data constraints
207207(for example, it can't enforce that a `@tas` is really a symbol).
208208
209−### `{$core p/type q/(map term type)}`
209+### `[%core p=type q=(map term type)]`
210210
211211`%core` is for a code-data cell. The data (or *payload*) is the
212212tail; the code (or *battery*) is the head. `p`, a type, is the
@@ -225,8 +225,8 @@ sense. An arm is a computed attribute. A method is an arm whose
225225product is a Hoon function (or *gate*).
226226
227227A gate (function, lambda, etc) is a core with one arm, whose name
228−is the empty symbol `$`, and a payload whose shape is `{sample
229−context}`. The *context* is the subject in which the gate was
228+is the empty symbol `$`, and a payload whose shape is `[sample
229+context]`. The *context* is the subject in which the gate was
230230defined; the *sample* is the argument.
231231
232232To call this function on an argument `x`, replace the sample (at
docs/hoon/cheat-sheet.mdnew file+38
@@ -0,0 +1,38 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 26
5+title: Cheat sheet
6+---
7+
8+# Hoon cheat sheet
9+##### `~rovnys-ricfer`
10+
11+_Original Fora post_ [*here*](https://urbit.org/fora/posts/~2017.9.18..22.31.06..24d5~).
12+
13+<br />
14+
15+[Download .pdf](https://storage.googleapis.com/media.urbit.org/docs/hoon-cheat-sheet--2017-12-12.pdf)
16+
17+<br />
18+
19+We've found it's useful to have a quick reference of Hoon's syntax always at
20+hand. So above is a download link to a Hoon cheatsheet .pdf. It's missing a
21+few of the literal syntaxes, but it covers the most common ones.
22+
23+This doesn't list any of the Ford runes, although there is now at least
24+some documentation for those [here](/docs/arvo/internals/ford/runes).
25+
26+The following runes also exist, but are currently undocumented and not listed in the cheat sheet:
27+
28+```
29+!: :: turn on debugging printfs
30+!. :: turn off debugging printfs
31+!; :: using the "type of type", emit the type for an expression
32+!, :: emit AST of expression
33+$* :: bunt (irregular form is *)
34+^. :: use gate to transform type
35+^& :: zinc (covariant) -- see the docs on advanced types
36+```
37+
38+Hope this helps!
docs/hoon/concepts.md+2−2
@@ -220,7 +220,7 @@ of type `foo:atom`.
220220
221221### <a name="-limb">`limb`</a> (attribute or variable reference)
222222
223−A [`limb`](../twig/limb/limb/), like `foo`, is Hoon's equivalent of a variable
223+A [`limb`](../limb/limb/), like `foo`, is Hoon's equivalent of a variable
224224reference. A limb is a [`hoon`](#-hoon); given a subject [`type`](#-type),
225225[`mint`](#-mint) resolves it to a Nock formula and a product [`type`](#-type).
226226
@@ -239,7 +239,7 @@ regardless of the kind of limb.
239239
240240### <a name="-wing">`wing`</a> ([`limb`](#-limb) path)
241241
242−A [wing](../twig/limb/wing/) is a list of limbs. Like attribute
242+A [wing](../limb/wing/) is a list of limbs. Like attribute
243243references in a conventional language, it uses the syntax `a.b.c`,
244244but inside out: Hoon `a.b.c` means "a within b within c", the equivalent
245245of `c.b.a` in any other language. All limbs but the last, here `a`,
docs/hoon/examples.md+146−147
@@ -1,8 +1,8 @@
11---
22navhome: /docs/
3−sort: 17
4−title: Examples
53next: true
4+sort: 21
5+title: Examples
66---
77
88# Examples
@@ -18,29 +18,30 @@ side of simple manual construction over high-octane FP.)
1818
1919A function that produces the list of primes less than or equal to
2020its argument, an atom:
21+
2122```
22−:gate thru/atom :: 1
23−:cast (list atom) :: 2
24−:var field/(set atom) (silt (gulf 2 thru)) :: 3
25−:rap abet:main :: 4
26−:core :: 5
23+|= thru/@ :: 1
24+^- (list @) :: 2
25+=/ field/(set @) (silt (gulf 2 thru)) :: 3
26+=< abet:main :: 4
27+|% :: 5
2728++ abet :: 6
2829 (sort (~(tap in field) ~) lth) :: 7
2930:: :: 8
3031++ main :: 9
31− :var factor/atom 2 :: 10
32− :loop :like ..main :: 11
33− :if (gth (mul factor factor) thru) :: 12
32+ =/ factor/@ 2 :: 10
33+ |- ^+ ..main :: 11
34+ ?: (gth (mul factor factor) thru) :: 12
3435 ..main :: 13
35− :moar(factor +(factor), ..main (reap factor)) :: 14
36+ $(factor +(factor), ..main (reap factor)) :: 14
3637:: :: 15
3738++ reap :: 16
38− :gate factor/atom :: 17
39− :var count/atom (mul 2 factor) :: 18
40− :loop :like ..reap :: 19
41− :if (gth count thru) :: 20
39+ |= factor/@ :: 17
40+ =/ count/@ (mul 2 factor) :: 18
41+ |- ^+ ..reap :: 19
42+ ?: (gth count thru) :: 20
4243 ..reap :: 21
43− :moar :: 22
44+ %= $ :: 22
4445 count (add count factor) :: 23
4546 field (~(del in field) count) :: 24
4647 == :: 25
@@ -50,9 +51,9 @@ its argument, an atom:
5051## `sieve`: explanation
5152
5253```
53−:gate thru/atom :: 1
54−:cast (list atom) :: 2
55−:var field/(set atom) (silt (gulf 2 thru)) :: 3
54+|= thru/@ :: 1
55+^- (list @) :: 2
56+=/ field/(set @) (silt (gulf 2 thru)) :: 3
5657```
5758
5859Line `1`: we are building a gate (function) whose sample
@@ -67,13 +68,13 @@ list of atoms.
6768
6869Line `4`: below, we introduce a core which does our work. With
6970reverse flow, we compute `main` on this core, then `abet` on the
70−product of `main`. (`abet:main` means `:rap(abet main)`.)
71+product of `main`. (`abet:main` means `=<(abet main)`.)
7172
7273The core is a state machine; `main` produces the core itself,
7374with the computation completed. `abet` then extracts the result.
7475
7576```
76−:core :: 5
77+|% :: 5
7778++ abet :: 6
7879 (sort (~(tap in field) ~) lth) :: 7
7980```
@@ -90,8 +91,8 @@ list in ascending order with `lth` (less-than).
9091
9192```
9293++ main :: 9
93− :var factor/atom 2 :: 10
94− :loop :like ..main :: 11
94+ =/ factor/@ 2 :: 10
95+ |- ^+ ..main :: 11
9596```
9697
9798Line `9`: the `main` arm, which performs the main calculation.
@@ -103,9 +104,9 @@ Line `11`: we start a loop. The product of the loop is cast to
103104`..main`, which is the core we're in (`+1.main`).
104105
105106```
106− :if (gth (mul factor factor) thru) :: 12
107+ ?: (gth (mul factor factor) thru) :: 12
107108 ..main :: 13
108− :moar(factor +(factor), ..main (reap factor)) :: 14
109+ $(factor +(factor), ..main (reap factor)) :: 14
109110```
110111
111112Lines `12` and `13`: we terminate the loop, returning `..main`,
@@ -116,8 +117,8 @@ replacing the core with a version sieved by `reap`.
116117
117118```
118119++ reap :: 16
119− :gate factor/atom :: 17
120− :var count/atom (mul 2 factor) :: 18
120+ |= factor/@ :: 17
121+ =/ count/@ (mul 2 factor) :: 18
121122```
122123
123124Lines `16` and `17`: the `reap` arm, which produces a gate that
@@ -128,10 +129,10 @@ Line `18`: we declare a variable `count`, an atom, with the
128129initial value `(mul 2 factor)`.
129130
130131```
131− :loop :like ..reap :: 19
132− :if (gth count thru) :: 20
132+ |- ^+ ..reap :: 19
133+ ?: (gth count thru) :: 20
133134 ..reap :: 21
134− :moar :: 22
135+ %= $ :: 22
135136 count (add count factor) :: 23
136137 field (~(del in field) count) :: 24
137138 == :: 25
@@ -147,9 +148,7 @@ multiple of `factor`, and deleting it from `field`.
147148
148149## `sieve`: code in kernel style
149150
150−Finally, the same code transliterated into runes (and in a more
151−concise "kernel" style).
152−
151+Finally, the same code in a more concise "kernel" style.
153152```
154153|= top/@
155154^- (list @)
@@ -165,7 +164,7 @@ concise "kernel" style).
165164 $(fac +(fac), ..main (reap fac))
166165::
167166++ reap
168− |= fac/atom
167+ |= fac/@
169168 =+ cot=(mul 2 fac)
170169 |- ^+ ..reap
171170 ?: (gth cot top)
@@ -181,65 +180,65 @@ state, producing a list of game actions. Events are tic-tac-toe
181180moves (`move)`; actions are tic-tac-toe results (`fact`).
182181
183182```
184−:rap :gate feed/(list move) :: 1
185− :new game/game :: 2
186− :loop :cast (list fact) :: 3
187− :ifno feed ~ :: 4
188− :sip this/(unit fact) :: 5
189− game :: 6
190− (~(do go game) i.feed) :: 7
191− :var rest/(list fact) :moar(feed t.feed) :: 8
192− :ifno(this rest [u.this rest]) :: 9
183+=< |= feed/(list move) :: 1
184+ =| game/game :: 2
185+ |- ^- (list fact) :: 3
186+ ?~ feed ~ :: 4
187+ =^ this/(unit fact) :: 5
188+ game :: 6
189+ (~(do go game) i.feed) :: 7
190+ =/ rest/(list fact) $(feed t.feed) :: 8
191+ ?~(this rest [u.this rest]) :: 9
193192:: :: 10
194−:per :core :: 11
195− ++ side atom :: 12
196− ++ spot {x/atom y/atom} :: 13
197− ++ fact :book {$tie $~} :: 14
198− {$win p/cord} :: 15
199− == :: 16
200− ++ move :book {$x p/spot} :: 17
201− {$o p/spot} :: 18
202− {$z $~} :: 19
203− == :: 20
204− ++ game :bank w/? :: 21
205− a/side :: 22
206− z/side :: 23
207− == :: 24
208− -- :: 25
209−:core :: 26
193+=> |% :: 11
194+ ++ side @ :: 12
195+ ++ spot {x/@ y/@} :: 13
196+ ++ fact $% {$tie $~} :: 14
197+ {$win p/cord} :: 15
198+ == :: 16
199+ ++ move $% {$x p/spot} :: 17
200+ {$o p/spot} :: 18
201+ {$z $~} :: 19
202+ == :: 20
203+ ++ game $: w/? :: 21
204+ a/side :: 22
205+ z/side :: 23
206+ == :: 24
207+ -- :: 25
208+|% :: 26
210209++ bo :: 27
211− :door half/side :: 28
212− ++ bit :gate(a/atom =(1 (cut 0 [a 1] half))) :: 29
213− ++ off :gate(a/spot (add x.a (mul 3 y.a))) :: 30
214− ++ get :gate(a/spot (bit (off a))) :: 31
215− ++ set :gate(a/spot (con half (bex (off a)))) :: 32
216− ++ win :calt lien :: 33
210+ |_ half/side :: 28
211+ ++ bit |=(a/@ =(1 (cut 0 [a 1] half))) :: 29
212+ ++ off |=(a/spot (add x.a (mul 3 y.a))) :: 30
213+ ++ get |=(a/spot (bit (off a))) :: 31
214+ ++ set |=(a/spot (con half (bex (off a)))) :: 32
215+ ++ win %+ lien :: 33
217216 (rip 4 0wl04h0.4A0Aw.4A00s.0e070) :: 34
218− :gate(a/atom =(a (dis a half))) :: 35
217+ |=(a/@ =(a (dis a half))) :: 35
219218 -- :: 36
220219++ go :: 37
221− :door game/game :: 38
220+ |_ game/game :: 38
222221 ++ do :: 39
223− :gate act/move :: 40
224− :cast {(unit fact) ^game} :: 41
225− :case act :: 42
226− {$x *} :sure(w.game ~(mo on p.act)) :: 43
227− {$o *} :deny(w.game ~(mo on p.act)) :: 44
222+ |= act/move :: 40
223+ ^- {(unit fact) ^game} :: 41
224+ ?- act :: 42
225+ {$x *} ?>(w.game ~(mo on p.act)) :: 43
226+ {$o *} ?<(w.game ~(mo on p.act)) :: 44
228227 {$z *} [~ nu] :: 45
229228 == :: 46
230229 :: :: 47
231− ++ nu :like(game [& 0 0]) :: 48
230+ ++ nu ^+(game [& 0 0]) :: 48
232231 ++ on :: 49
233− :door here/spot :: 50
234− ++ is :or (~(get bo a.game) here) :: 51
235− (~(get bo z.game) here) :: 52
236− == :: 53
237− ++ mo :cast {(unit fact) ^game} :: 54
238− :deny is :: 55
239− :var next/side (~(set bo a.game) here) :: 56
240− :if ~(win bo next) :: 57
241− [[~ %win ?:(w.game %x %o)] nu] :: 58
242− [~ game(w !w.game, a z.game, z next)] :: 59
232+ |_ here/spot :: 50
233+ ++ is ?| (~(get bo a.game) here) :: 51
234+ (~(get bo z.game) here) :: 52
235+ == :: 53
236+ ++ mo ^- {(unit fact) ^game} :: 54
237+ ?< is :: 55
238+ =/ next/side (~(set bo a.game) here) :: 56
239+ ?: ~(win bo next) :: 57
240+ [[~ %win ?:(w.game %x %o)] nu] :: 58
241+ [~ game(w !w.game, a z.game, z next)] :: 59
243242 -- :: 60
244243 -- :: 62
245244-- :: 63
@@ -248,10 +247,10 @@ moves (`move)`; actions are tic-tac-toe results (`fact`).
248247### `toe`: explanation
249248
250249```
251−:rap :gate feed/(list move) :: 1
252− :new game/game :: 2
253− :loop :cast (list fact) :: 3
254− :ifno feed ~ :: 4
250+=< |= feed/(list move) :: 1
251+ =| game/game :: 2
252+ |- ^- (list fact) :: 3
253+ ?~ feed ~ :: 4
255254```
256255
257256Line `1` wraps a conclusion around a stack of cores. The cores
@@ -268,7 +267,7 @@ Line `3` enters a loop producing a list of game events, `fact`.
268267Line `4` produces nil, `~`, if `feed` is empty.
269268
270269```
271− :sip this/(unit fact) :: 5
270+ =^ this/(unit fact) :: 5
272271 game :: 6
273272 (~(do go game) i.feed) :: 7
274273```
@@ -277,12 +276,12 @@ Lines `5` through `7` apply the move. We open a `go` core on the
277276current game state, produce a `do` gate, and call that gate on
278277the move. The product of the `do` gate is a pair; the head is
279278`(unit fact)`, either `~` or `[~ fact]`; the tail is a new
280−`game`. The `:sip` twig declares the head as a new variable,
279+`game`. The `=^` hoon declares the head as a new variable,
281280`this`; it modifies the subject by setting `game` to the tail.
282281
283282```
284− :var rest/(list fact) :moar(feed t.feed) :: 8
285− :ifno(this rest [u.this rest]) :: 9
283+ =/ rest/(list fact) $(feed t.feed) :: 8
284+ ?~(this rest [u.this rest]) :: 9
286285```
287286
288287Line `8` declares a new variable, `rest`, which is all the facts
@@ -292,9 +291,9 @@ generated by the moves in `t.feed`, the tail of the move list.
292291prepends the new fact to `rest`.
293292
294293```
295−:per :core :: 11
296− ++ side atom :: 12
297− ++ spot {x/atom y/atom} :: 13
294+=> |% :: 11
295+ ++ side @ :: 12
296+ ++ spot {x/@ y/@} :: 13
298297```
299298
300299Line `11` wraps a library core around a data structure core, a
@@ -308,9 +307,9 @@ A side is a half of the board, as a marked/unmarked bitfield.
308307Line `13` defines the `spot` mold, a 2D coordinate.
309308
310309```
311− ++ fact :book {$tie $~} :: 14
312− {$win p/cord} :: 15
313− == :: 16
310+ ++ fact $% {$tie $~} :: 14
311+ {$win p/cord} :: 15
312+ == :: 16
314313```
315314
316315Lines `14` to `16` define the `fact` mold, a game event (i.e.,
@@ -319,21 +318,21 @@ output action), as a book (tagged union). There are two forms of
319318(reporting that `'X'` or `'O'` won a game.
320319
321320```
322− ++ move :book {$x p/spot} :: 17
323− {$o p/spot} :: 18
324− {$z $~} :: 19
325− == :: 20
321+ ++ move $% {$x p/spot} :: 17
322+ {$o p/spot} :: 18
323+ {$z $~} :: 19
324+ == :: 20
326325```
327326
328327Lines `17` to `20` define the `move` mold, a game move. This is
329328either `[%x spot]`, `[%o spot]`, or `[%z ~]` to reset the board.
330329
331330```
332− ++ game :bank w/? :: 21
333− a/side :: 22
334− z/side :: 23
335− == :: 24
336− -- :: 25
331+ ++ game $: w/? :: 21
332+ a/side :: 22
333+ z/side :: 23
334+ == :: 24
335+ -- :: 25
337336```
338337
339338Lines `21` to `23` define the `game` mold, the game state. This
@@ -342,13 +341,13 @@ side; and `w`, which is `&` (yes) if `a` is X and `b` is O; `|`
342341otherwise. (Obviously, we swap `a` and `z` on every move.)
343342
344343```
345−:core :: 26
344+|% :: 26
346345++ bo :: 27
347− :door half/side :: 28
348− ++ bit :gate(a/atom =(1 (cut 0 [a 1] half))) :: 29
349− ++ off :gate(a/spot (add x.a (mul 3 y.a))) :: 30
350− ++ get :gate(a/spot (bit (off a))) :: 31
351− ++ set :gate(a/spot (con half (bex (off a)))) :: 32
346+ |_ half/side :: 28
347+ ++ bit |=(a/@ =(1 (cut 0 [a 1] half))) :: 29
348+ ++ off |=(a/spot (add x.a (mul 3 y.a))) :: 30
349+ ++ get |=(a/spot (bit (off a))) :: 31
350+ ++ set |=(a/spot (con half (bex (off a)))) :: 32
352351```
353352
354353Line `26` introduces the library core, which contains the doors
@@ -369,9 +368,9 @@ bit at a `spot` set. It works by ORing (`con`) `half` with the
369368binary exponent (`bex`) of the offset (`off`) of the spot.
370369
371370```
372− ++ win :calt lien :: 33
371+ ++ win %+ lien :: 33
373372 (rip 4 0wl04h0.4A0Aw.4A00s.0e070) :: 34
374− :gate(a/atom =(a (dis a half))) :: 35
373+ |=(a/@ =(a (dis a half))) :: 35
375374 -- :: 36
376375```
377376
@@ -383,10 +382,10 @@ of which must equal itself when ANDed (`dis`) with `half`.
383382
384383```
385384++ go :: 37
386− :door game/game :: 38
385+ |_ game/game :: 38
387386 ++ do :: 39
388− :gate act/move :: 40
389− :cast {(unit fact) ^game} :: 41
387+ |= act/move :: 40
388+ ^- {(unit fact) ^game} :: 41
390389```
391390
392391Lines `37` to `38` begin the `go` core, a door around a `game`.
@@ -398,9 +397,9 @@ move. The product is cast to a pair of `(unit fact)` and a new
398397game state, written `^game` to skip to the second binding.
399398
400399```
401− :case act :: 42
402− {$x *} :sure(w.game ~(mo on p.act)) :: 43
403− {$o *} :deny(w.game ~(mo on p.act)) :: 44
400+ ?- act :: 42
401+ {$x *} ?>(w.game ~(mo on p.act)) :: 43
402+ {$o *} ?<(w.game ~(mo on p.act)) :: 44
404403 {$z *} [~ nu] :: 45
405404 == :: 46
406405 :: :: 47
@@ -412,12 +411,12 @@ the `mo` door to apply the move. If it's a `%z` move, we clear
412411the board.
413412
414413```
415− ++ nu :like(game [& 0 0]) :: 48
414+ ++ nu ^+(game [& 0 0]) :: 48
416415 ++ on :: 49
417− :door here/spot :: 50
418− ++ is :or (~(get bo a.game) here) :: 51
419− (~(get bo z.game) here) :: 52
420− == :: 53
416+ |_ here/spot :: 50
417+ ++ is ?| (~(get bo a.game) here) :: 51
418+ (~(get bo z.game) here) :: 52
419+ == :: 53
421420```
422421
423422Line `48` is the `nu` arm, which produces a blank game state.
@@ -427,16 +426,16 @@ Lines `49` to `50` begin the `on` door, a door around `here`, a
427426game state, we have multiple computed attributes (`is` and `mo`)
428427against the combination of game state and coordinate.
429428
430−Lines `51` to `53` define the `is` arm, which is `&` (yes) iff
429+Lines `51` to `53` define the `is` arm, which is `&` (yes) if
431430either `a` or `z` has played `here`.
432431
433432```
434− ++ mo :cast {(unit fact) ^game} :: 54
435− :deny is :: 55
436− :var next/side (~(set bo a.game) here) :: 56
437− :if ~(win bo next) :: 57
438− [[~ %win ?:(w.game %x %o)] nu] :: 58
439− [~ game(w !w.game, a z.game, z next)] :: 59
433+ ++ mo ^- {(unit fact) ^game} :: 54
434+ ?< is :: 55
435+ =/ next/side (~(set bo a.game) here) :: 56
436+ ?: ~(win bo next) :: 57
437+ [[~ %win ?:(w.game %x %o)] nu] :: 58
438+ [~ game(w !w.game, a z.game, z next)] :: 59
440439 -- :: 60
441440 -- :: 62
442441-- :: 63
@@ -487,13 +486,13 @@ side `z`, and replaces `z` with `next`.
487486|%
488487++ bo
489488 |_ haf/side
490− ++ bit |=(a/atom =(1 (cut 0 [a 1] haf)))
489+ ++ bit |=(a/@ =(1 (cut 0 [a 1] haf)))
491490 ++ get |=(a/spot (bit (off a)))
492491 ++ off |=(a/spot (add x.a (mul 3 y.a)))
493492 ++ set |=(a/spot (con haf (bex (off a))))
494493 ++ win %+ lien
495494 (rip 4 0wl04h0.4A0Aw.4A00s.0e070)
496− |=(a/atom =(a (dis a haf)))
495+ |=(a/@ =(a (dis a haf)))
497496 --
498497++ go
499498 |_ mag/game
@@ -510,9 +509,9 @@ side `z`, and replaces `z` with `next`.
510509 ++ on
511510 =| her/spot
512511 |%
513− ++ is ?| (~(get bo a.mag) her)
514− (~(get bo z.mag) her)
515− ==
512+ ++ is ?| (~(get bo a.mag) her)
513+ (~(get bo z.mag) her)
514+ ==
516515 ++ mo ^- {(unit fact) game}
517516 ?< is
518517 =+ next=(~(set bo a.mag) her)
@@ -563,28 +562,28 @@ side `z`, and replaces `z` with `next`.
563562::::
564563::::
565564
566−++ tree |* a/gate :: binary tree
565+++ tree |* a/gate :: binary tree
567566 $@($~ {n/a l/(tree a) r/(tree a)}) ::
568567++ trap |*(a/_* _|?(*a)) :: makes perfect sense
569−++ trel |* {a/gate b/gate c/gate} :: just a triple
568+++ trel |* {a/gate b/gate c/gate} :: just a triple
570569 {p/a q/b r/c} ::
571570++ each |* {a/gate b/gate} :: either a or b
572571 $%({$& p/a} {$| p/b}) :: a default
573572
574−++ qual |* {a/gate b/gate c/gate d/gate} :: just a quadruple
573+++ qual |* {a/gate b/gate c/gate d/gate} :: just a quadruple
575574 {p/a q/b r/c s/d} ::
576−++ pair |*({a/gate b/gate} {p/a q/b}) :: just a pair
577−++ quid |*({a/gate b/*} {a _b}) :: for =^
578−++ quip |*({a/gate b/*} {(list a) _b}) :: for =^
579−++ unit |* a/gate :: maybe
575+++ pair |*({a/gate b/gate} {p/a q/b}) :: just a pair
576+++ quid |*({a/gate b/*} {a _b}) :: for =^
577+++ quip |*({a/gate b/*} {(list a) _b}) :: for =^
578+++ unit |* a/gate :: maybe
580579 $@($~ {$~ u/a}) ::
581−++ list |* a/gate :: null-term list
580+++ list |* a/gate :: null-term list
582581 $@($~ {i/a t/(list a)}) ::
583−++ lone |*(a/gate p/a) :: just one thing
582+++ lone |*(a/gate p/a) :: just one thing
584583
585584::::
586585::::
587−++ map |* {a/gate b/gate} :: associative tree
586+++ map |* {a/gate b/gate} :: associative tree
588587 $@($~ {n/{p/a q/b} l/(map a b) r/(map a b)}) ::
589588++ qeu |* a/gate :: queue
590589 $@($~ {n/a l/(qeu a) r/(qeu a)}) ::
docs/hoon/exercises.md+2−1
@@ -1,6 +1,7 @@
11---
22navhome: /docs/
3−sort: 18
3+next: true
4+sort: 22
45title: Exercises
56---
67
docs/hoon/irregular.md+74−90
@@ -1,6 +1,6 @@
11---
22navhome: /docs/
3−sort: 22
3+sort: 25
44title: Irregular forms
55comments: true
66---
@@ -10,29 +10,29 @@ comments: true
1010
1111<br />
1212
13−*Original `fora` post* [*here*](http://urbit.org/fora/posts/~2016.12.29..19.37.08..89d5~/).
13+*Original Fora post* [*here*](https://urbit.org/fora/posts/~2016.12.29..19.37.08..89d5~/).
1414
1515##### Reading guide
1616Headings contain runes, phonetics and tokens. Description contains a link to the docs and a short description of the rune. Both regular (R) and irregular (I) forms are given.
1717
18−Want to `ctrl-f` to find out the meaning of something weird you saw? Search for `\symbol`. ie `\?` or `\=`. It'll show you to the irregular forms that uses that symbol.
18+Want to `Ctrl-f` to find out the meaning of something weird you saw? Search for `\symbol`. ie `\?` or `\=`. It'll show you to the irregular forms that uses that symbol.
1919
2020## . dot (nock)
2121
2222Anything Nock can do, Hoon can do also.
2323
24−### .+ dotlus :bump
24+### .+ dotlus
2525
26−[docs](https://urbit.org/docs/hoon/twig/dot-nock/lus-bump/) \\+
27−`{$bump p/atom}`: increment an atom with Nock 4.
26+[docs](../rune/dot/lus/) \\+
27+`[%dtls p=atom]`: increment an atom with Nock 4.
2828
2929R: `.+(p)`
3030I: `+(p)`
3131
32−### .= dottis :same
32+### .= dottis
3333
34−[docs](https://urbit.org/docs/hoon/twig/dot-nock/tis-same/) \\=
35−`{$same p/seed q/seed}`: test for equality with Nock 5.
34+[docs](../rune/dot/tis/) \\=
35+`[%dtls p=hoon q=hoon]`: test for equality with Nock 5.
3636
3737R: `.=(p q)`
3838I: `=(p q)`
@@ -41,22 +41,22 @@ I: `=(p q)`
4141
4242Miscellaneous useful macros.
4343
44−### ;: semcol :wad
44+### ;: semcol
4545
46−[docs](https://urbit.org/docs/hoon/twig/sem-make/col-wad/) \\:
47−`{$wad p/seed q/(list seed)}`: call a binary function as an n-ary function.
46+[docs](../rune/sem/col/) \\:
47+`[%smcl p=hoon q=(list hoon)]`: call a binary function as an n-ary function.
4848
4949R: `;:(p q)`
5050I: `:(p q)`
5151
5252## : col (cells)
5353
54−The cell twigs.
54+The cell runes.
5555
56−### :- colhep :cons
56+### :- colhep
5757
58−[docs](https://urbit.org/docs/hoon/twig/col-cell/hep-cons/) \\[\\]\\^\\+\\\`\\~
59−`{$cons p/seed q/seed}`: construct a cell (2-tuple).
58+[docs](../rune/col/hep/) \\[\\]\\^\\+\\\`\\~
59+`[%clhp p=hoon q=hoon]`: construct a cell (2-tuple).
6060
6161R: `:-(p q)`
6262I:
@@ -65,7 +65,7 @@ I:
6565 [a b] ==> :-(a b)
6666[a b c] ==> [a [b c]]
6767 a^b^c ==> [a b c]
68− a+b ==> [%a b]
68+ a/b ==> [%a b]
6969 `a ==> [~ a]
7070 ~[a b] ==> [a b ~]
7171 [a b]~ ==> [[a b] ~]
@@ -73,54 +73,54 @@ I:
7373
7474## = tis (flow)
7575
76−Flow twigs change the subject. All non-flow twigs (except cores) pass the subject down unchanged.
76+Flow hoons change the subject. All non-flow hoons (except cores) pass the subject down unchanged.
7777
78−### =< tisgal :rap
78+### =< tisgar
7979
80−[docs](https://urbit.org/docs/hoon/twig/tis-flow/gal-rap/) \\:
81−`{$rap p/seed q/seed}`: compose two twigs, inverted.
80+[docs](../rune/tis/gal/) \\:
81+`[%tsgl p=hoon q=hoon]`: compose two hoons, inverted.
8282
8383R: `=<(p q)`
8484I: `p:q`
8585
8686## | bar (core)
8787
88−[docs](https://urbit.org/docs/hoon/twig/bar-core/) \\$
89−Core twigs are flow twigs.
88+[docs](../rune/bar/) \\$
89+Core hoons are flow hoon.
9090
9191Technically not irregular syntax, but worth mentioning.
9292
93−* `|= bartis :gate`
94−* `|. bardot :trap`
95−* `|- barhep :loop`
96−* `|* bartar :gill`
93+* `|= bartis` (gate)
94+* `|. bardot` (trap)
95+* `|- barhep` (loop)
96+* `|* bartar` (gill)
9797
98−The above runes produce a core with a single arm, named `$` (or `:moar`). We can recompute this arm with changes, useful for recursion among other things. Commonly used with the irregular syntax for `%=`, `:make`, like so: `$()`.
98+The above runes produce a core with a single arm, named `$` ("buc"). We can recompute this arm with changes, useful for recursion among other things. Commonly used with the irregular syntax for `%=`, `:make`, like so: `$()`.
9999
100100## % cen (call)
101101
102−The invocation family of twigs.
102+The invocation family of runes.
103103
104−### %= centis :make
104+### %= centis
105105
106−[docs](https://urbit.org/docs/hoon/twig/cen-call/tis-make/) \\(\\)
107−`{$make p/wing q/(list (pair wing seed))}`: take a wing with changes.
106+[docs](../rune/cen/tis/) \\(\\)
107+`[%cnts p=wing q=(list (pair wing hoon))]`: take a wing with changes.
108108
109109R: `%=(p a 1)`
110110I: `p(a 1)`
111111
112−### %~ censig :open
112+### %~ censig
113113
114−[docs](https://urbit.org/docs/hoon/twig/cen-call/sig-open/) \\~
115−`{$cnsg p/wing q/seed r/seed}`: call with multi-armed door.
114+[docs](../rune/cen/sig/) \\~
115+`[%cnsg p=wing q=hoon r=hoon]`: call with multi-armed door.
116116
117117R: `%~(p q r)`
118118I: `~(p q r)`
119119
120−### %- cenhep :call
120+### %- cenhep
121121
122−[docs](https://urbit.org/~~/docs/hoon/twig/cen-call/hep-call/) \\(\\)
123−`{$call p/seed q/seed}`: call a gate (function).
122+[docs](../rune/cen/hep/) \\(\\)
123+`[%cnhp p=hoon q=hoon]`: call a gate (function).
124124
125125R: `%-(p q)`
126126I: `(p q)`
@@ -131,34 +131,18 @@ Note: `(p)` becomes `$:p` (`=<($ p)`), which behaves as you would expect (func c
131131
132132A mold is a gate (function) that helps us build simple and rigorous data structures.
133133
134−### $: buccol :bank
134+### $? bucwut
135135
136−[docs](https://urbit.org/docs/hoon/twig/buc-mold/col-bank/) \\{\\}
137−`{$bank p/(list moss)}`: form a mold which recognizes a tuple.
138−
139−R: `$:(p q)`
140−I: `{p q}`
141−
142−### $= buctis :coat
143−
144−[docs](https://urbit.org/docs/hoon/twig/buc-mold/tis-coat/) \\/
145−`{$coat p/@tas q/moss}`: mold which wraps a face around another mold.
146−
147−R: `$=(p q)`
148−I: `p/q`
149−
150−### $? bucwut :pick
151−
152−[docs](https://urbit.org/docs/hoon/twig/buc-mold/wut-pick/) \\?
153−`{$pick p/(list moss)}`: mold which normalizes a general union.
136+[docs](../rune/buc/wut/) \\?
137+`[%bcwt p=(list model)]`: mold which normalizes a general union.
154138
155139R: `$?(p)`
156140I: `?(p)`
157141
158−### $_ buccab :shoe
142+### $_ buccab
159143
160−[docs](https://urbit.org/docs/hoon/twig/buc-mold/cab-shoe/) \\_
161−`{$shoe p/seed}`: mold which normalizes to an example.
144+[docs](../rune/buc/cab/) \\_
145+`[%bccb p=value]`: mold which normalizes to an example.
162146
163147R: `$_(p)`
164148I: `_p`
@@ -167,46 +151,46 @@ I: `_p`
167151
168152Hoon has the usual branches and logical tests.
169153
170−### ?! wutzap :not
154+### ?! wutzap
171155
172−[docs](https://urbit.org/docs/hoon/twig/wut-test/zap-not/) \\!
173−`{$not p/seed}`: logical not.
156+[docs](../rune/wut/zap/) \\!
157+`[%wtzp p=hoon]`: logical not.
174158
175159R: `?!(p)`
176160I: `!(p)`
177161
178−### ?& wutpam :and
162+### ?& wutpam
179163
180−[docs](https://urbit.org/docs/hoon/twig/wut-test/pam-and/) \\&
181−`{$and p/(list seed)}`: logical and.
164+[docs](../rune/wut/pam/) \\&
165+`[%wtpm p=(list hoon)]`: logical and.
182166
183167R: `?&(p)`
184168I: `&(p)`
185169
186−### ?& wutbar :or
170+### ?| wutbar
187171
188−[docs](https://urbit.org/docs/hoon/twig/wut-test/bar-or/) \\|
189−`{$or p/(list seed)}`: logical or.
172+[docs](../rune/wut/bar/) \\|
173+`[%wtbr p=(list hoon)]`: logical or.
190174
191175R: `?|(p)`
192176I: `|(p)`
193177
194178## ^ ket (cast)
195179
196−Lets us adjust spans without violating type constraints.
180+Lets us adjust types without violating type constraints.
197181
198−### ^- kethep :cast
182+### ^- kethep
199183
200−[docs](https://urbit.org/docs/hoon/twig/ket-cast/hep-cast/) \\\`
201−`{$cast p/moss q/seed}`: typecast by mold.
184+[docs](../rune/ket/hep/) \\\`
185+`[%kthp p=model q=value]`: typecast by mold.
202186
203187R: `^-(p q)`
204−I: ```p`q``
188+I: `` `p`q ``
205189
206−### ^= kettis :name
190+### ^= kettis
207191
208−[docs](https://urbit.org/docs/hoon/twig/ket-cast/tis-name/) \\=
209−`{$name p/toga q/seed}`: name a value.
192+[docs](../rune/ket/tis/) \\=
193+`[%ktts p=toga q=value]`: name a value.
210194
211195R: `^=(p q)`
212196I: `p=q`
@@ -220,27 +204,27 @@ I: `p=q`
220204* `*` noun.
221205* `^` cell.
222206* `?` loobean.
223−* `$~` null.
207+* `~` null.
224208
225209### Values
226210
227211\\~\\-\\.\\&\\|
228−
212+}
229213* `~` null.
230214* `&` loobean true.
231215* `|` loobean false.
232216* `%a` constant `a`, where `a` can be an ((ir)regularly defined) atom or a symbol.
233217
234−See [:sand](https://urbit.org/docs/hoon/twig/atom/sand/) for other irregular definitions of atoms.
218+See [%sand](../atom/sand/) for other irregular definitions of atoms.
235219
236−### List addressing
220+### List addressing}
237221* `&n` nth element of a list.
238222* `|n` tail of list after nth element (i.e. n is the head).
239223
240−### Limbs :limb
224+### Limbs
241225
242−[docs](https://urbit.org/docs/hoon/twig/limb/limb/) \\+\\.\\^
243−`{$limb p/(each @ud {p/@ud q/@tas})}`: attribute of subject.
226+[docs](../limb/limb/) \\+\\.\\^
227+`[%limb p=(each @ud [p=@ud q=@tas])]`: attribute of subject.
244228
245229* `+15` is slot 15
246230* `.` is the whole subject (slot 1)
@@ -260,17 +244,17 @@ See [:sand](https://urbit.org/docs/hoon/twig/atom/sand/) for other irregular def
260244```
261245
262246
263−### Wings :wing
264−
265−[docs](https://urbit.org/~~/docs/hoon/twig/limb/wing/) \\.
266−`{$wing p/(list limb)`; a limb search path.
247+### Wings
267248
249+[docs](../limb/wing/) \\.
250+`[%wing p=(list limb)]`; a limb search path.
251+}
268252`a.b` finds limb `a` within limb `b` ("var" `a` within "var" `b`).
269253
270254### Printing stuff
271255
272−* `<a b c>` prints a [tape](https://urbit.org/docs/hoon/library/2q/#-tape).
273−* `>a b c<` prints a [tank](https://urbit.org/docs/hoon/library/2q/#-tank).
256+* `<a b c>` prints a [tape](../library/2q/#-tape).
257+* `>a b c<` prints a [tank](../library/2q/#-tank).
274258
275259## Commentary
276260
docs/hoon/library.md+1−1
@@ -1,6 +1,6 @@
11---
22navhome: /docs/
3−sort: 20
3+sort: 18
44title: Standard library
55---
66
docs/hoon/twig/limb.md → docs/hoon/limb.mdrenamed+5−3
@@ -1,12 +1,14 @@
11---
22navhome: /docs/
3−sort: 2
3+next: true
4+sort: 16
5+title: Limbs and wings
46---
57
68# Limbs and wings
79
810One feature Hoon lacks: a context that isn't a first-class value.
9−Hoon has no concept of scope, environment, etc. A twig has one
11+Hoon has no concept of scope, environment, etc. A hoon has one
1012data source, the *subject*, a noun like any other.
1113
1214In most languages "variable" and "attribute" are different
@@ -14,7 +16,7 @@ things. They are both symbols, but a variable is in "the
1416environment" and a attribute is on "an object." In Hoon, "the
1517environment" is "an object" -- the subject.
1618
17−`$limb` and `$wing` are two basic twig stems that extract
19+`%limb` and `%wing` are two basic hoon stems that extract
1820information from the subject. A `limb` is an attribute; a `wing`
1921is an attribute path, ie, a list of limbs.
2022
docs/hoon/twig/limb/limb.md → docs/hoon/limb/limb.mdrenamed+13−12
@@ -1,18 +1,19 @@
11---
22navhome: /docs/
3+next: true
34sort: 1
4−
5+title: Limb
56---
67
7−# `:limb`
8+# Limb
89
9−`{$limb p/(each @ud {p/@ud q/@tas})}`: attribute of subject.
10+`[%limb p=(each @ud [p=@ud q=@tas])]`: attribute of subject.
1011
1112### Produces
1213
13−If `p` matches `{$& p/@ud}`, slot `p.p` of the subject.
14+If `p` matches `[%& p=@ud]`, slot `p.p` of the subject.
1415
15−If `p` matches `{$| p/@ud q/@tas}`, the `p`th match for `q`,
16+If `p` matches `[%| p=@ud q=@tas]`, the `p`th match for `q`,
1617using the search traverse below.
1718
1819### Syntax
@@ -45,13 +46,13 @@ subject leg to compute the result. Logically, a limb is an
4546attribute -- computation or subtree, "synthesized" or "natural"
4647-- of the subject.
4748
48−We search the subject span headfirst, depth-first, and pre-order.
49−If we descend to a `$face` span whose label matches the limb
50−symbol, the descent address is a leg. The span is the span
51−beneath the label. But if the `$face` label differs, the search
49+We search the subject type headfirst, depth-first, and pre-order.
50+If we descend to a `%face` type whose label matches the limb
51+symbol, the descent address is a leg. The type is the type
52+beneath the label. But if the `%face` label differs, the search
5253skips this whole subtree.
5354
54−If we descend into a `$core` span in which the limb symbol is an
55+If we descend into a `%core` type in which the limb symbol is an
5556arm, we produce that arm. If the limb symbol is not bound, we
5657descend into the payload (data) of the core.
5758
@@ -61,7 +62,7 @@ through" an overriding label. No label anywhere is inaccessible.
6162
6263### Examples
6364
64−The `:dojo` prompt gives you a subject with a decent namespace.
65+The Dojo prompt gives you a subject with a decent namespace.
6566Try
6667
6768```
@@ -70,7 +71,7 @@ Try
7071```
7172
7273You can also add variables to the subject, then use them. (Note
73−that `=variable value` is not Hoon (language) syntax; it's `:dojo`
74+that `=variable value` is not Hoon (language) syntax; it's Dojo
7475(shell) syntax.)
7576
7677```
docs/hoon/twig/limb/wing.md → docs/hoon/limb/wing.mdrenamed+4−3
@@ -1,16 +1,17 @@
11---
22navhome: /docs/
33sort: 2
4+title: Wing
45---
56
6−# `:wing`
7+# Wing
78
8−`{$wing p/(list limb)`; a limb search path.
9+`[%wing p=(list limb)]`; a limb search path.
910
1011### Produces
1112
1213If `p` is null, the subject at leg `1`. Otherwise, let `x` be
13−the `$wing` of `t.p`. `x` is either an arm or a leg. We compute
14+the `%wing` of `t.p`. `x` is either an arm or a leg. We compute
1415limb `i.p` on some subject leg `s`, where:
1516
1617If `x` is a leg/slot number, `s` is `x`.
docs/hoon/mission.md+1−1
@@ -1,6 +1,6 @@
11---
22navhome: /docs/
3−sort: 10
3+sort: 11
44next: true
55title: Mission
66---
docs/hoon/reference.md+27−25
@@ -1,6 +1,7 @@
11---
22navhome: /docs/
3−sort: 21
3+next: true
4+sort: 24
45title: Expression reference
56---
67
@@ -10,72 +11,73 @@ title: Expression reference
1011
1112<div class="book">
1213
13−### [Atoms and strings](../twig/atom)
14+### [Atoms and strings](../atom/)
1415
15−### [Limbs and wings](../twig/limb)
16+### [Limbs and wings](../limb/)
1617
17−## `$ buc` (mold)
18+## `. dot` (nock)
1819
19−<list src="../twig/buc-mold" dataPreview="true" className="runes" childIsFragment="true"></list>
20+<list src="../rune/dot" dataPreview="true" className="runes" childIsFragment="true"></list>
2021
2122---
2223
23−## `| bar` (core)
24+## `! zap` (wild)
2425
25−<list src="../twig/bar-core" dataPreview="true" className="runes" childIsFragment="true"></list>
26+<list src="../rune/zap" dataPreview="true" className="runes" childIsFragment="true"></list>
2627
2728---
2829
29−## `: col` (cell)
30+## `= tis` (flow)
3031
31−<list src="../twig/col-cell" dataPreview="true" className="runes" childIsFragment="true"></list>
32+<list src="../rune/tis" dataPreview="true" className="runes" childIsFragment="true"></list>
3233
3334---
3435
35−## `% cen` (call)
36+## `? wut` (test)
3637
37−<list src="../twig/cen-call" dataPreview="true" className="runes" childIsFragment="true"></list>
38+<list src="../rune/wut" dataPreview="true" className="runes" childIsFragment="true"></list>
3839
3940---
4041
41−## `. dot` (nock)
42+## `| bar` (core)
4243
43−<list src="../twig/dot-nock" dataPreview="true" className="runes" childIsFragment="true"></list>
44+<list src="../rune/bar" dataPreview="true" className="runes" childIsFragment="true"></list>
4445
4546---
4647
47−## `^ ket` (cast)
48+## `~ sig` (hint)
4849
49−<list src="../twig/ket-cast" dataPreview="true" className="runes" childIsFragment="true"></list>
50+<list src="../rune/sig" dataPreview="true" className="runes" childIsFragment="true"></list>
5051
5152---
5253
53−## `~ sig` (hint)
54+## `: col` (cell)
5455
55−<list src="../twig/sig-hint" dataPreview="true" className="runes" childIsFragment="true"></list>
56+<list src="../rune/col" dataPreview="true" className="runes" childIsFragment="true"></list>
5657
5758---
5859
59−## `; sem` (make)
60+## `% cen` (call)
6061
61−<list src="../twig/sem-make" dataPreview="true" className="runes" childIsFragment="true"></list>
62+<list src="../rune/cen" dataPreview="true" className="runes" childIsFragment="true"></list>
6263
6364---
6465
65−## `= tis` (flow)
66+## `^ ket` (cast)
6667
67−<list src="../twig/tis-flow" dataPreview="true" className="runes" childIsFragment="true"></list>
68+<list src="../rune/ket" dataPreview="true" className="runes" childIsFragment="true"></list>
6869
6970---
7071
71−## `? wut` (test)
72+## `$ buc` (mold)
7273
73−<list src="../twig/wut-test" dataPreview="true" className="runes" childIsFragment="true"></list>
74+<list src="../rune/buc" dataPreview="true" className="runes" childIsFragment="true"></list>
7475
7576---
7677
77−## `! zap` (wild)
78+## `; sem` (make)
7879
79−<list src="../twig/zap-wild" dataPreview="true" className="runes" childIsFragment="true"></list>
80+<list src="../rune/sem" dataPreview="true" className="runes" childIsFragment="true"></list>
8081
8182</div>
83+
docs/hoon/rune.mdnew file+77
@@ -0,0 +1,77 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 17
5+title: Runes
6+---
7+
8+# Runes
9+
10+<div class="book">
11+
12+## `. dot` (nock)
13+
14+<list src="./dot" dataPreview="true" className="runes" childIsFragment="true"></list>
15+
16+---
17+
18+## `! zap` (wild)
19+
20+<list src="./zap" dataPreview="true" className="runes" childIsFragment="true"></list>
21+
22+---
23+
24+## `= tis` (flow)
25+
26+<list src="./tis" dataPreview="true" className="runes" childIsFragment="true"></list>
27+
28+---
29+
30+## `? wut` (test)
31+
32+<list src="./wut" dataPreview="true" className="runes" childIsFragment="true"></list>
33+
34+---
35+
36+## `| bar` (core)
37+
38+<list src="./bar" dataPreview="true" className="runes" childIsFragment="true"></list>
39+
40+---
41+
42+## `~ sig` (hint)
43+
44+<list src="./sig" dataPreview="true" className="runes" childIsFragment="true"></list>
45+
46+---
47+
48+## `: col` (cell)
49+
50+<list src="./col" dataPreview="true" className="runes" childIsFragment="true"></list>
51+
52+---
53+
54+## `% cen` (call)
55+
56+<list src="./cen" dataPreview="true" className="runes" childIsFragment="true"></list>
57+
58+---
59+
60+## `^ ket` (cast)
61+
62+<list src="./ket" dataPreview="true" className="runes" childIsFragment="true"></list>
63+
64+---
65+
66+## `$ buc` (mold)
67+
68+<list src="./buc" dataPreview="true" className="runes" childIsFragment="true"></list>
69+
70+---
71+
72+## `; sem` (make)
73+
74+<list src="./sem" dataPreview="true" className="runes" childIsFragment="true"></list>
75+
76+</div>
77+
docs/hoon/rune/bar.mdnew file+27
@@ -0,0 +1,27 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 15
5+title: Core | "bar"
6+---
7+
8+# Core `|` "bar"
9+
10+Core hoons are flow hoons. The compiler essentially pins a Nock
11+formula, or battery of formulas, to the subject.
12+
13+All `|` hoons are macros around `%core`. (See the `%core`
14+section in [`type`](../../basic#-core-p-type-q-map-term-type) above.)
15+`%core` uses the subject as the payload of a battery, whose arms are
16+compiled with the core itself as the subject.
17+
18+Four of these hoons (`|=`, `|.`, `|-`, and `|*`) produce a
19+core with a single arm, named `$`. We can recompute this arm
20+with changes, useful for recursion among other things:
21+
22+> `$()` expands to `%=($)` (["cenhep"](../cen/hep)), accepting
23+> a *jogging* body containing a list of changes to the subject.
24+
25+## Stems
26+
27+<list dataPreview="true" className="runes"></list>
docs/hoon/twig/bar-core/cab-door.md → docs/hoon/rune/bar/cab.mdrenamed+7−24
@@ -1,23 +1,17 @@
11---
22navhome: /docs/
3−sort: 5
4−
3+next: true
4+sort: 3
5+title: |_ "barcab"
56---
67
7−# `:door |_ "barcab"`
8+# `|_ "barcab"`
89
9−`{$door p/moss q/(map term foot)}`: form a door, a many-armed core
10+`[%brcb p=model q=(map term foot)]`: form a door, a many-armed core
1011with a sample.
1112
1213## Expands to
1314
14−```
15−:new p
16−:core
17− q
18−==
19−```
20−
2115```
2216=| p
2317|% q
@@ -41,25 +35,14 @@ structure becomes a door.
4135Calling a door is just like calling a gate, but the caller needs
4236to specify the arm. For instance, to call the gate `foo` as a
4337door, instead of `(foo bar)` we would write `~($ foo bar)`. This
44−is an irregular form for `:open($ foo bar)`, `%~`, "censig".
38+is an irregular form for `%~($ foo bar)`, ["censig"](../../cen/sig).
4539
4640## Examples
4741
4842A trivial door:
4943
5044```
51−/~zod:dojo> =mol :door a/@ud
52− ++ succ +(a)
53− ++ prev (dec a)
54− --
55−/~zod:dojo> :call(succ mol 1)
56−2
57−/~zod:dojo> :call(succ mol :call(succ mol :call(prev mol 5)))
58−6
59−```
60−
61−```
62−/~zod:dojo> =mol |_ a/@ud
45+/~zod:dojo> =mol |_ a=@ud
6346 ++ succ +(a)
6447 ++ prev (dec a)
6548 --
docs/hoon/twig/bar-core/cen-core.md → docs/hoon/rune/bar/cen.mdrenamed+6−18
@@ -1,12 +1,13 @@
11---
22navhome: /docs/
3+next: true
34sort: 1
4−
5+title: |% "barcen"
56---
67
7−# `:core |% "barcen"`
8+# `|% "barcen"`
89
9−Form a core `{battery payload}` with subject as the payload.
10+Form a core `[battery payload]` with subject as the payload.
1011
1112## Produces
1213
@@ -19,31 +20,18 @@ Regular: *battery*.
1920## Discussion
2021
2122A core is like an "object" in a conventional language, but its
22−attributes (*arms*) are functions on the core, not the core and
23+attributes (_arms_) are functions on the core, not the core and
2324an argument. A "method" on a core is an arm producing a gate.
2425
2526## Examples
2627
2728A trivial core:
2829
29−```
30−~zod:dojo> =foo :pin :name(x 58)
31− :core
32− ++ n (add 42 x)
33− ++ g :gate b/@
34− (add b n)
35− --
36−~zod:dojo> n.foo
37−100
38−~zod:dojo> (g.foo 1)
39−101
40−```
41−
4230```
4331~zod:dojo> =foo =+ x=58
4432 |%
4533 ++ n (add 42 x)
46− ++ g |= b/@
34+ ++ g |= b=@
4735 (add b n)
4836 --
4937~zod:dojo> n.foo
docs/hoon/rune/bar/col.mdnew file+26
@@ -0,0 +1,26 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 8
5+title: |: "barcol"
6+---
7+
8+# `|: "barcol"`
9+
10+`[%brcl p=hoon q=hoon]`: form a gate with burnt sample.
11+
12+## Expands to
13+
14+```
15+=> ^~ p
16+ |. q
17+```
18+
19+## Discussion
20+
21+Note that `p` is a hoon, not a model; `|:` doesn't bunt your sample as
22+[`|=`](../tis) does.
23+
24+## Syntax
25+
26+Regular: *2-fixed*.
docs/hoon/rune/bar/dot.mdnew file+58
@@ -0,0 +1,58 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 4
5+title: |. "bardot"
6+---
7+
8+# `|. "bardot"`
9+
10+`[%brdt p=hoon]`: form a trap, a core with one arm `$`.
11+
12+## Expands to
13+
14+```
15+|% ++ $ p
16+--
17+```
18+
19+## Syntax
20+
21+Regular: *1-fixed*.
22+
23+## Discussion
24+
25+A trap is a deferred computation.
26+
27+## Examples
28+
29+A trivial trap:
30+
31+```
32+~zod:dojo> =foo |.(42)
33+~zod:dojo> $:foo
34+42
35+~zod:dojo> (foo)
36+42
37+```
38+
39+A more interesting trap:
40+
41+```
42+~zod:dojo> =foo =/ reps 10
43+ =/ step 0
44+ =/ outp 0
45+ |.
46+ ?: =(step reps)
47+ outp
48+ $(outp (add outp 2), step +(step))
49+~zod:dojo> (foo)
50+20
51+```
52+
53+Note that we can use `$()` to recurse back into the
54+trap, since it's a core with an `$` arm.
55+
56+> `$()` expands to `%=($)` (["centis"](../../cen/tis)),
57+> accepting a *jogging* body containing a list of changes
58+> to the subject.
docs/hoon/rune/bar/hep.mdnew file+52
@@ -0,0 +1,52 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 5
5+title: |- "barhep"
6+---
7+
8+# `|- "barhep"`
9+
10+`[%brhp p=hoon]`: form a trap and kick ("*call*") it.
11+
12+## Expands to
13+
14+```
15+=<($ |.(p))
16+```
17+
18+## Syntax
19+
20+Regular: *1-fixed*.
21+
22+## Discussion
23+
24+The `|-` ("barhep") rune can be thought of as a "recursion
25+point". Since `|-` makes a `|.` (["bardot"](../dot), a core
26+with one arm named `$`, we can recurse back into it with `$()`.
27+
28+> `$()` expands to `%=($)` (["centis"](../../cen/tis)),
29+> accepting a *jogging* body containing a list of changes to
30+> the subject.
31+
32+## Examples
33+
34+A trivial loop doesn't even recurse:
35+
36+```
37+~zod:dojo> |-(42)
38+42
39+```
40+
41+The classic loop is a decrement:
42+
43+```
44+~zod:dojo> =foo =/ a 42
45+ =/ b 0
46+ |-
47+ ?: =(a +(b))
48+ b
49+ $(b +(b))
50+~zod:dojo> foo
51+41
52+```
docs/hoon/twig/bar-core/ket-cork.md → docs/hoon/rune/bar/ket.mdrenamed+6−21
@@ -1,24 +1,17 @@
11---
2−navhome: /docs
3−sort: 7
4−
2+navhome: /docs/
3+next: true
4+sort: 6
5+title: |^ "barket"
56---
67
7−# `:cork |^ "barket"`
8+# `|^ "barket"`
89
9−`{$cork p/twig q/(map term foot)}`: form a core with battery and
10+`[%brkt p=hoon q=(map term foot)]`: form a core with battery and
1011anonymous arm `$` and kick it.
1112
1213## Expands to
1314
14−```
15−:per :core
16− ++ $ p
17− q
18− --
19−$
20−```
21−
2215```
2316=> |%
2417 ++ $ p
@@ -35,14 +28,6 @@ Regular: *1-fixed*, then *battery*.
3528
3629A trivial cork:
3730
38−```
39−~zod:dojo> :cork
40− (add n g)
41− ++ n 42
42− ++ g 58
43− --
44−```
45−
4631```
4732~zod:dojo> |^
4833 (add n g)
docs/hoon/rune/bar/sig.mdnew file+31
@@ -0,0 +1,31 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 10
5+title: |~ "barsig"
6+---
7+
8+# `|~ "barsig"`
9+
10+`[%brsg p=model q=hoon]`: form an iron gate.
11+
12+## Expands to
13+
14+```
15+^| |=(p q)
16+```
17+
18+## Syntax
19+
20+Regular: *2-fixed*.
21+
22+## Discussion
23+
24+See [this discussion of core variance models](../../../advanced)
25+
26+## Examples
27+
28+```
29+~zod:dojo> => ~ ^+(|~(a=@ *@) |=(a=* *@))
30+<1|usl {a/@ $~}>
31+```
docs/hoon/rune/bar/tar.mdnew file+57
@@ -0,0 +1,57 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 9
5+title: |* "bartar"
6+---
7+
8+# `|* "bartar"`
9+
10+`[%brtr p=model q=hoon]`: form a gill, a wet one-armed
11+core with sample.
12+
13+## Expands to
14+
15+```
16+=| p
17+|%
18++- $
19+ q
20+--
21+```
22+
23+## Syntax
24+
25+Regular: *2-fixed*.
26+
27+## Discussion
28+
29+In a normal (dry) gate, your argument is converted into the
30+sample type. In a generic (wet) gate or gill, your argument type
31+passes through the function, rather as if it was a macro (there
32+is still only one copy of the code, however).
33+
34+Genericity is a powerful and dangerous tool. Use gills only if
35+you think you know what you're doing.
36+
37+Just as with a [gate](../tis), we can recurse back into a gill
38+with `$()`.
39+
40+> `$()` expands to `%=($)` (["centis"](../../cen/tis)), accepting
41+> a *jogging* body containing a list of changes to the subject.
42+
43+## Examples
44+
45+Wet and dry gates in a nutshell:
46+
47+```
48+~zod:dojo> =foo |=([a=* b=*] [b a])
49+~zod:dojo> =bar |*([a=* b=*] [b a])
50+~zod:dojo> (foo %cat %dog)
51+[6.778.724 7.627.107]
52+~zod:dojo> (bar %cat %dog)
53+[%dog %cat]
54+```
55+
56+The dry gate does not preserve the type of `a` and `b`; the wet
57+gate does.
docs/hoon/rune/bar/tis.mdnew file+49
@@ -0,0 +1,49 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 2
5+title: |= "bartis"
6+---
7+
8+# `|= "bartis"`
9+
10+`[%brts p=model q=hoon]`: form a gate, a dry one-armed core with sample.
11+
12+## Expands to
13+
14+```
15+=| p
16+|% ++ $ q
17+--
18+```
19+
20+## Syntax
21+
22+Regular: *2-fixed*.
23+
24+## Discussion
25+
26+A gate is a core with one arm named `$`, so, just as with
27+[`|-` ("barhep")](../hep), we can recurse back into it with `$()`.
28+
29+> `$()` expands to `%=($)` (["centis"](../../cen/tis)), accepting
30+> a *jogging* body containing a list of changes to the subject.
31+
32+## Examples
33+
34+A trivial gate:
35+
36+```
37+~zod:dojo> =foo |=(a=@ +(a))
38+~zod:dojo> (foo 20)
39+21
40+```
41+
42+A slightly less trivial gate:
43+
44+```
45+~zod:dojo> =foo |= [a=@ b=@]
46+ (add a b)
47+~zod:dojo> (foo 20 400)
48+420
49+```
docs/hoon/twig/bar-core/wut-tray.md → docs/hoon/rune/bar/wut.mdrenamed+5−15
@@ -1,19 +1,15 @@
11---
2−navhome: /docs
3−sort: 9
4−
2+navhome: /docs/
3+sort: 11
4+title: |? "barwut"
55---
66
7−# `:tray |? "barwut"`
7+# `|? "barwut"`
88
9−`{$tray p/seed}`: form a lead trap.
9+`[%brwt p=hoon]`: form a lead trap.
1010
1111## Expands to
1212
13−```
14−:lead :trap p
15−```
16−
1713```
1814^? |. p
1915```
@@ -28,12 +24,6 @@ See this [discussion of the core variance model](../../../advanced).
2824
2925## Examples
3026
31−```
32−~zod:dojo> :per ~ :like :tray(%a) :trap(%a)
33−<1?pqz $~>
34−~zod:dojo> :per ~ :like :tray(%a) :trap(%b)
35−nest-fail
36−```
3727```
3828~zod:dojo> => ~ ^+ |?(%a) |.(%a)
3929<1?pqz $~>
docs/hoon/twig/buc-mold.md → docs/hoon/rune/buc.mdrenamed+9−8
@@ -1,10 +1,11 @@
11---
22navhome: /docs/
3−sort: 7
4−
3+next: true
4+sort: 20
5+title: Mold $ "buc"
56---
67
7−# Mold, `$` ("buc")
8+# Mold `$` "buc"
89
910A *mold* is a `gate` (function) that helps us build simple and
1011rigorous data structures. (In fact, since "mold" sounds nasty,
@@ -13,7 +14,7 @@ we often call molds and mold builders "structures.")
1314## Overview
1415
1516A correct mold is a *normalizer*: an idempotent function across
16−all nouns. If the sample of a gate has span `%noun`, and its
17+all nouns. If the sample of a gate has type `%noun`, and its
1718body obeys the constraint that for any x, `=((mold x) (mold (mold
1819x)))`, it's a normalizer and can be used as a mold.
1920
@@ -22,12 +23,12 @@ statically, so we can't actually tell if a mold matches this
2223definition perfectly. This is not actually a problem.)
2324
2425Twigs in the `$` family are macros designed for making molds.
25−But any Hoon twig may produce a mold. (This is why `moss` is a
26−synonym for `twig`).
26+But any hoon may produce a mold. (This is why `model` is a
27+synonym for `hoon`).
2728
28−Many macros *bunt* a mold, producing `:burn(:per(mold $))`. This
29+Many macros *bunt* a mold, producing `^~(=>(mold $))`. This
2930produces a constant default value. The formal range of a mold
30−(the span of its bunt) is called its *icon*.
31+(the type of its bunt) is called its *icon*.
3132
3233Molds have two uses: defining simple and rigorous structures, and
3334validating untrusted input data. Validation, though very
docs/hoon/rune/buc/base.mdnew file+34
@@ -0,0 +1,34 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 1
5+title: Base molds
6+---
7+
8+# Base molds
9+
10+`[%base p=$@(?(%noun %cell %bean %null) [%atom p=aura])]`: trivial molds.
11+
12+## Produces
13+
14+A mold for the base in `p`. `%noun` is any noun; `%atom` is any
15+atom; `%cell` is a cell of nouns; `%bean` is a loobean, ``?(`@f`0
16+`@f`1)``. `%null` is zero with aura `@n`.
17+
18+## Syntax
19+
20+Irregular: `*` makes `,%noun`, `^` makes `,%cell`, `?` makes
21+`,%bean`, `,~` makes `,%null`, `@aura` makes atom `aura`.
22+
23+## Examples
24+
25+```
26+~zod:dojo> (* %foo)
27+7.303.014
28+~zod:dojo> (,~ 0)
29+~
30+~zod:dojo> (^ 0)
31+^
32+~zod:dojo> (@ux [1 1])
33+0x0
34+```
docs/hoon/rune/buc/cab.mdnew file+42
@@ -0,0 +1,42 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 9
5+title: $_ "buccab"
6+---
7+
8+# `$_ "buccab"`
9+
10+`[%bccb p=hoon]`: mold which normalizes to an example.
11+
12+## Expands to
13+
14+```
15+|=(* p)
16+```
17+
18+## Syntax
19+
20+Regular: *1-fixed*.
21+
22+Irregular: `_foo` is `$_(foo)`.
23+
24+## Discussion
25+
26+`$_` ("buccab") discards the sample it's supposedly normalizing
27+and produces its *example* instead.
28+
29+## Examples
30+
31+```
32+~zod:dojo> =foo $_([%foobar %moobaz])
33+
34+~zod:dojo> (foo %foo %bar)
35+[%foobar %moobaz]
36+
37+~zod:dojo> `foo`[%foobar %moobaz]
38+[%foobar %moobaz]
39+
40+~zod:dojo $:foo
41+[%foobar %moobaz]
42+```
docs/hoon/rune/buc/cen.mdnew file+45
@@ -0,0 +1,45 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 5
5+title: $% "buccen"
6+---
7+
8+# `$% "buccen"`
9+
10+`[%bccn p=(list [[aura @] model])]`: mold which recognizes a union tagged by head atom.
11+
12+## Normalizes to
13+
14+For any item `i` in `p`, a cell whose head is the atom `q.p.i.p`,
15+and whose tail recognizes `q.i.p`.
16+
17+Void if `p` is empty.
18+
19+## Defaults to
20+
21+For the first item `i` in `p`, the cell `[q.p.i.p $:q.i.p]`.
22+Crashes if `p` is empty.
23+
24+## Syntax
25+
26+Regular form: *2-running*.
27+
28+## Discussion
29+
30+A `$%` ("buccen") is a tagged union, an extremely common data model.
31+
32+Make sure the first item in your `$%` terminates, or the default will
33+be an infinite loop!
34+
35+## Examples
36+
37+```
38+~zod:dojo> =foo $%([%foo p=@ud q=@ud] [%bar p=@ud])
39+
40+~zod:dojo> (foo [%bar 37])
41+[%bar p=37]
42+
43+~zod:dojo> $:foo
44+[%foo p=0 q=0]~
45+```
docs/hoon/twig/buc-mold/col-bank.md → docs/hoon/rune/buc/col.mdrenamed+8−19
@@ -1,12 +1,13 @@
11---
22navhome: /docs/
3−sort: 2
4−
3+next: true
4+sort: 3
5+title: $: "buccol"
56---
67
7−# `:bank $: "buccol"`
8+# `$: "buccol"`
89
9−`{$bank p/(list moss)}`: form a mold which recognizes a tuple.
10+`[%bccl p=(list model)]`: form a mold which recognizes a tuple.
1011
1112## Normalizes
1213
@@ -25,25 +26,13 @@ Crashes if `p` is empty.
2526
2627Regular: *running*.
2728
28−Irregular: `{a b c}` is `:bank(a b c)`.
29+Irregular (noun mode): `,[a b c]` is `$:(a b c)`.
30+Irregular (mold mode): `[a b c]` is `$:(a b c)`.
2931
3032## Examples
3133
3234```
33−~zod:dojo> =foo :bank(p/@ud q/@tas)
34−
35−~zod:dojo> (foo 33 %foo)
36−[p=33 q=%foo]
37−
38−~zod:dojo> `foo`[33 %foo]
39−[p=33 q=%foo]
40−
41−~zod:dojo> $:foo
42−[p=0 q=%$]
43−```
44−
45−```
46−~zod:dojo> =foo $:(p/@ud q/@tas)
35+~zod:dojo> =foo $:(p=@ud q=@tas)
4736
4837~zod:dojo> (foo 33 %foo)
4938[p=33 q=%foo]
docs/hoon/rune/buc/hep.mdnew file+35
@@ -0,0 +1,35 @@
1+---
2+navhome: /docs/
3+sort: 10
4+title: $- "buchep"
5+---
6+
7+# `$- "buchep"`
8+
9+`[%bchp p=model q=model]`: mold which normalizes to an example gate.
10+
11+## Expands to
12+
13+```
14+$_ ^|
15+|=(p $:q)
16+```
17+
18+## Syntax
19+
20+Regular: *2-fixed*.
21+
22+## Discussion
23+
24+Since a `$-` ("buchep") is a [`$_` ("buccab")](../cab/), it is not useful for
25+normalizing, just for typechecking. In particular, the existence of `$-`s does
26+*not* let us send gates or other cores over the network!
27+
28+## Examples
29+
30+```
31+~zod:dojo> =foo $-(%foo %bar)
32+
33+~zod:dojo> ($:foo %foo)
34+%bar
35+```
docs/hoon/rune/buc/ket.mdnew file+41
@@ -0,0 +1,41 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 7
5+title: $^ "bucket"
6+---
7+
8+# `$^ "bucket"`
9+
10+`[%bckt p=model q=model]`: mold which normalizes a union tagged by head depth (cell).
11+
12+## Normalizes to
13+
14+Default, if the sample is an atom; `p`, if the head of the sample
15+is an atom; `q` otherwise.
16+
17+## Defaults to
18+
19+The default of `p`.
20+
21+## Syntax
22+
23+Regular: *2-fixed*.
24+
25+## Examples
26+
27+```
28+~zod:dojo> =a $%([%foo p=@ud q=@ud] [%bar p=@ud])
29+
30+~zod:dojo> =b $^([a a] a)
31+
32+~zod:dojo> (b [[%bar 33] [%foo 19 22]])
33+[[%bar p=33] [%foo p=19 q=22]]
34+
35+~zod:dojo> (b [%foo 19 22])
36+[%foo p=19 q=22]
37+
38+~zod:dojo> $:b
39+[%bar p=0]
40+```
41+
docs/hoon/twig/buc-mold/pat-claw.md → docs/hoon/rune/buc/pat.mdrenamed+6−17
@@ -1,12 +1,13 @@
11---
22navhome: /docs/
3−sort: 5
4−
3+next: true
4+sort: 6
5+title: $@ "bucpat"
56---
67
7−# `:claw $@ "bucpat"`
8+# `$@ "bucpat"`
89
9−`{$claw p/moss q/moss}`: mold which normalizes a union tagged by depth.
10+`[%bcpt p=model q=model]`: mold which normalizes a union tagged by head depth (atom).
1011
1112## Normalizes to
1213
@@ -27,21 +28,9 @@ Product: a mold which applies `p` if its sample is an atom,
2728Regular form: *2-fixed*.
2829
2930Example:
30−```
31−~zod:dojo> =a :claw($foo :bank(p/$bar q/@ud))
32−
33−~zod:dojo> (a %foo)
34−%foo
35−
36−~zod:dojo> `a`[%bar 99]
37−[p=%bar q=99]
38−
39−~zod:dojo> $:a
40−[%foo p=0 q=0]
41−```
4231
4332```
44−~zod:dojo> =a $@($foo $:(p/$bar q/@ud))
33+~zod:dojo> =a $@(%foo $:(p=%bar q=@ud))
4534
4635~zod:dojo> (a %foo)
4736%foo
docs/hoon/rune/buc/tis.mdnew file+41
@@ -0,0 +1,41 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 8
5+title: $= "buctis"
6+---
7+
8+# `$= "buctis"`
9+
10+`[%bcts p=@tas q=model]`: mold which wraps a face around another mold.
11+
12+## Expands to
13+
14+```
15+|= *
16+^=(p %-(q +6))
17+```
18+
19+## Syntax
20+
21+Regular: *2-fixed*.
22+
23+Irregular (mold mode): `foo=bar` is `$=(foo bar)`.
24+
25+## Discussion
26+
27+Note that the Hoon compiler is at least slightly clever about
28+compiling molds, and almost never has to actually put in a gate
29+layer (as seen in the expansion above) to apply a `$=`.
30+
31+## Examples
32+
33+```
34+~zod:dojo> =a $=(p %foo)
35+
36+~zod:dojo> (a %foo)
37+p=%foo
38+
39+~zod:dojo> (a %bar)
40+p=%foo
41+```
docs/hoon/rune/buc/wut.mdnew file+49
@@ -0,0 +1,49 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 4
5+title: $? "bucwut"
6+---
7+
8+# `$? "bucwut"`
9+
10+`[%bcwt p=(list model)]`: mold which normalizes a general union.
11+
12+## Normalizes to
13+
14+The first item in `p` which normalizes the sample to itself;
15+otherwise, default.
16+
17+Void, if `p` is empty.
18+
19+## Defaults to
20+
21+The first item in `p`.
22+
23+## Syntax
24+
25+Regular: *running*.
26+
27+Irregular: `?(%foo %bar)` is `$?(%foo %bar)`.
28+
29+## Discussion
30+
31+For a union of atoms, a `$?` ("bucwut") is fine. For more complex nouns,
32+always try to use a [`$%` ("buccen")](../cen/), [`$@` ("bucpat")](../pat/) or
33+[`$^` ("bucket")](../ket/), at least if you expect your mold to be used as a
34+normalizer.
35+
36+## Examples
37+
38+```
39+~zod:dojo> =a ?(%foo %bar %baz)
40+
41+~zod:dojo> (a %baz)
42+%baz
43+
44+~zod:dojo> (a [37 45])
45+%baz
46+
47+~zod:dojo> $:a
48+%baz
49+```
docs/hoon/rune/cen.mdnew file+16
@@ -0,0 +1,16 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 18
5+title: Call % ("cen")
6+---
7+
8+# Call `%` ("cen")
9+
10+We've already covered [`%wing`](../limb/wing) and [`%limb`](../limb/limb). These are simple
11+forms of the *invocation* family of hoons, `%`, whose general
12+form is `%=` ("centis").
13+
14+## Stems
15+
16+<list dataPreview="true" className="runes"></list>
docs/hoon/rune/cen/cab.mdnew file+39
@@ -0,0 +1,39 @@
1+---
2+navhome: /docs/
3+sort: 8
4+title: %_ "cencab"
5+---
6+
7+# `%_ "cencab"`
8+
9+`[%cncb p=wing q=(list (pair wing hoon))]`: take a wing with changes,
10+preserving type.
11+
12+## Expands to
13+
14+```
15+^+(p %=(p q))
16+```
17+
18+## Syntax
19+
20+Regular: *1-fixed*, then *jogging*.
21+
22+## Discussion
23+
24+`%_` ("cencab") is different from `%=` ("centis") because `%=`
25+can change the type of a limb with mutations.
26+
27+## Examples
28+
29+```
30+~zod:dojo> =foo [p=42 q=6]
31+~zod:dojo> foo(p %bar)
32+[p=%bar q=6]
33+~zod:dojo> foo(p [55 99])
34+[p=[55 99] q=6]
35+~zod:dojo> %_(foo p %bar)
36+[p=7.496.034 99]
37+~zod:dojo> %_(foo p [55 99])
38+! nest-fail
39+```
docs/hoon/rune/cen/dot.mdnew file+29
@@ -0,0 +1,29 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 3
5+title: %. "cendot"
6+---
7+
8+# `%. "cendot"`
9+
10+`[%cndt p=hoon q=hoon]`: call a gate (function), reversed.
11+
12+## Expands to
13+
14+```
15+%-(q p)
16+```
17+
18+## Syntax
19+
20+Regular: *2-fixed*.
21+
22+## Examples
23+
24+```
25+~zod:dojo> =add-triple |=([a=@ b=@ c=@] :(add a b c))
26+~zod:dojo> %.([1 2 3] add-triple)
27+6
28+```
29+
docs/hoon/twig/cen-call/hep-call.md → docs/hoon/rune/cen/hep.mdrenamed+10−20
@@ -1,18 +1,16 @@
11---
22navhome: /docs/
3−sort: 4
3+next: true
4+sort: 2
5+title: %- "cenhep"
46---
57
6−# `:call %- "cenhep"`
8+# `%- "cenhep"`
79
8−`{$call p/seed q/seed}`: call a gate (function).
10+`[%cnhp p=hoon q=hoon]`: call a gate (function).
911
1012## Expands to
1113
12−```
13−:open($ p q)
14−```
15−
1614```
1715%~($ p q)
1816```
@@ -21,13 +19,13 @@ sort: 4
2119
2220Regular: *2-fixed*.
2321
24−Irregular: `(a)` is `$:a`; `(a b c d)` is `:call(a [b c d])`.
22+Irregular: `(a)` is `$:a`; `(a b c d)` is `%-(a [b c d])`.
2523
2624## Discussion
2725
28−`$call` is a function call; `p` is the function (`gate`), `q` the
29−argument. `$call` is a special case of `$open`, and a gate is a
30−special case of a door.
26+`%-` ("cenhep") is a function call; `p` is the function ([`gate`](../../bar/tis),
27+`q` the argument. `%-` is a special case of [`%~` ("censig")](../sig), and a gate
28+is a special case of a [door](../../bar/cab).
3129
3230In a gate, the modified core has only one anonymous arm; in a
3331door it gets a full battery. Intuitively, a gate defines one
@@ -41,15 +39,7 @@ Hoon, this shared sample is likely to be pulled into a door.
4139## Examples
4240
4341```
44−~zod:dojo> =add-triple :gate({a/@ b/@ c/@} :(add a b c))
45−~zod:dojo> (add-triple 1 2 3)
46−6
47−~zod:dojo> :call(add-triple [1 2 3])
48−6
49−```
50−
51−```
52−~zod:dojo> =add-triple |=({a/@ b/@ c/@} :(add a b c))
42+~zod:dojo> =add-triple |=([a=@ b=@ c=@] :(add a b c))
5343~zod:dojo> (add-triple 1 2 3)
54446
5545~zod:dojo> %-(add-triple [1 2 3])
docs/hoon/rune/cen/ket.mdnew file+28
@@ -0,0 +1,28 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 5
5+title: %^ "cenket"
6+---
7+
8+# `%^ "cenket"`
9+
10+`[%cnkt p=hoon q=hoon r=hoon s=hoon]`: call with triple sample.
11+
12+## Expands to
13+
14+```
15+%-(p [q r s])
16+```
17+
18+## Syntax
19+
20+Regular: *4-fixed*.
21+
22+## Examples
23+
24+```
25+~zod:dojo> =add-triple |=([a/@ b/@ c/@] :(add a b c))
26+~zod:dojo> %^(add-triple 1 2 3)
27+6
28+```
docs/hoon/rune/cen/lus.mdnew file+28
@@ -0,0 +1,28 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 4
5+title: %+ "cenlus"
6+---
7+
8+# `%+ "cenlus"`
9+
10+`[%cnls p=hoon q=hoon r=hoon]`: call with pair sample.
11+
12+## Expands to
13+
14+```
15+%-(p [q r])
16+```
17+
18+## Syntax
19+
20+Regular: *3-fixed*.
21+
22+## Examples
23+
24+```
25+~zod:dojo> =add-triple |=([a=@ b=@ c=@] :(add a b c))
26+~zod:dojo> %+(add-triple 1 [2 3])
27+6
28+```
docs/hoon/rune/cen/sig.mdnew file+42
@@ -0,0 +1,42 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 6
5+title: %~ "censig"
6+---
7+
8+# `%~ "censig"`
9+
10+`[%cnsg p=wing q=hoon r=hoon]`: call with multi-armed door.
11+
12+## Expands to
13+
14+```
15+=+ a=q
16+=<(p %=(a +6 r))
17+```
18+
19+> Note: the expansion implementation is hygienic -- it doesn't actually add the
20+> `a` face to the subject. It's shown here because `%=` ("centis") requires a `wing`.
21+
22+## Syntax
23+
24+Regular: *3-fixed*.
25+
26+Irregular: `~(a b c)` is `%~(a b c)`; `~(a b c d e)` is `%~(a b
27+[c d e])`.
28+
29+## Discussion
30+
31+`%~` ("censig") is the general case of a function call, `%-` ("cenhep"). In
32+both, we replace the sample (`+6`) of a core. In `%-` the
33+core is a gate and we pull the `$` arm. In `%~` the
34+core is a door and we can pull any of its arms.
35+
36+Most languages do not have cores, doors, or `%~`. "Just
37+learn to step outside your linear, Western way of thinking."
38+
39+## Examples
40+
41+See [`|_`](../../bar/cab).
42+
docs/hoon/twig/cen-call/tar-bake.md → docs/hoon/rune/cen/tar.mdrenamed+9−13
@@ -1,21 +1,17 @@
11---
2−navhome: /docs
3−sort: 8
2+navhome: /docs/
3+next: true
4+sort: 7
5+title: %* "centar"
46---
57
6−# `:bake %* "centar"`
8+# `%* "centar"`
79
8−`{$bake p/wing q/twig r/(list (pair wing seed))}`: make
9−with arbitrary twig.
10+`[%cntr p=wing q=hoon r=(list (pair wing hoon))]`: make
11+with arbitrary hoon.
1012
1113## Expands to
1214
13−```
14−:pin q
15−:make p
16−r
17−```
18−
1915```
2016=+ q
2117%= p
@@ -28,8 +24,8 @@ Regular: *2-fixed*, then *jogging*.
2824
2925## Discussion
3026
31−`%*` makes a limb from a twig, with changes. It's useful when you want
32−evaluate a twig, pull out a single limb from the result,
27+`%*` makes a limb from a hoon, with changes. It's useful when you want
28+evaluate a hoon, pull out a single limb from the result,
3329and then change some parts of the limb before using it.
3430
3531## Examples
docs/hoon/twig/cen-call/tis-make.md → docs/hoon/rune/cen/tis.mdrenamed+9−7
@@ -1,11 +1,13 @@
11---
22navhome: /docs/
3+next: true
34sort: 1
5+title: %= "centis"
46---
57
6−# `:make %= "centis"`
8+# `%= "centis"`
79
8−`{$make p/wing q/(list (pair wing seed))}`: take a wing with changes.
10+`[%cnts p=wing q=(list (pair wing hoon))]`: take a wing with changes.
911
1012## Produces
1113
@@ -19,21 +21,21 @@ containing that arm. We compute the arm on the modified core.
1921
2022Regular: *1-fixed*, then *jogging*.
2123
22−Irregular: `foo(x 1, y 2, z 3)` is `:make(foo x 1, y 2, z 3)`.
24+Irregular: `foo(x 1, y 2, z 3)` is `%=(foo x 1, y 2, z 3)`.
2325
2426## Discussion
2527
26−Note that `p` is a wing, not a twig. Knowing that a function
28+Note that `p` is a wing, not a hoon. Knowing that a function
2729call `(foo bar)` involves making `foo`, replacing its sample
2830at slot `+6` with `bar`, and taking the `$` limb, you might think
29−`(foo bar)` would mean `:make(foo +6 bar)`.
31+`(foo bar)` would mean `%=(foo +6 bar)`.
3032
31−But it's actually `:pin(foo :per(:make(+2 +6 bar) $))`. Even if `foo` is
33+But it's actually `=+(foo =>(%=(+2 +6 bar) $))`. Even if `foo` is
3234a wing, we would just be mutating `+6` within the core that defines the
3335`foo` arm. Instead we want to modify the *product* of `foo` -- the gate
3436-- so we have to pin it into the subject.
3537
36−Here's that again using runes:
38+Here's that again in tall form:
3739```
3840=+ foo
3941=> %= +2
docs/hoon/rune/col.mdnew file+16
@@ -0,0 +1,16 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 17
5+title: Cell : ("col")
6+---
7+
8+# Cell `:` ("col")
9+
10+The `:` ("col") hoons, `:-` and friends, are simple and regular.
11+All `:` hoons expand to `:-` ("colhep"), which makes a pair
12+(just like the Lisp [`cons`](https://en.wikipedia.org/wiki/Cons) operator).
13+
14+## Stems
15+
16+<list dataPreview="true" className="runes"></list>
docs/hoon/rune/col/cab.mdnew file+27
@@ -0,0 +1,27 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 2
5+title: :_ "colcab"
6+---
7+
8+# `:_ "colcab"`
9+
10+`[%clcb p=hoon q=hoon]`; construct a cell, inverted.
11+
12+### Expands to
13+
14+```
15+:-(q p)
16+```
17+
18+### Syntax
19+
20+Regular: *2-fixed*.
21+
22+### Examples
23+
24+```
25+~zod:dojo> :_(1 2)
26+[2 1]
27+```
docs/hoon/rune/col/hep.mdnew file+51
@@ -0,0 +1,51 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 1
5+title: :- "colhep"
6+---
7+
8+# `:- "colhep"`
9+
10+`[%clhp p=hoon q=hoon]`: construct a cell (2-tuple).
11+
12+## Produces
13+
14+The cell of `p` and `q`.
15+
16+## Syntax
17+
18+Regular: *2-fixed*.
19+
20+Irregular: `[a b]` is `:-(a b)`.
21+
22+Irregular: `[a b c]` is `[a [b c]]`.
23+
24+Irregular: `a^b^c` is `[a b c]`.
25+
26+Irregular: `a/b` is `[%a b]`.
27+
28+Irregular: `` `a `` is `[~ a]`.
29+
30+Irregular: `~[a b]` is `[a b ~]`.
31+
32+Irregular: `[a b c]~` is `[[a b c] ~]`.
33+
34+## Discussion
35+
36+Hoon hoons actually use the same "autocons" pattern as Nock
37+formulas. If you're assembling hoons (which usually only the
38+compiler does), `[a b]` is the same as `[%clhp a b]`.
39+
40+## Examples
41+
42+```
43+~zod:dojo> :-(1 2)
44+[1 2]
45+~zod:dojo> 1^2
46+[1 2]
47+~zod:dojo> 1/2
48+[%1 2]
49+~zod:dojo> `1
50+[~ 1]
51+```
docs/hoon/rune/col/ket.mdnew file+32
@@ -0,0 +1,32 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 4
5+title: :^ "colket"
6+---
7+
8+# `:^ "colket"`
9+
10+`[%clkt p=hoon q=hoon r=hoon s=hoon]`: construct a quadruple (4-tuple).
11+
12+## Expands to
13+
14+```
15+:-(p :-(q :-(r s)))
16+```
17+
18+## Syntax
19+
20+Regular: *4-fixed*.
21+
22+## Examples
23+
24+```
25+/~zod:dojo> :^(1 2 3 4)
26+[1 2 3 4]
27+/~zod:dojo> :^ 5
28+ 6
29+ 7
30+ 8
31+[5 6 7 8]
32+```
docs/hoon/rune/col/lus.mdnew file+31
@@ -0,0 +1,31 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 3
5+title: :+ "collus"
6+---
7+
8+# `:+ "collus"`
9+
10+`[%clls p=hoon q=hoon r=hoon]`: construct a triple (3-tuple).
11+
12+## Expands to:
13+
14+```
15+:-(p :-(q r))
16+```
17+
18+## Syntax
19+
20+Regular: *3-fixed*.
21+
22+## Examples
23+
24+```
25+/~zod:dojo> :+ 1
26+ 2
27+ 3
28+[1 2 3]
29+/~zod:dojo> :+(%a ~ 'b')
30+[%a ~ 'b']
31+```
docs/hoon/rune/col/sig.mdnew file+47
@@ -0,0 +1,47 @@
1+---
2+navhome: /docs/
3+sort: 6
4+title: :~ "colsig"
5+---
6+
7+# `:~ "colsig"`
8+
9+`[%clsg p=(list hoon)]`: construct a null-terminated list.
10+
11+## Expands to
12+
13+*Pseudocode*: `a`, `b`, `c`, ... as elements of `p`:
14+
15+```
16+:-(a :-(b :-(c :-(... :-(z ~)))))
17+```
18+
19+### Compiler macro
20+
21+```
22+|-
23+?~ p
24+ ~
25+:- i.p
26+$(p t.p)
27+```
28+
29+## Syntax
30+
31+Regular: *running*.
32+
33+## Examples
34+
35+```
36+~zod:dojo> :~(5 3 4 2 1)
37+[5 3 4 2 1 ~]
38+~zod:dojo> ~[5 3 4 2 1]
39+[5 3 4 2 1 ~]
40+~zod:dojo> :~ 5
41+ 3
42+ 4
43+ 2
44+ 1
45+ ==
46+[5 3 4 2 1 ~]
47+```
docs/hoon/rune/col/tar.mdnew file+54
@@ -0,0 +1,54 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 5
5+title: :* "coltar"
6+---
7+
8+# `:* "coltar"`
9+
10+`[%cltr p=(list hoon)]`: construct an n-tuple.
11+
12+## Expands to
13+
14+*Pseudocode*: `a`, `b`, `c`, ... as elements of `p`:
15+
16+```
17+:-(a :-(b :-(c :-(... z)))))
18+```
19+
20+### Compiler macro
21+
22+```
23+|-
24+?~ p
25+ !!
26+?~ t.p
27+ i.p
28+:- i.p
29+$(p t.p)
30+```
31+
32+## Syntax
33+
34+Regular: *running*.
35+
36+## Examples
37+
38+```
39+/~zod:dojo> :*(5 3 4 1 4 9 0 ~ 'a')
40+[5 3 4 1 4 9 0 ~ 'a']
41+/~zod:dojo> [5 3 4 1 4 9 0 ~ 'a']
42+[5 3 4 1 4 9 0 ~ 'a']
43+/~zod:dojo> :* 5
44+ 3
45+ 4
46+ 1
47+ 4
48+ 9
49+ 0
50+ ~
51+ 'a'
52+ ==
53+[5 3 4 1 4 9 0 ~ 'a']
54+```
docs/hoon/twig/dot-nock.md → docs/hoon/rune/dot.mdrenamed+4−3
@@ -1,10 +1,11 @@
11---
22navhome: /docs/
3−sort: 10
4−
3+next: true
4+sort: 11
5+title: Nock . ("dot")
56---
67
7−# Nock, `.` (dot)
8+# Nock `.` ("dot")
89
910Anything Nock can do, Hoon can do also.
1011
docs/hoon/twig/dot-nock/ket-wish.md → docs/hoon/rune/dot/ket.mdrenamed+4−3
@@ -1,11 +1,12 @@
11---
22navhome: /docs/
33sort: 5
4+title: .^ "dotket"
45---
56
6−# `:wish .^ "dotket"`
7+# `.^ "dotket"`
78
8−`{$wish p/moss q/seed}`: load from the Arvo namespace with Nock `11`.
9+`[%dtkt p=model q=value]`: load from the Arvo namespace with Nock `11`.
910
1011## Produces
1112
@@ -17,5 +18,5 @@ Nock has no `11` instruction, of course. But the virtual Nock
1718used to run userspace code does. Nock `11` loads from a
1819typed immutable namespace defined by its virtual context.
1920
20−We don't remold dynamically nouns in a `:wish`, but we do check
21+We don't remold dynamically nouns in a `.^`, but we do check
2122that the type of the value nests in `p`.
docs/hoon/twig/dot-nock/lus-bump.md → docs/hoon/rune/dot/lus.mdrenamed+5−3
@@ -1,11 +1,13 @@
11---
22navhome: /docs/
3+next: true
34sort: 3
5+title: .+ "dotlus"
46---
57
6−# `:bump .+ "dotlus"`
8+# `.+ "dotlus"`
79
8−`{$bump p/atom}`: increment an atom with Nock `4`.
10+`[%dtls p=atom]`: increment an atom with Nock `4`.
911
1012## Produces
1113
@@ -21,7 +23,7 @@ Irregular: `+(6)` is `.+(6)`.
2123## Examples
2224
2325```
24−~zod:dojo> :bump(6)
26+~zod:dojo> .+(6)
25277
2628~zod:dojo> +(6)
27297
docs/hoon/twig/dot-nock/tar-nock.md → docs/hoon/rune/dot/tar.mdrenamed+6−19
@@ -1,15 +1,17 @@
11---
22navhome: /docs/
3+next: true
34sort: 1
5+title: .* "dottar"
46---
57
6−# `:nock .* "dottar"`
8+# `.* "dottar"`
79
8−`{$nock p/seed q/seed}`: evaluate with Nock `2`.
10+`[%dttr p=hoon q=hoon]`: evaluate with Nock `2`.
911
1012## Produces
1113
12−Nock of formula `q` and subject `p`, with span `%noun`.
14+Nock of formula `q` and subject `p`, with type `%noun`.
1315
1416## Syntax
1517
@@ -17,27 +19,12 @@ Regular: *2-fixed*.
1719
1820## Discussion
1921
20−Note that `:nock` can be used to bypass the type system,
22+Note that `.*` ("dottar") can be used to bypass the type system,
2123though its product contains no type information. It's
2224perfectly practical to use Hoon as a typeless language.
2325
2426## Examples
2527
26−```
27−~zod:dojo> :nock([20 30] [0 2])
28−20
29−~zod:dojo> :nock(33 [4 0 1])
30−34
31−~zod:dojo> :nock(|.(50) [9 2 0 1])
32−50
33−~zod:dojo> :nock(12 [7 [`1 [4 `1]] [`2 `3 `2]])
34−[12 13 12]
35−~zod:dojo> :nock(~ [5 1^4 [4 1^3]])
36−0
37−~zod:dojo> :nock(~ [5 1^5 [4 1^3]])
38−1
39−```
40−
4128```
4229~zod:dojo> .*([20 30] [0 2])
433020
docs/hoon/twig/dot-nock/tis-same.md → docs/hoon/rune/dot/tis.mdrenamed+8−8
@@ -1,11 +1,13 @@
11---
22navhome: /docs/
3+next: true
34sort: 4
5+title: .= "dottis"
46---
57
6−# `:same .= "dottis"`
8+# `.= "dottis"`
79
8−`{$same p/seed q/seed}`: test for equality with Nock `5`.
10+`[%dtts p=hoon q=hoon]`: test for equality with Nock `5`.
911
1012## Produces
1113
@@ -19,7 +21,7 @@ Irregular: `=(a b)` is `.=(a b)`.
1921
2022## Discussion
2123
22−Like Nock equality, `:same` tests if two nouns are the same,
24+Like Nock equality, `.=` ("dottis") tests if two nouns are the same,
2325ignoring invisible pointer structure. Because in a conventional
2426noun implementation each noun has a lazy short hash, comparisons
2527are fast unless the hash needs to be computed, or we are comparing
@@ -29,14 +31,12 @@ is a common cause of performance bugs.)
2931## Examples
3032
3133```
32−~zod:dojo> :same(0 0)
34+~zod:dojo> .=(0 0)
3335%.y
34−~zod:dojo> :same(1 2)
35−%.n
36−```
37−```
3836~zod:dojo> =(0 0)
3937%.y
38+~zod:dojo> .=(1 2)
39+%.n
4040~zod:dojo> =(1 2)
4141%.n
4242```
docs/hoon/rune/dot/wut.mdnew file+27
@@ -0,0 +1,27 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 2
5+title: .? "dotwut"
6+---
7+
8+# `.? "dotwut"`
9+
10+`[%dtwt p=hoon]`: test for cell or atom with Nock `3`.
11+
12+## Produces
13+
14+`&`, `%.y`, `0` if `p` is a cell; otherwise `|`, `%.n`, `1`.
15+
16+## Syntax
17+
18+Regular: *1-fixed*.
19+
20+## Examples
21+
22+```
23+~zod:dojo> .?(42)
24+%.n
25+~zod:dojo> .?([42 43])
26+%.y
27+```
docs/hoon/rune/ket.mdnew file+19
@@ -0,0 +1,19 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 19
5+title: Cast ^ ("ket")
6+---
7+
8+# Cast `^` ("ket")
9+
10+[`^-` ("kethep")](./hep/), [`^+` ("ketlus")](./lus/), and
11+[`^=` ("kettis")](./tis/) let us adjust types without violating type
12+constraints.
13+
14+The `nest` algorithm which tests subtyping is conservative;
15+it never allows invalid nests, it sometimes rejects valid nests.
16+
17+## Twigs
18+
19+<list dataPreview="true" className="runes"></list>
docs/hoon/twig/ket-cast/bar-iron.md → docs/hoon/rune/ket/bar.mdrenamed+6−11
@@ -1,11 +1,13 @@
11---
22navhome: /docs/
3+next: true
34sort: 5
5+title: ^| "ketbar"
46---
57
6−# `:iron ^| "ketbar"`
8+# `^| "ketbar"`
79
8−`{$iron p/seed}`: convert a gold core to an iron core (contravariant).
10+`[%ktbr p=hoon]`: convert a gold core to an iron core (contravariant).
911
1012## Produces
1113
@@ -19,8 +21,8 @@ Regular: *1-fixed*.
1921
2022An iron core is an opaque function (gate or door).
2123
22−Theorem: if span `x` nests within span `a`, and span `y` nests
23−within span `b`, a core accepting `b` and producing `x` nests
24+Theorem: if type `x` nests within type `a`, and type `y` nests
25+within type `b`, a core accepting `b` and producing `x` nests
2426within a iron core accepting `y` and producing `a`.
2527
2628Informally, a function fits an interface if the function has a
@@ -31,13 +33,6 @@ interface.
3133
3234The prettyprinter shows the core metal (`.` gold, `|` iron):
3335
34−```
35−~zod:dojo> :gate(@ 1)
36−<1.gcq [@ @n <250.yur 41.wda 374.hzt 100.kzl 1.ypj %151>]>
37−~zod:dojo> :iron(:gate(@ 1))
38−<1|gcq [@ @n <250.yur 41.wda 374.hzt 100.kzl 1.ypj %151>]>
39−```
40−
4136```
4237~zod:dojo> |=(@ 1)
4338<1.gcq [@ @n <250.yur 41.wda 374.hzt 100.kzl 1.ypj %151>]>
docs/hoon/twig/ket-cast/hep-cast.md → docs/hoon/rune/ket/hep.mdrenamed+8−24
@@ -1,18 +1,16 @@
11---
22navhome: /docs/
3−sort: 2
3+next: true
4+sort: 1
5+title: ^- "kethep"
46---
57
6−# `:cast ^- "kethep"`
8+# `^- "kethep"`
79
8−`{$cast p/moss q/seed}`: typecast by mold.
10+`[%kthp p=model q=value]`: typecast by mold.
911
1012## Expands to
1113
12−```
13−:like(:bunt(p) q)
14−```
15−
1614```
1715^+(*p q)
1816```
@@ -21,11 +19,11 @@ sort: 2
2119
2220Regular: *2-fixed*.
2321
24−Irregular: `` `foo`bar`` is `:cast(foo bar)`.
22+Irregular: `` `foo`bar`` is `^-(foo bar)`.
2523
2624## Discussion
2725
28−It's a good practice to put a `:cast` at the top of every arm
26+It's a good practice to put a `^-` ("kethep") at the top of every arm
2927(including gates, loops, etc). This cast is strictly necessary
3028only in the presence of head recursion (otherwise you'll get a
3129`rest-loop` error, or if you really screw up spectacularly an
@@ -33,20 +31,6 @@ infinite loop in the compiler).
3331
3432## Examples
3533
36−```
37−~zod:dojo> (add 90 7)
38−97
39−~zod:dojo> `@t`(add 90 7)
40−'a'
41−~zod:dojo> :cast(@t (add 90 7))
42−'a'
43−/~zod:dojo> =foo :gate a/@tas
44− :cast (unit @ta)
45− `a
46−/~zod:dojo> (foo 97)
47−[~ ~.a]
48−```
49−
5034```
5135~zod:dojo> (add 90 7)
523697
@@ -54,7 +38,7 @@ infinite loop in the compiler).
5438'a'
5539~zod:dojo> ^-(@t (add 90 7))
5640'a'
57−/~zod:dojo> =foo |= a/@tas
41+/~zod:dojo> =foo |= a=@tas
5842 ^- (unit @ta)
5943 `a
6044/~zod:dojo> (foo 97)
docs/hoon/rune/ket/lus.mdnew file+26
@@ -0,0 +1,26 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 2
5+title: ^+ "ketlus"
6+---
7+
8+# `^+ "ketlus"`
9+
10+`[%ktls p=value q=value]`: typecast by example (hoon).
11+
12+## Produces
13+
14+The value of `q` with the type of `p`, if the type of `q` nests
15+within the type of `p`. Otherwise, `nest-fail`.
16+
17+## Syntax
18+
19+Regular: *2-fixed*.
20+
21+## Examples
22+
23+```
24+~zod:dojo> ^+('text' %a)
25+'a'
26+```
docs/hoon/twig/ket-cast/sig-burn.md → docs/hoon/rune/ket/sig.mdrenamed+5−9
@@ -1,11 +1,13 @@
11---
22navhome: /docs/
3−sort: 6
3+next: true
4+sort: 4
5+title: ^~ "ketsig"
46---
57
6−# `:burn ^~ "ketsig"`
8+# `^~ "ketsig"`
79
8−`{$burn p/seed}`: fold constant at compile time.
10+`[%ktsg p=hoon]`: fold constant at compile time.
911
1012## Produces
1113
@@ -24,9 +26,3 @@ Regular: *1-fixed*.
2426[%1 p=42]
2527```
2628
27−```
28−~zod:dojo> (make ':loop(42)')
29−[%8 p=[%1 p=[1 42]] q=[%9 p=2 q=[%0 p=1]]]
30−~zod:dojo> (make ':burn(:loop(42))')
31−[%1 p=42]
32−```
docs/hoon/twig/ket-cast/tis-name.md → docs/hoon/rune/ket/tis.mdrenamed+9−6
@@ -1,23 +1,26 @@
11---
22navhome: /docs/
3+next: true
34sort: 3
5+title: ^= "kettis"
46---
57
6−# `:name ^= "kettis"`
78
8−`{$name p/toga q/seed}`: name a value.
9+# `^= "kettis"`
10+
11+`[%ktts p=toga q=value]`: name a value.
912
1013## Produces
1114
12−If `p` is a term, the product `q` with span `[%face p q]`. `p`
13−may also be a tuple of terms, or a term-toga pair; the span of
15+If `p` is a term, the product `q` with type `[%face p q]`. `p`
16+may also be a tuple of terms, or a term-toga pair; the type of
1417`q` must divide evenly into cells to match it.
1518
1619## Syntax
1720
1821Regular: *2-fixed*.
1922
20−Irregular: `foo=bar` is `:name(foo bar)`.
23+Irregular: `foo=bar` is `^=(foo bar)`.
2124
2225## Examples
2326
@@ -27,7 +30,7 @@ a=1
2730~zod:dojo> ^= a
2831 1
2932a=1
30−~zod:dojo> :name(a 1)
33+~zod:dojo> ^=(a 1)
3134a=1
3235~zod:dojo> [b c d]=[1 2 3 4]
3336[b=1 c=2 d=[3 4]]
docs/hoon/twig/ket-cast/wut-lead.md → docs/hoon/rune/ket/wut.mdrenamed+5−11
@@ -1,11 +1,12 @@
11---
22navhome: /docs/
3−sort: 4
3+sort: 6
4+title: ^? "ketwut"
45---
56
6−# `:lead ^? "ketwut"`
7+# `^? "ketwut"`
78
8−`{$lead p/seed}`: convert any core to a lead core (bivariant).
9+`[%ktwt p=hoon]`: convert any core to a lead core (bivariant).
910
1011## Produces
1112
@@ -20,7 +21,7 @@ Regular: *1-fixed*.
2021A lead core is an opaque generator; the payload can't be read or
2122written.
2223
23−Theorem: if span `x` nests within span `a`, a lead core producing
24+Theorem: if type `x` nests within type `a`, a lead core producing
2425`x` nests within a lead core producing `a`.
2526
2627Informally, a more specific generator can be used as a less
@@ -30,13 +31,6 @@ specific generator.
3031
3132The prettyprinter shows the core metal (`.` gold, `?` lead):
3233
33−```
34−~zod:dojo> :gate(@ 1)
35−<1.gcq [@ @n <250.yur 41.wda 374.hzt 100.kzl 1.ypj %151>]>
36−~zod:dojo> :lead(:gate(@ 1))
37−<1?gcq [@ @n <250.yur 41.wda 374.hzt 100.kzl 1.ypj %151>]>
38−```
39−
4034```
4135~zod:dojo> |=(@ 1)
4236<1.gcq [@ @n <250.yur 41.wda 374.hzt 100.kzl 1.ypj %151>]>
docs/hoon/twig/sem-make.md → docs/hoon/rune/sem.mdrenamed+3−3
@@ -1,10 +1,10 @@
11---
22navhome: /docs/
3−sort: 11
4−
3+sort: 21
4+title: Make ; ("sem")
55---
66
7−# Make, `;` ("sem")
7+# Make `;` ("sem")
88
99Miscellaneous useful macros.
1010
docs/hoon/twig/sem-make/col-wad.md → docs/hoon/rune/sem/col.mdrenamed+13−19
@@ -1,31 +1,32 @@
11---
22navhome: /docs/
3−sort: 3
3+next: true
4+sort: 1
5+title: ;: "semcol"
46---
57
6−# `:wad ;: "semcol"`
8+# `;: "semcol"`
79
8−`{$wad p/seed q/(list seed)}`: call a binary function as an n-ary function.
10+`[%smcl p=hoon q=(list hoon)]`: call a binary function as an n-ary function.
911
1012## Expands to
1113
12−*Pseudocode*, `a`, `b`, `c`, ... as elements of `q`
14+*Pseudocode*: `a`, `b`, `c`, ... as elements of `q`:
15+
16+Regular form:
1317
1418```
15−:call(p a :call(p b :call(p c ...)))
19+%-(p a %-(p b %-(p c ...)))
1620```
1721
18−### Compiler macro
22+Irregular form:
1923
2024```
21−:loop
22−:ifno q !!
23−:ifno t.q !!
24−:ifno t.t.q
25− :call(p i.q i.t.q)
26−:call(p i.q :moar(q t.q))
25+(p a (p b (p c ...)))
2726```
2827
28+### Compiler macro
29+
2930```
3031|-
3132?~ q !!
@@ -43,13 +44,6 @@ Irregular: `:(add a b c)` is `;:(add a b c)`.
4344
4445## Examples
4546
46−```
47−~zod:dojo> (add 3 (add 4 5))
48−12
49−~zod:dojo> :wad(add 3 4 5)
50−12
51−```
52−
5347```
5448~zod:dojo> (add 3 (add 4 5))
554912
docs/hoon/twig/sem-make/fas-nub.md → docs/hoon/rune/sem/fas.mdrenamed+3−6
@@ -1,18 +1,15 @@
11---
22navhome: /docs/
33sort: 4
4+title: ;/ "semfas"
45---
56
6−# `:nub ;/ "semfas"`
7+# `;/ "semfas"`
78
8−`{$nub p/seed}`: tape as XML element.
9+`[%smfs p=hoon]`: tape as XML element.
910
1011## Expands to
1112
12−```
13−:conl(%$ :conl(%$ p))
14−```
15−
1613```
1714~[%$ ~[%$ 'p']]
1815```
docs/hoon/twig/sem-make/sem-fry.md → docs/hoon/rune/sem/sem.mdrenamed+5−25
@@ -1,20 +1,16 @@
11---
22navhome: /docs/
3−sort: 1
3+next: true
4+sort: 3
5+title: ;; "semsem"
46---
57
6−# `:fry ;; "semsem"`
8+# `;; "semsem"`
79
8−`{$fry p/moss q/seed}`: normalize with a mold, asserting fixpoint.
10+`[%smsm p=model q=value]`: normalize with a mold, asserting fixpoint.
911
1012## Expands to
1113
12−```
13−:pin :name(a (p q))
14−:sure =(`*`a `*`q)
15−a
16−```
17−
1814```
1915=+ a=(p q)
2016?> =(`*`a `*`q)
@@ -32,12 +28,6 @@ Regular: *2-fixed*.
3228
3329Fails because of auras:
3430
35−```
36−~zod:dojo> :cast(tape ~[97 98 99])
37−! nest-fail
38−! exit
39−```
40−
4131```
4232~zod:dojo> ^-(tape ~[97 98 99])
4333! nest-fail
@@ -46,11 +36,6 @@ Fails because of auras:
4636
4737Succeeds because molds don't care about auras:
4838
49−```
50−~zod:dojo> :fry(tape ~[97 98 99])
51−"abc"
52−```
53−
5439```
5540~zod:dojo> ;;(tape ~[97 98 99])
5641"abc"
@@ -65,11 +50,6 @@ Succeeds because the mold normalizes:
6550
6651Fails because not a fixpoint:
6752
68−```
69−~zod:dojo> :fry(tape [50 51 52])
70−! exit
71−```
72−
7353```
7454~zod:dojo> ;;(tape [50 51 52])
7555! exit
docs/hoon/twig/sem-make/sig-dip.md → docs/hoon/rune/sem/sig.mdrenamed+16−14
@@ -1,11 +1,13 @@
11---
22navhome: /docs/
3+next: true
34sort: 2
5+title: ;~ "semsig"
46---
57
6−# `:dip ;~ "semsig"`
8+# `;~ "semsig"`
79
8−`{$dip p/seed q/(list seed)}`: glue a pipeline together with a
10+`[%smsg p=hoon q=(list hoon)]`: glue a pipeline together with a
911product-sample adapter.
1012
1113## Produces
@@ -22,14 +24,14 @@ transforms a `q` product and a `q` gate into a `q` sample.
2224`;~(a b c)` expands to
2325
2426```
25−|= arg/*
27+|= arg=*
2628(a (b arg) c(+6 arg))
2729```
2830
2931`;~(a b c d)` expands to
3032
3133```
32−|= arg/*
34+|= arg=*
3335%+ a (b arg)
3436=+ arg=arg
3537|. (a (c arg) d(+6 arg))
@@ -49,12 +51,12 @@ transforms a `q` product and a `q` gate into a `q` sample.
4951
5052## Discussion
5153
52−Apparently `:dip` is a "Kleisli arrow." Whatevs. It's also
54+Apparently `;~` ("semsig") is a "Kleisli arrow." Whatevs. It's also
5355a close cousin of the infamous "monad." Don't let that bother
5456you either. Hoon doesn't know anything about category theory,
5557so you don't need to either.
5658
57−`:dip` is often used in parsers, but is not only for parsers.
59+`;~` is often used in parsers, but is not only for parsers.
5860
5961This can be thought of as user-defined function composition; instead of simply
6062nesting the gates in `q`, each is passed individually to `p` with the product
@@ -71,7 +73,7 @@ A simple "parser." `trip` converts a `cord` (atomic string) to
7173a `tape` (linked string).
7274
7375```
74−~zod:dojo> =cmp |=({a/tape b/$-(char tape)} `tape`?~(a ~ (weld (b i.a) t.a)))
76+~zod:dojo> =cmp |=([a=tape b=$-(char tape)] `tape`?~(a ~ (weld (b i.a) t.a)))
7577~zod:dojo> ;~(cmp trip)
7678<1.zje {a/@ <409.yxa 110.lxv 1.ztu $151>}>
7779~zod:dojo> (;~(cmp trip) 'a')
@@ -81,23 +83,23 @@ a `tape` (linked string).
8183With just one gate in the pipeline `q`, the glue `p` is unused:
8284
8385```
84−~zod:dojo> (;~(cmp trip |=(a/@ ~[a a])) 'a')
86+~zod:dojo> (;~(cmp trip |=(a=@ ~[a a])) 'a')
8587"aa"
86−~zod:dojo> (;~(cmp trip |=(a/@ ~[a a])) '')
88+~zod:dojo> (;~(cmp trip |=(a=@ ~[a a])) '')
8789""
8890```
8991
9092But for multiple gates, we need it to connect the pipeline:
9193
9294```
93−~zod:dojo> (;~(cmp trip ;~(cmp |=(a/@ ~[a a]) |=(a/@ <(dec a)>))) 'b')
95+~zod:dojo> (;~(cmp trip ;~(cmp |=(a=@ ~[a a]) |=(a=@ <(dec a)>))) 'b')
9496"97b"
95−~zod:dojo> (;~(cmp trip |=(a/@ ~[a a]) |=(a/@ <(dec a)>)) 'b')
97+~zod:dojo> (;~(cmp trip |=(a=@ ~[a a]) |=(a=@ <(dec a)>)) 'b')
9698"97b"
97−~zod:dojo> (;~(cmp trip |=(a/@ ~[a a]) |=(a/@ <(dec a)>)) '')
99+~zod:dojo> (;~(cmp trip |=(a=@ ~[a a]) |=(a=@ <(dec a)>)) '')
98100""
99−~zod:dojo> (;~(cmp trip |=(a/@ ~[a a]) |=(a/@ <(dec a)>)) 'a')
101+~zod:dojo> (;~(cmp trip |=(a=@ ~[a a]) |=(a=@ <(dec a)>)) 'a')
100102"96a"
101−~zod:dojo> (;~(cmp trip |=(a/@ ~[a a]) |=(a/@ <(dec a)>)) 'acd')
103+~zod:dojo> (;~(cmp trip |=(a=@ ~[a a]) |=(a=@ <(dec a)>)) 'acd')
102104"96acd"
103105```
docs/hoon/twig/sig-hint.md → docs/hoon/rune/sig.mdrenamed+4−3
@@ -1,10 +1,11 @@
11---
22navhome: /docs/
3−sort: 12
4−
3+next: true
4+sort: 16
5+title: Hint ~ ("sig")
56---
67
7−# Hints, `~` ("sig")
8+# Hint `~` ("sig")
89
910Twigs that use Nock `10` to pass non-semantic info to the
1011interpreter.
docs/hoon/twig/sig-hint/bar-show.md → docs/hoon/rune/sig/bar.mdrenamed+8−7
@@ -1,11 +1,13 @@
11---
22navhome: /docs/
3−sort: 2
3+next: true
4+sort: 4
5+title: ~| "sigbar"
46---
57
6−# `:show ~| "sigbar"`
8+# `~| "sigbar"`
79
8−`{$show p/seed q/seed}`: tracing printf.
10+`[%sgbr p=hoon q=hoon]`: tracing printf.
911
1012## Expands to
1113
@@ -22,13 +24,12 @@ Regular: *2-fixed*.
2224## Examples
2325
2426```
25−~zod:dojo> :show('sample error message' !!)
27+~zod:dojo> ~|('sample error message' !!)
2628'sample error message'
2729ford: build failed
28−```
2930
30−```
31−~zod:dojo> ~|('sample error message' !!)
31+~zod:dojo> ~| 'sample error message'
32+ !!
3233'sample error message'
3334ford: build failed
3435```
docs/hoon/twig/sig-hint/buc-poll.md → docs/hoon/rune/sig/buc.mdrenamed+5−8
@@ -1,11 +1,13 @@
11---
22navhome: /docs/
3−sort: 12
3+next: true
4+sort: 8
5+title: ~$ "sigbuc"
46---
57
6−# `:poll ~$ "sigbuc"`
8+# `~$ "sigbuc"`
79
8−`{$poll p/term q/seed}`: profiling hit counter.
10+`[%sgbc p=term q=hoon]`: profiling hit counter.
911
1012## Expands to
1113
@@ -21,11 +23,6 @@ Regular: *2-fixed*.
2123
2224## Examples
2325
24−```
25−~zod:dojo> :poll(%foo 3)
26−3
27−```
28−
2926```
3027~zod:dojo> ~$(%foo 3)
31283
docs/hoon/twig/sig-hint/cab-lurk.md → docs/hoon/rune/sig/cab.mdrenamed+8−7
@@ -1,11 +1,13 @@
11---
22navhome: /docs/
3−sort: 3
3+next: true
4+sort: 5
5+title: ~_ "sigcab"
46---
57
6−# `:lurk ~_ "sigcab"`
8+# `~_ "sigcab"`
79
8−`{$lurk p/seed q/seed}`: user-formatted tracing printf.
10+`[%sgcb p=hoon q=hoon]`: user-formatted tracing printf.
911
1012## Expands to
1113
@@ -22,13 +24,12 @@ Shows `p` in stacktrace if `q` crashes.
2224## Examples
2325
2426```
25−~zod:dojo> :lurk([%leaf "sample error message"] !!)
27+~zod:dojo> ~_([%leaf "sample error message"] !!)
2628"sample error message"
2729ford: build failed
28−```
2930
30−```
31−~zod:dojo> ~_([%leaf "sample error message"] !!)
31+~zod:dojo> ~_ [%leaf "sample error message"]
32+ !!
3233"sample error message"
3334ford: build failed
3435```
docs/hoon/twig/sig-hint/cen-fast.md → docs/hoon/rune/sig/cen.mdrenamed+8−6
@@ -1,11 +1,13 @@
11---
22navhome: /docs/
3+next: true
34sort: 10
5+title: ~% "sigcen"
46---
57
6−# `:fast ~% "sigcen"`
8+# `~% "sigcen"`
79
8−`{$fast p/term q/wing r/(list {term seed}) s/seed}`: jet registration.
10+`[%sgcn p=term q=wing r=(list [term hoon]) s=hoon]`: jet registration.
911
1012## Expands to
1113
@@ -23,7 +25,7 @@ between opening and closing `==`.
2325
2426## Discussion
2527
26−`:fast` is for registering cores. A registered core declares its
28+`~%` ("sigcen" is for registering cores. A registered core declares its
2729formal identity to the interpreter, which may or may not be able
2830to recognize and/or accelerate it.
2931
@@ -48,7 +50,7 @@ general-purpose hotspot optimizer or "JIT"; or (c) merely a
4850hotspot declaration for profiling.
4951
5052As always with hints, the programmer has no idea which of (a),
51−(b), and (c) will be applied. She should use `:fast`
53+(b), and (c) will be applied. She should use `~%`
5254indiscriminately on all hotspots, bottlenecks, etc, real or
5355suspected.
5456
@@ -80,12 +82,12 @@ Here's the AES
8082 |%
8183 ++ en :: ECB enc
8284 ~/ %en
83− |= {a/@I b/@H} ^- @uxH
85+ |= [a=@I b=@H] ^- @uxH
8486 =+ ahem
8587 (be & (ex a) b)
8688 ++ de :: ECB dec
8789 ~/ %de
88− |= {a/@I b/@H} ^- @uxH
90+ |= [a=@I b=@H] ^- @uxH
8991 =+ ahem
9092 (be | (ix (ex a)) b)
9193 --
docs/hoon/twig/sig-hint/fas-funk.md → docs/hoon/rune/sig/fas.mdrenamed+6−8
@@ -1,19 +1,17 @@
11---
22navhome: /docs/
3−sort: 11
3+next: true
4+sort: 9
5+title: ~/ "sigfas"
46---
57
6−# `:funk ~/ "sigfas"`
8+# `~/ "sigfas"`
79
8−`{$funk p/term q/seed}`: jet registration for gate with
10+`[%sgfs p=term q=hoon]`: jet registration for gate with
911registered context.
1012
1113## Expands to
1214
13−```
14−:fast(p +7 ~ q)
15−```
16−
1715```
1816~%(p +7 ~ q)
1917```
@@ -28,7 +26,7 @@ From the kernel:
2826```
2927++ add
3028 ~/ %add
31− |= {a/@ b/@}
29+ |= [a=@ b=@]
3230 ^- @
3331 ?: =(0 a) b
3432 $(a (dec a), b +(b))
docs/hoon/rune/sig/gal.mdnew file+34
@@ -0,0 +1,34 @@
1+---
2+navhome: /docs/
3+sort: 12
4+title: ~< "siggal"
5+---
6+
7+# `~< "siggal"`
8+
9+`[%sggl p=$@(term [p=term q=hoon]) q=hoon]`: raw hint, applied to
10+product.
11+
12+## Expands to
13+
14+`q`.
15+
16+## Syntax
17+
18+Regular: *2-fixed*. For the dynamic form, write `%term.hoon`.
19+
20+## Discussion
21+
22+`~<` ("siggal") is only used for jet hints ([`~/` ("sigfas")](../fas/)
23+and [`~%` ("sigcen")](../cen/)) at the moment; we are not telling the
24+interpreter something about the computation we're about to perform, but
25+rather about its product.
26+
27+## Examples
28+
29+```
30+~zod:dojo> (make '~<(%a 42)')
31+[%7 p=[%1 p=42] q=[%10 p=97 q=[%0 p=1]]]
32+~zod:dojo> (make '~<(%a.+(.) 42)')
33+[%7 p=[%1 p=42] q=[%10 p=[p=97 q=[%4 p=[%0 p=1]]] q=[%0 p=1]]]
34+```
docs/hoon/twig/sig-hint/gar-hint.md → docs/hoon/rune/sig/gar.mdrenamed+7−16
@@ -1,11 +1,13 @@
11---
22navhome: /docs/
3−sort: 5
3+next: true
4+sort: 11
5+title: ~> "siggar"
46---
57
6−# `:hint ~> "siggar"`
8+# `~> "siggar"`
79
8−`{$hint p/$@(term {p/term q/seed}) q/seed}`: raw hint, applied
10+`[%sggr p=$@(term [p=term q=hoon]) q=hoon]`: raw hint, applied
911to computation.
1012
1113## Expands to
@@ -14,7 +16,7 @@ to computation.
1416
1517## Syntax
1618
17−Regular: *2-fixed*. For the dynamic form, write `%term.twig`.
19+Regular: *2-fixed*. For the dynamic form, write `%term.hoon`.
1820
1921## Discussion
2022
@@ -23,11 +25,6 @@ Hints are all conventions at the interpreter level.
2325
2426## Examples
2527
26−```
27−~zod:dojo> :hint(%a 42)
28−42
29−```
30−
3128```
3229~zod:dojo> ~>(%a 42)
333042
@@ -35,16 +32,10 @@ Hints are all conventions at the interpreter level.
3532
3633Running the compiler:
3734
38−```
39−~zod:dojo> (make ':hint(%a 42)')
40−[%10 p=97 q=[%1 p=42]]
41−~zod:dojo> (make ':hint(%a.+(2) 42)')
42−[%10 p=[p=97 q=[%4 p=[%1 p=2]]] q=[%1 p=42]]
43−```
44−
4535```
4636~zod:dojo> (make '~>(%a 42)')
4737[%10 p=97 q=[%1 p=42]]
38+
4839~zod:dojo> (make '~>(%a.+(2) 42)')
4940[%10 p=[p=97 q=[%4 p=[%1 p=2]]] q=[%1 p=42]]
5041```
docs/hoon/twig/sig-hint/lus-memo.md → docs/hoon/rune/sig/lus.mdrenamed+8−6
@@ -1,11 +1,13 @@
11---
22navhome: /docs/
3−sort: 7
3+next: true
4+sort: 6
5+title: ~+ "siglus"
46---
57
6−# `:memo ~+ "siglus"`
8+# `~+ "siglus"`
79
8−`{$memo p/seed}`: cache a computation.
10+`[%sgls p=hoon]`: cache a computation.
911
1012## Expands to
1113
@@ -25,20 +27,20 @@ Regular: *1-fixed*.
2527This may pause for a second:
2628
2729```
28−~zod:dojo> %.(25 |=(a/@ ?:((lth a 2) 1 (add $(a (sub a 2)) $(a (dec a))))))
30+~zod:dojo> %.(25 |=(a=@ ?:((lth a 2) 1 (add $(a (sub a 2)) $(a (dec a))))))
2931121.393
3032```
3133
3234This may make you want to press `ctrl-c`:
3335
3436```
35−~zod:dojo> %.(30 |=(a/@ ?:((lth a 2) 1 (add $(a (sub a 2)) $(a (dec a))))))
37+~zod:dojo> %.(30 |=(a=@ ?:((lth a 2) 1 (add $(a (sub a 2)) $(a (dec a))))))
36381.346.269
3739```
3840
3941This should work fine:
4042
4143```
42−~zod:dojo> %.(100 |=(a/@ ~+(?:((lth a 2) 1 (add $(a (sub a 2)) $(a (dec a)))))))
44+~zod:dojo> %.(100 |=(a=@ ~+(?:((lth a 2) 1 (add $(a (sub a 2)) $(a (dec a)))))))
4345573.147.844.013.817.084.101
4446```
docs/hoon/twig/sig-hint/pam-dump.md → docs/hoon/rune/sig/pam.mdrenamed+7−6
@@ -1,11 +1,13 @@
11---
22navhome: /docs/
3+next: true
34sort: 1
5+title: ~& "sigpam"
46---
57
6−# `:dump ~& "sigpam"`
8+# `~& "sigpam"`
79
8−`{$dump p/seed q/seed}`: debugging printf.
10+`[%sgpm p=hoon q=hoon]`: debugging printf.
911
1012## Expands to
1113
@@ -22,13 +24,12 @@ Regular: *2-fixed*.
2224## Examples
2325
2426```
25−~zod:dojo> :dump('halp' ~)
27+~zod:dojo> ~&('halp' ~)
2628'halp'
2729~
28−```
2930
30−```
31−~zod:dojo> ~&('halp' ~)
31+~zod:dojo> ~& 'halp'
32+ ~
3233'halp'
3334~
3435```
docs/hoon/twig/sig-hint/tis-ddup.md → docs/hoon/rune/sig/tis.mdrenamed+8−6
@@ -1,11 +1,13 @@
11---
22navhome: /docs/
3−sort: 8
3+next: true
4+sort: 7
5+title: ~= "sigtis"
46---
57
6−# `:ddup ~= "sigtis"`
8+# `~= "sigtis"`
79
8−`{$ddup p/seed q/seed}`: detect duplicate.
10+`[%sgts p=hoon q=hoon]`: detect duplicate.
911
1012## Expands to
1113
@@ -18,7 +20,7 @@ If `p` equals `q`, produce `p` instead of `q`.
1820## Discussion
1921
2022Duplicates are especially bad news in Hoon, because comparing them
21−takes O(n) time. Use `~=` to kill them as they breed.
23+takes O(n) time. Use `~=` ("sigtis") to kill them as they breed.
2224
2325## Examples
2426
@@ -26,8 +28,8 @@ This code traverses a tree and replaces all instances of `42` with
2628`420`:
2729
2830```
29−~zod:dojo> =foo |= a/(tree)
30− ?~(a ~ ~=(a [?:(=(n.a 42) 420 n.a) $(a l.a) $(a r.a)]))
31+~zod:dojo> =foo |= a=(tree)
32+ ?~(a ~ ~=(a [?:(=(n.a 42) 420 n.a) $(a l.a) $(a r.a)]))
3133~zod:dojo> (foo 42 ~ ~)
3234[420 ~ ~]
3335```
docs/hoon/twig/sig-hint/wut-warn.md → docs/hoon/rune/sig/wut.mdrenamed+15−9
@@ -1,11 +1,13 @@
11---
22navhome: /docs/
3−sort: 4
3+next: true
4+sort: 2
5+title: ~? "sigwut"
46---
57
6−# `:warn ~? "sigwut"`
8+# `~? "sigwut"`
79
8−`{$warn p/seed q/seed r/seed}`: conditional debug printf.
10+`[%sgwt p=hoon q=hoon r=hoon]`: conditional debug printf.
911
1012## Expands to
1113
@@ -22,17 +24,21 @@ Regular: *4-fixed*.
2224## Examples
2325
2426```
25−~zod:dojo> :warn((gth 1 2) 'oops' ~)
27+~zod:dojo> ~?((gth 1 2) 'oops' ~)
2628~
27−~zod:dojo> :warn((gth 1 0) 'oops' ~)
29+
30+~zod:dojo> ~?((gth 1 0) 'oops' ~)
2831'oops'
2932~
30−```
3133
32−```
33−~zod:dojo> ~?((gth 1 2) 'oops' ~)
34+~zod:dojo> ~? (gth 1 2)
35+ 'oops'
36+ ~
3437~
35−~zod:dojo> ~?((gth 1 0) 'oops' ~)
38+
39+~zod:dojo> ~? (gth 1 0)
40+ 'oops'
41+ ~
3642'oops'
3743~
3844```
docs/hoon/rune/sig/zap.mdnew file+38
@@ -0,0 +1,38 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 3
5+title: ~! "sigzap"
6+---
7+
8+# `~! "sigzap"`
9+
10+`[%sgzp p=hoon q=hoon]`: print type on compilation fail.
11+
12+## Expands to
13+
14+`q`.
15+
16+## Convention
17+
18+If compilation of `q` fails, prints the type of `p` in the trace.
19+
20+## Syntax
21+
22+Regular: *2-fixed*.
23+
24+## Examples
25+
26+```
27+~zod:dojo> a
28+! -find.a
29+
30+~zod:dojo> ~!('foo' a)
31+! @t
32+! find.a
33+
34+~zod:dojo> ~! 'foo'
35+ a
36+! @t
37+! find.a
38+```
docs/hoon/rune/tis.mdnew file+35
@@ -0,0 +1,35 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 13
5+title: Flow = ("tis")
6+---
7+
8+# Flow `=` ("tis")
9+
10+Flow hoons change the subject. (Or more precisely, a flow hoon
11+compiles at least one of its subhoons with a different subject.)
12+All non-flow hoons (except cores) pass the subject down unchanged.
13+
14+## Overview
15+
16+The simplest way to change the subject is to compose two hoons,
17+`p` and `q`. Let `x` be `(mint subject p)`, with product type
18+`p.x` and nock formula `q.x`. Let `y` be `(mint p.x q)`. Then
19+their composition is `[p.y [7 q.x q.y]]`.
20+
21+This composition is the `=>` ("tisgar") rune. A close relative is
22+`=+` ("tislus"), which is `=>` over `[p .]`. The new subject is a
23+cell of `p` and the old subject. `=+` is the simplest Hoon equivalent of
24+"declaring a variable" (introducing new data into the subject).
25+
26+Another way to change the subject is to mutate it. With the
27+`=.` ("tisdot") rune, given a wing that resolves to a leg, we can write
28+instead of reading, *installing* a new value at that leg. Of
29+course, we are creating a copy, not modifying the original.
30+
31+There are many flow stems, all small variations on these three.
32+
33+## Twigs
34+
35+<list dataPreview="true" className="runes"></list>
docs/hoon/rune/tis/bar.mdnew file+36
@@ -0,0 +1,36 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 8
5+title: =| "tisbar"
6+---
7+
8+# `=| "tisbar"`
9+
10+`[%tsbr p=model q=value]`: combine a defaulted mold with the subject.
11+
12+## Expands to
13+
14+```
15+=+(*p q)
16+```
17+
18+## Syntax
19+
20+Regular: *2-fixed*.
21+
22+## Discussion
23+
24+`=|` "declares a variable" which is "uninitialized," presumably
25+because you'll set it in a loop or similar.
26+
27+## Examples
28+
29+```
30+~zod:dojo> =foo |= a=@
31+ =| b=@
32+ =- :(add a b c)
33+ c=2
34+~zod:dojo> (foo 5)
35+7
36+```
docs/hoon/rune/tis/col.mdnew file+31
@@ -0,0 +1,31 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 11
5+title: =: "tiscol"
6+---
7+
8+# `=: "tiscol"`
9+
10+`[%tscl p=(list (pair wing hoon)) q=hoon]`: change multiple legs in the subject.
11+
12+## Expands to
13+
14+```
15+=>(%_(. p) q)
16+```
17+
18+## Syntax
19+
20+Regular: *jogging*, then *1-fixed*.
21+
22+## Examples
23+
24+```
25+~zod:dojo> =+ a=[b=1 c=2]
26+ =: c.a 4
27+ b.a 3
28+ ==
29+ a
30+[b=3 c=4]
31+```
docs/hoon/twig/tis-flow/dot-set.md → docs/hoon/rune/tis/dot.mdrenamed+7−18
@@ -1,18 +1,16 @@
11---
22navhome: /docs/
3−sort: 8
3+next: true
4+sort: 10
5+title: =. "tisdot"
46---
57
6−# `:set =. "tisdot"`
8+# `=. "tisdot"`
79
8−`{$set p/wing q/seed r/seed}`: change one leg in the subject.
10+`[%tsdt p=wing q=hoon r=hoon]`: change one leg in the subject.
911
1012## Expands to
1113
12−```
13−:per(:keep(. p q) r)
14−```
15−
1614```
1715=>(%_(. p q) r)
1816```
@@ -25,25 +23,16 @@ Regular: *3-fixed*.
2523
2624As usual, we are not actually mutating the subject, just creating
2725a new subject with a changed value. Note that the mutation uses
28−`:keep` (`%_`), so the type doesn't change.
26+[`%_` ("cencab")](../../cen/cab/), so the type doesn't change.
2927
3028## Examples
3129
32−```
33−~zod:dojo> :pin a=[b=1 c=2]
34− :set b.a 3
35− a
36−[b=3 c=2]
37−~zod:dojo> :pin a=[b=1 c=2]
38− :set(b.a 3 a)
39−[b=3 c=2]
40−```
41−
4230```
4331~zod:dojo> =+ a=[b=1 c=2]
4432 =. b.a 3
4533 a
4634[b=3 c=2]
35+
4736~zod:dojo> =+ a=[b=1 c=2]
4837 =.(b.a 3 a)
4938[b=3 c=2]
docs/hoon/twig/tis-flow/fas-var.md → docs/hoon/rune/tis/fas.mdrenamed+7−30
@@ -1,45 +1,31 @@
11---
22navhome: /docs/
3+next: true
34sort: 6
5+title: =/ "tisfas"
46---
57
6−# `:var =/ "tisfas"`
8+# `=/ "tisfas"`
79
8−`{$var p/taco q/seed r/seed}`: combine a named and/or typed
10+`[%tsfs p=taco q=hoon r=hoon]`: combine a named and/or typed
911noun with the subject.
1012
1113## Expands to
1214
1315*if `p` is a symbol*:
1416
15−```
16−:pin(:name(p q) r)
17−```
18−
1917```
2018=+(^=(p q) r)
2119```
2220
2321*if `p` is a symbol with a mold*:
2422
25−```
26−:pin(:cast(p q) r)
27−```
28−
2923```
3024=+(^-(p q) r)
3125```
3226
3327### Compiler macro
3428
35−```
36−:ifat p
37− :pin :name(p q)
38− r
39−:pin :cast(:coat(p.p q.p) q)
40−r
41−```
42−
4329```
4430?@ p
4531 =+ p=q
@@ -55,24 +41,15 @@ Regular: *3-fixed*.
5541## Discussion
5642
5743`p` can be either a symbol or a symbol/mold. If it's just a symbol,
58−`:var` "declares a type-inferred variable." If it has a mold, `:var`
44+`=/` ("tisfas") "declares a type-inferred variable." If it has a mold, `=/`
5945"declares a type-checked variable."
6046
6147## Examples
6248
6349```
64−~zod:dojo> =foo :gate a/@
65− :var b 1
66− :var c/@ 2
67− :(add a b c)
68−~zod:dojo> (foo 5)
69−8
70−```
71−
72−```
73−~zod:dojo> =foo |= a/@
50+~zod:dojo> =foo |= a=@
7451 =/ b 1
75− =/ c/@ 2
52+ =/ c=@ 2
7653 :(add a b c)
7754~zod:dojo> (foo 5)
78558
docs/hoon/rune/tis/gal.mdnew file+39
@@ -0,0 +1,39 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 2
5+title: =< "tisgal"
6+---
7+
8+# `=< "tisgal"`
9+
10+`[%tsgl p=hoon q=hoon]`: compose two hoons, inverted.
11+
12+## Expands to
13+
14+```
15+=>(q p)
16+```
17+
18+## Syntax
19+
20+Regular: *2-fixed*.
21+
22+Irregular: `foo:bar` is `=<(foo bar)`.
23+
24+## Examples
25+
26+```
27+~zod:dojo> =<(b [a=1 b=2 c=3])
28+2
29+
30+~zod:dojo> =< b
31+ [a=1 b=2 c=3]
32+2
33+
34+~zod:dojo> b:[a=1 b=2 c=3]
35+2
36+
37+~zod:dojo> [. .]:(add 2 4)
38+[6 6]
39+```
docs/hoon/twig/tis-flow/gar-per.md → docs/hoon/rune/tis/gar.mdrenamed+4−9
@@ -1,11 +1,13 @@
11---
22navhome: /docs/
3+next: true
34sort: 1
5+title: => "tisgar"
46---
57
6−# `:per => "tisgar"`
8+# `=> "tisgar"`
79
8−`{$per p/seed q/seed}`: compose two twigs.
10+`[%tsgr p=hoon q=hoon]`: compose two hoons.
911
1012## Produces
1113
@@ -17,13 +19,6 @@ Regular: *2-fixed*.
1719
1820## Examples
1921
20−```
21−~zod:dojo> :per([a=1 b=2 c=3] b)
22−2
23−~zod:dojo> :per((add 2 4) [. .])
24−[6 6]
25−```
26−
2722```
2823~zod:dojo> =>([a=1 b=2 c=3] b)
29242
docs/hoon/rune/tis/hep.mdnew file+36
@@ -0,0 +1,36 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 5
5+title: =- "tishep"
6+---
7+
8+# `=- "tishep"`
9+
10+`[%tshp p=hoon q=hoon]`: combine a new noun with the subject, inverted.
11+
12+## Expands to
13+
14+```
15+=>([q .] p)
16+```
17+
18+## Syntax
19+
20+Regular: *2-fixed*.
21+
22+## Discussion
23+
24+`=-` looks better than `=+` when the hoon you're pinning
25+is much smaller than the hoon that uses it.
26+
27+## Examples
28+
29+```
30+~zod:dojo> =foo |= a=@
31+ =+ b=1
32+ =- (add a b c)
33+ c=2
34+~zod:dojo> (foo 5)
35+8
36+```
docs/hoon/twig/tis-flow/ket-sip.md → docs/hoon/rune/tis/ket.mdrenamed+6−17
@@ -1,19 +1,16 @@
11---
22navhome: /docs/
3−sort: 10
3+sort: 12
4+title: =^ "tisket"
45---
56
6−# `:sip =^ "tisket"`
7+# `=^ "tisket"`
78
8−`{$sip p/taco q/wing r/seed s/seed}`: pin the head of a pair; change
9+`[%tskt p=taco q=wing r=hoon s=hoon]`: pin the head of a pair; change
910a leg with the tail.
1011
1112## Expands to
1213
13−```
14−:var(p -.r :set(q +.r s))
15−```
16−
1714```
1815=/(p -.r =.(q +.r s))
1916```
@@ -24,7 +21,7 @@ Regular: *4-fixed*.
2421
2522## Discussion
2623
27−We use `:sip` when we have a state machine with a function that
24+We use `=^` ("tisket" when we have a state machine with a function that
2825produces a cell, whose head is a result and whose tail is a new
2926state. We want to use the head as a new variable, and stuff the
3027tail back into wherever we stored the old state.
@@ -35,15 +32,7 @@ This may also remind you of Haskell's State monad.
3532
3633The `og` core is a stateful pseudo-random number generator.
3734We have to change the core state every time we generate a
38−random number, so we need to `:sip`:
39−
40−```
41−~zod:dojo> :pin rng=~(. og 420)
42− :sip r1 rng (rads:rng 100)
43− :sip r2 rng (rads:rng 100)
44− [r1 r2]
45−[99 46]
46−```
35+random number, so we use `=^`:
4736
4837```
4938~zod:dojo> =+ rng=~(. og 420)
docs/hoon/rune/tis/lus.mdnew file+35
@@ -0,0 +1,35 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 4
5+title: =+ "tislus"
6+---
7+
8+# `=+ "tislus"`
9+
10+`[%tsls p=hoon q=hoon]`: combine a new noun with the subject.
11+
12+## Expands to
13+
14+```
15+=>([p .] q)
16+```
17+
18+## Syntax
19+
20+Regular: *2-fixed*.
21+
22+## Discussion
23+
24+`=+` ("tislus") is the simplest way of "declaring a variable."
25+
26+## Examples
27+
28+```
29+~zod:dojo> =foo |= a=@
30+ =+ b=1
31+ =+ c=2
32+ :(add a b c)
33+~zod:dojo> (foo 5)
34+8
35+```
docs/hoon/rune/tis/sem.mdnew file+32
@@ -0,0 +1,32 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 7
5+title: =; "tissem"
6+---
7+
8+# `=; "tissem"`
9+
10+`[%tssm p=taco q=hoon r=hoon]`: combine a named and/or typed noun with the
11+subject, inverted.
12+
13+## Expands to
14+
15+```
16+=/(p r q)
17+```
18+
19+## Syntax
20+
21+Regular: *3-fixed*.
22+
23+## Examples
24+
25+```
26+~zod:dojo> =foo |= a=@
27+ =/ b 1
28+ =; c=@ :(add a b c)
29+ 2
30+~zod:dojo> (foo 5)
31+8
32+```
docs/hoon/rune/tis/sig.mdnew file+36
@@ -0,0 +1,36 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 3
5+title: =~ "tissig"
6+---
7+
8+# `=~ "tissig"`
9+
10+`[%tssg p=(list hoon)]`: compose many hoons.
11+
12+## Produces
13+
14+The product of the chain composition.
15+
16+## Syntax
17+
18+Regular: *running*.
19+
20+## Examples
21+
22+```
23+~zod:dojo> =foo =| n=@
24+ =< =~ increment
25+ increment
26+ increment
27+ n
28+ ==
29+ |%
30+ ++ increment
31+ |-
32+ ..increment(n +(n))
33+ --
34+~zod:dojo> foo
35+3
36+```
docs/hoon/twig/tis-flow/tar-aka.md → docs/hoon/rune/tis/tar.mdrenamed+7−18
@@ -1,11 +1,13 @@
11---
22navhome: /docs/
3−sort: 11
3+next: true
4+sort: 9
5+title: =* "tistar"
46---
57
6−# `:aka =* "tistar"`
8+# `=* "tistar"`
79
8−`{$aka p/term q/seed r/seed}`: define an alias.
10+`[%tstr p=term q=hoon r=hoon]`: define an alias.
911
1012## Produces
1113
@@ -18,31 +20,18 @@ Regular: *3-fixed*.
1820## Discussion
1921
2022The difference between aliasing and pinning is that the subject
21−noun stays the same; the alias is just recorded in its span.
23+noun stays the same; the alias is just recorded in its type.
2224`q` is calculated every time you use the `p` alias, of course.
2325
2426## Examples
2527
26−```
27−~zod:dojo>
28− :pin a=1
29− :aka b a
30− [a b]
31−[1 1]
32−~zod:dojo>
33− :pin a=1
34− :aka b a
35− :set a 2
36− [a b]
37−[2 2]
38−```
39−
4028```
4129~zod:dojo>
4230 =+ a=1
4331 =* b a
4432 [a b]
4533[1 1]
34+
4635~zod:dojo>
4736 =+ a=1
4837 =* b a
docs/hoon/rune/wut.mdnew file+35
@@ -0,0 +1,35 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 14
5+title: Test ? ("wut")
6+---
7+
8+# Test `?` ("wut")
9+
10+Hoon has the usual branches and logical tests. For pattern
11+matching, it also has a [`?=` ("wuttis")](./tis/) rune that tests whether a value
12+matches the icon of a mold. And it has branch inference,
13+learning from `?=` tests in the condition of [`?:` ("wutcol")](./col/) hoons.
14+
15+## Overview
16+
17+All `?` runes expand to `?:` and/or `?=`.
18+
19+If the condition of an `?:` is a `?=`, *and* the `?=` is
20+testing a leg of the subject, the compiler specializes the subject
21+type for the branches of the `?:`. Branch inference also works
22+for expressions which expand to `?:`.
23+
24+The test does not have to be a single `?=`; the compiler can
25+analyze arbitrary boolean logic ([`?&` ("wutpam")](./pam/),
26+[`?|` ("wutbar")](./bar/), [`?!` ("wutzap")](./zap/)) with full
27+short-circuiting. Equality tests ([`.=` ("dottis")](../dot/tis/)) are *not*
28+analyzed.
29+
30+If the compiler detects that the branch is degenerate (only one
31+side is taken), it fails with an error.
32+
33+## Twigs
34+
35+<list dataPreview="true" className="runes"></list>
docs/hoon/rune/wut/bar.mdnew file+45
@@ -0,0 +1,45 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 6
5+title: ?| "wutbar"
6+---
7+
8+# `?| "wutbar"`
9+
10+`[%wtbr p=(list hoon)]`: logical or.
11+
12+## Expands to
13+
14+*Pseudocode*: `a`, `b`, `c`, ... as elements of `p`:
15+
16+```
17+?:(a & ?:(b & ?:(c & ?:(... ?:(z & |)))))
18+```
19+
20+### Compiler macro
21+
22+```
23+|-
24+?~ p
25+ |
26+?: i.p
27+ &
28+$(p t.p)
29+```
30+
31+## Syntax
32+
33+Regular: *running*.
34+
35+Irregular: `|(foo bar baz)` is `?|(foo bar baz)`.
36+
37+## Examples
38+
39+```
40+~zod:dojo> |(=(6 42) =(42 42))
41+%.y
42+
43+~zod:dojo> |(=(6 42) =(42 43))
44+%.n
45+```
docs/hoon/twig/wut-test/col-if.md → docs/hoon/rune/wut/col.mdrenamed+23−12
@@ -1,11 +1,13 @@
11---
22navhome: /docs/
3+next: true
34sort: 1
5+title: ?: "wutcol"
46---
57
6−# `:if ?: "wutcol"`
8+# `?: "wutcol"`
79
8−`{$if p/seed q/seed r/seed}`: branch on a boolean test.
10+`[%wtcl p=hoon q=hoon r=hoon]`: branch on a boolean test.
911
1012## Produces
1113
@@ -14,13 +16,14 @@ If `p` is not a boolean, compiler yells at you.
1416
1517The subjects of `q` and `r` are constrained to match any
1618pattern-matching algebra in `p`. The analysis, which is
17−conservative, understands any combination of `:fits`
18−(`?=`), `:and` (`?&`), `:or` (`?|`), and `:not` (`?!`),
19−and reduces the subject appropriately when compiling.
19+conservative, understands any combination of [`?=` ("wuttis")](../tis/),
20+[`?&` ("wutpam")](../pam/), [`?|` ("wutbar")](../bar/), and
21+[`?!` ("wutzap")](../zap/), and reduces the subject appropriately when
22+compiling.
2023
2124If test analysis reveals that either branch is not taken,
2225or if `p` is not a boolean, compilation fails. However,
23−an untaken branch can be indicated with the `:lost` twig.
26+an untaken branch can be indicated with the `%lost` hoon.
2427
2528## Syntax
2629
@@ -30,19 +33,27 @@ Regular: *3-fixed*.
3033
3134Short-circuiting in boolean tests works as you'd expect
3235and includes the expected inference. For instance,
33−if you write `:and(a b)`, `b` is only executed if `a` is
36+if you write `?&(a b)`, `b` is only executed if `a` is
3437positive, and compiled with that assumption.
3538
36−Note also that all other branching twigs reduce to `:if`.
39+Note also that all other branching hoons reduce to `?:`.
3740
3841## Examples
3942
4043```
41−~zod:dojo> :if((gth 1 2) 3 4)
42−4
43−```
44+~zod:dojo> ?:((gth 1 0) 3 4)
45+3
46+
47+~zod:dojo> ?: (gth 1 0)
48+ 3
49+ 4
50+3
4451
45−```
4652~zod:dojo> ?:((gth 1 2) 3 4)
47534
54+
55+~zod:dojo> ?: (gth 1 2)
56+ 3
57+ 4
58+4
4859```
docs/hoon/rune/wut/dot.mdnew file+42
@@ -0,0 +1,42 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 2
5+title: ?. "wutdot"
6+---
7+
8+# `?. "wutdot"`
9+
10+`[%wtdt p=hoon q=hoon r=hoon]`: branch on a boolean test, inverted.
11+
12+## Expands to
13+
14+```
15+?:(p r q)
16+```
17+
18+## Syntax
19+
20+Regular: *3-fixed*.
21+
22+## Discussion
23+
24+As usual with inverted forms, use `?.` ("wutdot") when the positive
25+hoon of an `?:` ("wutcol") is much heavier than the negative hoon.
26+
27+## Examples
28+
29+```
30+~zod:dojo> ?.((gth 1 2) 3 4)
31+3
32+
33+~zod:dojo> ?.(?=(%a 'a') %not-a %yup)
34+%yup
35+
36+~zod:dojo> ?. %.y
37+ 'this false case is less heavy than the true case'
38+ ?: =(2 3)
39+ 'two not equal to 3'
40+ 'but see how \'r is much heavier than \'q?'
41+'but see how \'r is much heavier than \'q?'
42+```
docs/hoon/twig/wut-test/gal-deny.md → docs/hoon/rune/wut/gal.mdrenamed+8−14
@@ -1,20 +1,16 @@
11---
22navhome: /docs/
3−sort: 10
3+next: true
4+sort: 4
5+title: ?< "wutgal"
46---
57
6−# `:deny ?< "wutgal"`
8+# `?< "wutgal"`
79
8−`{$deny p/seed q/seed}`: negative assertion.
10+`[%wtgl p=hoon q=hoon]`: negative assertion.
911
1012## Expands to
1113
12−```
13−:if p
14− !!
15−q
16−```
17−
1814```
1915?:(p !! q)
2016```
@@ -25,13 +21,11 @@ Regular: *2-fixed*.
2521
2622## Examples
2723
28−```
29−~zod:dojo> :deny(=(3 4) %foo)
30−%foo
31−```
32−
3324```
3425~zod:dojo> ?<(=(3 4) %foo)
3526%foo
27+
28+~zod:dojo> ?<(=(3 3) %foo)
29+ford: build failed
3630```
3731
docs/hoon/twig/wut-test/gar-sure.md → docs/hoon/rune/wut/gar.mdrenamed+8−14
@@ -1,20 +1,16 @@
11---
22navhome: /docs/
3−sort: 11
3+next: true
4+sort: 3
5+title: ?> "wutgar"
46---
57
6−# `:sure ?> "wutgar"`
8+# `?> "wutgar"`
79
8−`{$sure p/seed q/seed}`: positive assertion.
10+`[%wtgr p=hoon q=hoon]`: positive assertion.
911
1012## Expands to
1113
12−```
13−:lest p
14− !!
15−q
16−```
17−
1814```
1915?.(p !! q)
2016```
@@ -25,12 +21,10 @@ Regular: *2-fixed*.
2521
2622## Examples
2723
28−```
29−~zod:dojo> :sure(=(3 3) %foo)
30−%foo
31−```
32−
3324```
3425~zod:dojo> ?>(=(3 3) %foo)
3526%foo
27+
28+~zod:dojo> ?>(=(3 4) %foo)
29+ford: build failed
3630```
docs/hoon/twig/wut-test/hep-case.md → docs/hoon/rune/wut/hep.mdrenamed+12−33
@@ -1,36 +1,29 @@
11---
22navhome: /docs/
3+next: true
34sort: 12
5+title: ?- "wuthep"
46---
57
6−# `:case ?- "wuthep"`
8+# `?- "wuthep"`
79
8−`{$case p/wing q/(list (pair moss seed))}`: switch against a
10+`[%wthp p=wing q=(list (pair model value))]`: switch against a
911union, with no default.
1012
1113## Expands to
1214
13−*Pseudocode*, `a`, `b`, `c`, ... as elements of `q`
15+*Pseudocode*: `a`, `b`, `c`, ... as elements of `q`:
1416
1517```
16−:if :fits(p.a) q.a
17−:if :fits(p.b) q.b
18−:if :fits(p.c) q.c
18+?: ?=(p.a) q.a
19+?: ?=(p.b) q.b
20+?: ?=(p.c) q.c
1921...
20−:show(%mint-lost !!)
22+~|(%mint-lost !!)
2123```
2224
2325### Compiler macro
2426
25−```
26−:loop
27−:ifno q
28− :show(%mint-lost !!)
29−:if :fits(p.i.q p)
30− q.i.q
31−:moar(q t.q)
32−```
33−
3427```
3528|-
3629?. q
@@ -48,8 +41,8 @@ Regular: *1-fixed*, then *jogging*.
4841
4942The compiler makes sure that your code neither misses a case of
5043the union, nor includes a double case that isn't there. This is
51−not special handling for `:case`, just a consequence of the
52−semantics of `:if`, which `:case` reduces to.
44+not special handling for `?-` ("wuthep"), just a consequence of the
45+semantics of `?:` ("wutcol"), which `?-` reduces to.
5346
5447A missing case will throw the `mint-lost` error. An extra case
5548will throw `mint-vain`. (Ecclesiastes did nothing wrong.)
@@ -57,21 +50,7 @@ will throw `mint-vain`. (Ecclesiastes did nothing wrong.)
5750## Examples
5851
5952```
60−~zod:dojo> =cor :gate vat/?($a $b)
61− :case vat
62− $a 20
63− $b 42
64− ==
65−~zod:dojo> (cor %a)
66−20
67−~zod:dojo> (cor %b)
68−42
69−~zod:dojo> (cor %c)
70−! nest-fail
71−```
72−
73−```
74−~zod:dojo> =cor |= vat/?($a $b)
53+~zod:dojo> =cor |= vat=?($a $b)
7554 ?- vat
7655 $a 20
7756 $b 42
docs/hoon/twig/wut-test/ket-ifcl.md → docs/hoon/rune/wut/ket.mdrenamed+7−19
@@ -1,21 +1,17 @@
11---
22navhome: /docs/
3−sort: 5
3+next: true
4+sort: 11
5+title: ?^ "wutket"
46---
57
6−# `:ifcl ?^ "wutket"`
8+# `?^ "wutket"`
79
8−`{$ifcl p/wing q/seed r/seed}`: branch on whether a wing
10+`[%wtkt p=wing q=hoon r=hoon]`: branch on whether a wing
911of the subject is a cell.
1012
1113## Expands to
1214
13−```
14−:if :fits(^ p)
15− q
16−r
17−```
18−
1915```
2016?:(?=(^ p) q r)
2117```
@@ -30,22 +26,14 @@ Regular form: *3-fixed*
3026
3127## Examples
3228
33−```
34−~zod:dojo> :ifcl(0 1 2)
35−! mint-vain
36−! exit
37−~zod:dojo> :ifcl(`*`0 1 2)
38−2
39−~zod:dojo> :ifcl(`*`[1 2] 3 4)
40−3
41−```
42−
4329```
4430~zod:dojo> ?^(0 1 2)
4531! mint-vain
4632! exit
33+
4734~zod:dojo> ?^(`*`0 1 2)
48352
36+
4937~zod:dojo> ?^(`*`[1 2] 3 4)
50383
5139```
docs/hoon/rune/wut/lus.mdnew file+57
@@ -0,0 +1,57 @@
1+---
2+navhome: /docs/
3+sort: 13
4+title: ?+ "wutlus"
5+---
6+
7+# `?+ "wutlus"`
8+
9+`[%wtls p=wing q=value r=(list (pair model value))]`: switch against
10+a union, with a default.
11+
12+## Expands to
13+
14+*Pseudocode*: `a`, `b`, `c`, ... as elements of `r`:
15+
16+```
17+?: ?=(p.a) q.a
18+?: ?=(p.b) q.b
19+?: ?=(p.c) q.c
20+...
21+q
22+```
23+
24+### Compiler macro
25+
26+```
27+|-
28+?. r
29+ q
30+?: ?=(p.i.r p)
31+ q.i.r
32+$(r t.r)
33+```
34+
35+## Syntax
36+
37+Regular: *2-fixed*, then *jogging*.
38+
39+## Discussion
40+
41+An extra case will throw `mint-vain`. A lost case defaults.
42+
43+## Examples
44+
45+```
46+~zod:dojo> =cor |= vat=?($a $b)
47+ ?+ vat 240
48+ $a 20
49+ $b 42
50+ ==
51+~zod:dojo> (cor %a)
52+20
53+~zod:dojo> (cor %b)
54+42
55+~zod:dojo> (cor %c)
56+240
57+```
docs/hoon/rune/wut/pam.mdnew file+45
@@ -0,0 +1,45 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 5
5+title: ?& "wutpam"
6+---
7+
8+# `?& "wutpam"`
9+
10+`[%wtpm p=(list hoon)]`: logical and.
11+
12+## Expands to
13+
14+*Pseudocode*: `a`, `b`, `c`, ... as elements of `p`:
15+
16+```
17+?.(a | ?.(b | ?.(c | ?.(... ?.(z | &)))))
18+```
19+
20+### Compiler macro
21+
22+```
23+|-
24+?~ p
25+ &
26+?. i.p
27+ |
28+$(p t.p)
29+```
30+
31+## Syntax
32+
33+Regular: *running*.
34+
35+Irregular: `&(foo bar baz)` is `?&(foo bar baz)`.
36+
37+## Examples
38+
39+```
40+~zod:dojo> &(=(6 6) =(42 42))
41+%.y
42+
43+~zod:dojo> &(=(6 7) =(42 43))
44+%.n
45+```
docs/hoon/twig/wut-test/pat-ifat.md → docs/hoon/rune/wut/pat.mdrenamed+5−19
@@ -1,21 +1,17 @@
11---
22navhome: /docs/
3−sort: 4
3+next: true
4+sort: 10
5+title: ?@ "wutpat"
46---
57
6−# `:ifat ?@ "wutpat"`
8+# `?@ "wutpat"`
79
8−`{$ifat p/wing q/seed r/seed}`: branch on whether a wing
10+`[%wtpt p=wing q=hoon r=hoon]`: branch on whether a wing
911of the subject is an atom.
1012
1113## Expands to
1214
13−```
14−:if :fits(@ p)
15− q
16−r
17−```
18−
1915```
2016?:(?=(@ p) q r)
2117```
@@ -26,16 +22,6 @@ Regular: *3-fixed*.
2622
2723## Examples
2824
29−```
30−~zod:dojo> :ifat(0 1 2)
31−! mint-vain
32−! exit
33−~zod:dojo> :ifat(`*`0 1 2)
34−1
35−~zod:dojo> :ifat(`*`[1 2] 3 4)
36−4
37−```
38−
3925```
4026~zod:dojo> ?@(0 1 2)
4127! mint-vain
docs/hoon/rune/wut/sig.mdnew file+34
@@ -0,0 +1,34 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 9
5+title: ?~ "wutsig"
6+---
7+
8+# `?~ "wutsig"`
9+
10+`[%wtsg p=wing q=hoon r=hoon]`: branch on whether a wing
11+of the subject is null.
12+
13+## Expands to
14+
15+```
16+?:(?=($~ p) q r)
17+```
18+
19+## Syntax
20+
21+Regular: *3-fixed*.
22+
23+## Discussion
24+
25+It's bad style to use `?~` to test for any zero atom. Use it
26+only for a true null, `~`.
27+
28+## Examples
29+
30+```
31+~zod:dojo> =foo ""
32+~zod:dojo> ?~(foo 1 2)
33+1
34+```
docs/hoon/twig/wut-test/tis-fits.md → docs/hoon/rune/wut/tis.mdrenamed+9−13
@@ -1,11 +1,13 @@
11---
22navhome: /docs/
3−sort: 6
3+next: true
4+sort: 8
5+title: ?= "wuttis"
46---
57
6−# `:fits ?= "wuttis"`
8+# `?= "wuttis"`
79
8−`{$fits p/moss q/wing}`: test pattern match.
10+`[%wtts p=model q=wing]`: test pattern match.
911
1012## Produces
1113
@@ -18,7 +20,7 @@ Regular: *2-fixed*.
1820
1921## Discussion
2022
21−`:fits` is not as powerful as it might seem. For instance, it
23+`?=` ("wuttis") is not as powerful as it might seem. For instance, it
2224can't generate a loop -- you cannot (and should not) use it to
2325test whether a `*` is a `(list @)`. Nor can it validate atomic
2426auras.
@@ -26,8 +28,8 @@ auras.
2628Patterns should be as weak as possible. Unpack one layer of
2729union at a time. Don't confirm things the type system knows.
2830
29−For example, when matching a book containing a page `{$foo p/@
30−q/{@ @}}`, the proper pattern is `{$foo *}`. You have one
31+For example, when matching a book containing a page `[%foo p=@
32+q=[@ @]]`, the proper pattern is `[%foo *]`. You have one
3133question, which is whether the head of the noun is `%foo`.
3234
3335A common error is `find.$`, meainng `p` is not a mold.
@@ -36,12 +38,6 @@ A common error is `find.$`, meainng `p` is not a mold.
3638
3739```
3840~zod:dojo> =bar [%foo %bar %baz]
39−~zod:dojo> :fits({$foo *} bar)
40−%.y
41−```
42−
43−```
44−~zod:dojo> =bar [%foo %bar %baz]
45−~zod:dojo> ?=({$foo *} bar)
41+~zod:dojo> ?=([%foo *] bar)
4642%.y
4743```
docs/hoon/twig/wut-test/zap-not.md → docs/hoon/rune/wut/zap.mdrenamed+7−17
@@ -1,18 +1,16 @@
11---
22navhome: /docs/
3+next: true
34sort: 7
5+title: ?: "wutzap"
46---
57
6−# `:not ?! "wutzap"`
8+# `?! "wutzap"`
79
8−`{$not p/seed}`: logical not.
10+`[%wtzp p=hoon]`: logical not.
911
1012## Expands to
1113
12−```
13−:same(%.n p)
14−```
15−
1614```
1715.=(| p)
1816```
@@ -27,24 +25,16 @@ Irregular: `!foo` is `?!(foo)`.
2725
2826## Examples
2927
30−```
31−~zod:dojo> not:(=(1 2))
32−%.y
33−~zod:dojo> :not(&)
34−%.n
35−~zod:dojo> :not(|)
36−%.y
37−~zod:dojo> :not(gth 5 6)
38−%.y
39−```
40−
4128```
4229~zod:dojo> ?!(.=(1 2))
4330%.y
31+
4432~zod:dojo> !&
4533%.n
34+
4635~zod:dojo> !|
4736%.y
37+
4838~zod:dojo> !(gth 5 6)
4939%.y
5040```
docs/hoon/twig/zap-wild.md → docs/hoon/rune/zap.mdrenamed+4−3
@@ -1,10 +1,11 @@
11---
22navhome: /docs/
3−sort: 13
4−
3+next: true
4+sort: 12
5+title: Wild ! ("zap")
56---
67
7−# Wild, `!` ("zap")
8+# Wild `!` ("zap")
89
910## Twigs
1011
docs/hoon/rune/zap/gar.mdnew file+30
@@ -0,0 +1,30 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 3
5+title: !> "zapgar"
6+---
7+
8+# `!> "zapgar"`
9+
10+`[%zpgr p=hoon]`: wrap a noun in its type.
11+
12+## Produces
13+
14+A cell whose tail is `p`, and whose head is the static type of p.
15+
16+## Syntax
17+
18+Regular: *1-fixed*.
19+
20+## Discussion
21+
22+In Hoon, dynamic type is static type compiled at runtime. This
23+type-noun cell is generally called a `vase`.
24+
25+## Examples
26+
27+```
28+~zod:dojo> !>(1)
29+[p=#t/@ud q=1]
30+```
docs/hoon/twig/zap-wild/tis-code.md → docs/hoon/rune/zap/tis.mdrenamed+5−12
@@ -1,11 +1,13 @@
11---
22navhome: /docs/
3−sort: 3
3+next: true
4+sort: 2
5+title: != "zaptis"
46---
57
6−# `:code != "zaptis"`
8+# `!= "zaptis"`
79
8−`{$code p/seed}`: make the Nock formula for a twig.
10+`[%zpts p=hoon]`: make the Nock formula for a hoon.
911
1012## Produces
1113
@@ -17,15 +19,6 @@ Regular: *1-fixed*.
1719
1820## Examples
1921
20−```
21−~zod:dojo> :code(20)
22−[1 20]
23−~zod:dojo> :code(~zod)
24−[1 0]
25−~zod:dojo> :code((add 2 2))
26−[8 [9 3.110.356 0 31] 9 2 [0 4] [7 [0 3] 1 2 2] 0 11]
27−```
28−
2922```
3023~zod:dojo> !=(20)
3124[1 20]
docs/hoon/twig/zap-wild/wut-need.md → docs/hoon/rune/zap/wut.mdrenamed+4−12
@@ -1,16 +1,17 @@
11---
22navhome: /docs/
33sort: 4
4+title: !? "zapwut"
45---
56
6−# `:need !? "zapwut"`
7+# `!? "zapwut"`
78
8−`{$need p/@ q/seed}`: restrict Hoon version.
9+`[%zpwt p=@ q=hoon]`: restrict Hoon version.
910
1011## Produces
1112
1213`q`, if `p` is greater than or equal to the Hoon kelvin version.
13−(Versions count down; the current version is 150.)
14+(Versions count down; the current version is 143.)
1415
1516## Syntax
1617
@@ -18,15 +19,6 @@ Regular: *2-fixed*.
1819
1920## Examples
2021
21−```
22−~zod:dojo> :need(264 (add 2 2))
23−4
24−~zod:dojo> :need(164 (add 2 2))
25−4
26−~zod:dojo> :need(64 (add 2 2))
27−! exit
28−```
29−
3022```
3123~zod:dojo> !?(264 (add 2 2))
32244
docs/hoon/rune/zap/zap.mdnew file+29
@@ -0,0 +1,29 @@
1+---
2+navhome: /docs/
3+next: true
4+sort: 1
5+title: !! "zapzap"
6+---
7+
8+# `!! "zapzap"`
9+
10+`[%zpzp ~]`: crash.
11+
12+## Produces
13+
14+Nothing. Always crashes, with type `%void`.
15+
16+## Syntax
17+
18+`!!`
19+
20+## Discussion
21+
22+`%void` nests in every other type, so you can stub out anything with `!!`.
23+
24+## Examples
25+
26+```
27+~zod:dojo> !!
28+ford: build failed
29+```
docs/hoon/syntax.md+3−3
@@ -1,6 +1,6 @@
11---
22navhome: /docs/
3−sort: 12
3+sort: 13
44next: true
55title: Syntax
66---
@@ -132,7 +132,7 @@ the first of which, when evaluated, becomes the *head* (i.e., the left)
132132and the second of which becomes the *tail* (i.e., the right).
133133
134134Hoon expressions are just called
135−[hoons](../about/glossary/#-twig), because a rune's subexpression can itself
135+[hoons](../about/glossary/#-a-hoon), because a rune's subexpression can itself
136136be a Hoon expression (i.e. another rune). You'll start to see this tree-like,
137137recursive structure the more you program in Hoon. You can think of one Hoon
138138file being composed of multiple hoons. The subexpressions following the
@@ -141,7 +141,7 @@ rune are sometimes called the *children* of that hoon.
141141## Tall and flat forms
142142
143143There are two kinds of Hoon expression syntax: *tall* and *flat*.
144−Most runes can be used in both tall and flat twigs. Tall hoons can
144+Most runes can be used in both tall and flat hoons. Tall hoons can
145145contain flat hoons, but not vice versa.
146146
147147The `:-` expression in the last subsection was in tall form. Here's
docs/hoon/troubleshooting.md+22−25
@@ -1,8 +1,8 @@
11---
22navhome: /docs/
3−sort: 19
4−title: Troubleshooting
53next: true
4+sort: 23
5+title: Troubleshooting
66---
77
88# Troubleshooting
@@ -24,8 +24,8 @@ a correct Hoon file. These values are always correct.
2424Usually, the line and column tell you everything you need to
2525know. But the worst-case scenario for a syntax error is that,
2626somewhere above, you've confused Hoon's tall form by using the
27−wrong fanout for a rune. For example, `%+` (`:calt`, a function
28−call whose sample is a cell) has three subtwigs:
27+wrong fanout for a rune. For example, `%+` ([*cenlus*](../rune/cen/lus),
28+a function call whose sample is a cell) has three subhoons:
2929
3030```
3131%+ foo
@@ -40,12 +40,12 @@ But if you make a mistake and write
4040bar
4141```
4242
43−the parser will eat the next twig below and try to treat it as a
43+the parser will eat the next hoon below and try to treat it as a
4444part of the `%+`. This can cause a cascading error somewhere
4545below, usually stopped by a `==` or `--`.
4646
4747When this happens, don't panic! Binary search actually works
48−quite well. Any twig can be stubbed out as `!!`. Find the
48+quite well. Any hoon can be stubbed out as `!!`. Find the
4949prefix of your file that compiles, then work forward until
5050the actual error appears.
5151
@@ -57,12 +57,12 @@ Now your code parses but doesn't compile.
5757
5858Your first step should be to put a `!:` ("zapcol") rune at the
5959top of the file. This is like calling the C compiler with `-g`;
60−it tells the Hoon compiler to generate tracing twigs.
60+it tells the Hoon compiler to generate tracing hoons.
6161
6262Bear in mind that `!:` breaks tail-call optimization. This is a
6363bug, but a relatively low-priority bug. `!.` turns off `!:`.
64−Note that `!:` and `!.` are twig-level, not file-level; you can
65−wrap any twig in either.
64+Note that `!:` and `!.` are hoon-level, not file-level; you can
65+wrap any hoon in either.
6666
6767### Error trace
6868
@@ -78,7 +78,7 @@ If you have `!:` on, you'll see an error trace, like
7878nest-fail
7979```
8080
81−The bottom of this trace is the line and column of the twig which
81+The bottom of this trace is the line and column of the hoon which
8282failed to compile, then the cause of the error (`nest-fail`).
8383
8484Hoon does not believe in inundating you with possibly irrelevant
@@ -104,8 +104,8 @@ means you tried to pound a square peg into a round hole.
104104What was the peg and what was the hole? Hoon doesn't tell you by
105105default, because moral fiber, and also because in too many cases
106106trivial errors lead to large intimidating dumps. However, you
107−can use the `~!` rune ("sigzap", `:peep`) to print the type of
108−any twig in your stack trace.
107+can use the `~!` rune ([*sigzap*](../rune/sig/zap)) to print the type of
108+any hoon in your stack trace.
109109
110110For instance, you wrote `(foo bar)` and got a `nest-fail`. Change
111111your code to be:
@@ -126,18 +126,15 @@ In other words, "undeclared variable."
126126
127127The most common subspecies of `find` error is `find.$`, meaning
128128the empty name `$` was not found. This often happens when you
129−use a twig that does not produce a gate/mold, as a gate/mold.
130−
131−For instance, `(foo bar)` will give `find.$` if `foo` is not
132−actually a function. `?=([%foo %bar] baz)` will give `find.$`,
133−because `?=` ("wuttis", `:fits`) needs a mold rather than a seed
134−(you probably meant `?=({$foo $bar} baz)`).
129+use a hoon that does not produce a gate/mold, as a gate/mold. For
130+instance, `(foo bar)` will give `find.$` if `foo` is not actually a
131+function.
135132
136133### `mint-vain` and `mint-lost`
137134
138135These are errors caused by type inference in pattern matching.
139−`mint-vain` means this twig is never executed. `mint-lost` means
140−there's a case in a `?-` ("wuthep", `:case`) that isn't handled.
136+`mint-vain` means this hoon is never executed. `mint-lost` means
137+there's a case in a `?-` ([*wuthep*](../rune/wut/hep)) that isn't handled.
141138
142139## Runtime crashes
143140
@@ -150,8 +147,8 @@ need to be developing on the local console; otherwise, the
150147infinite loop will time out either too slowly or too fast). The
151148stack trace will show what your code was doing when interrupted.
152149
153−The counterpart of `~!` for runtime crashes is `~|` ("sigbar",
154−`:show`):
150+The counterpart of `~!` for runtime crashes is `~|`
151+([*sigbar*](../rune/sig/bar)):
155152
156153```
157154~| foo
@@ -167,8 +164,8 @@ The worst possibility, of course, is that your code runs but does
167164the wrong thing. This is relatively unusual in a typed
168165functional language, but it still happens.
169166
170−`~&` ("sigpam", `:dump`) is Hoon's debugging printf. This
171−pretty-prints its argument:
167+`~&` ([*sigpam*](../rune/sig/pam)) is Hoon's debugging printf.
168+This pretty-prints its argument:
172169
173170```
174171~& foo
@@ -176,7 +173,7 @@ pretty-prints its argument:
176173```
177174
178175will always print `foo` every time it executes. A variant is
179−`~?` ("sigwut", `:warn`), which prints only if a condition is
176+`~?` ([*sigwut*](../rune/sig/wut)), which prints only if a condition is
180177true:
181178
182179```
docs/hoon/twig.mddeleted−75
@@ -1,75 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 14
4−next: true
5−title: Expressions
6−---
7−
8−# Expressions
9−
10−A Hoon expression is called a `twig`. A `twig` is an AST node:
11−the noun that the Hoon compiler makes when it parses a source
12−expression.
13−
14−The definition of `twig` is the definition of Hoon. So let's
15−define the syntax and semantics of Hoon, a twig at a time. But
16−first, basic twig anatomy.
17−
18−## Twig anatomy and jargon
19−
20−A twig is a tagged union (`book`) with the form `{stem bulb}`,
21−where the `stem` is an atomic symbol. The bulb for each stem has
22−its own type, which varies by stem. (Compare with Lisp, where
23−every AST node is a tag and a list of child nodes.)
24−
25−There are no user-level macros. All stems are built into Hoon.
26−Most stems are implemented as internal macros, however.
27−
28−The bulb is usually a tuple, sometimes a list or map. An element
29−of this structure is a *subexpression* or just *leg*.
30−
31−Usually a subexpression is itself a `twig`; sometimes it's a
32−`@tas` (symbol) or a `wing` (reference path).
33−
34−## Moldy moss; woody seed
35−
36−When defining each page in the `twig` book, we never use `twig`
37−itself as a leg. Instead, we use the mold `moss` to describe
38−twigs whose product is used as a mold, and `seed` for twigs whose
39−product could be anything. Both `moss` and `seed` are just
40−aliases for `twig`, but they serve as documentation.
41−
42−For adjectives, we say *moldy* and *woody* respectively. An
43−example of X is the woody form of X; a mold producing X is its
44−moldy form.
45−
46−For instance, `[%foo %bar]` is woody: a twig producing the noun
47−`[7.303.014 7.496.034]`. `{$foo $bar}` is moldy: a twig
48−producing a function whose product is always `[7.303.014
49−7.496.034]`.
50−
51−This mold, of course, is a noun (a gate). The value of that noun
52−is not `[7.303.014 7.496.034]`, or anything remotely like it.
53−The noun is a pile of code. It is probably a big pile of code,
54−because most cores include a lot of formulas, contexts, etc,
55−generally including the whole standard library. (Having a
56−pointer to the standard library does not burden a noun much,
57−unless of course you're trying to print that noun and you don't
58−have a span that describes it.)
59−
60−And of course, Hoon is a functional language, so seeds sometimes
61−produce a mold -- because we do pass around functions as values.
62−Don't worry about this issue. It will totally make sense soon.
63−
64−But writing `[%foo %bar]` where you mean `{$foo $bar}`, or the
65−reverse, is a common beginner's mistake in Hoon. At least it
66−always results in a compiler error (since the noun types are so
67−different). There's really no way around learning not to make
68−this mistake the hard way, but designating subexpressions as
69−`moss` or `seed` can't hurt.
70−
71−## Twig categories
72−
73−Most twigs fit into clear categories by meaning and rune prefix:
74−
75−<div><list/></div>
docs/hoon/twig/bar-core.mddeleted−30
@@ -1,30 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 5
4−
5−---
6−
7−# Core, `|` ("bar")
8−
9−Core twigs are flow twigs. The compiler essentially pins a Nock
10−formula, or battery of formulas, to the subject.
11−
12−All `|` twigs are macros around `$core`. (See the `$core`
13−section in [`span`](../../basic#-core-p-span-q-map-term-span) above.)
14−`$core` uses the subject as the payload of a battery, whose arms are
15−compiled with the core itself as the subject.
16−
17−Four of these twigs (`:gate`, `:trap`, `:loop`, and `:gill`) produce a
18−core with a single arm, named `$`. We can recompute this arm with changes,
19−useful for recursion among other things:
20−
21−> `:moar()` expands to `:make($)`, accepting a *jogging* body
22−> containing a list of changes to the subject.
23−
24−> `$()` expands to `%=($)`, accepting a *jogging* body
25−> containing a list of changes to the subject.
26−
27−
28−## Stems
29−
30−<list dataPreview="true" className="runes"></list>
docs/hoon/twig/bar-core/col-gasp.mddeleted−30
@@ -1,30 +0,0 @@
1−---
2−navhome: /docs
3−sort: 8
4−
5−---
6−
7−# `:gasp |: "barcol"`
8−
9−`{$gasp p/seed q/seed}`: form a gate with burnt sample.
10−
11−## Expands to
12−
13−```
14−:pin :burn(p)
15−:trap(q)
16−```
17−
18−```
19−=> ^~ p
20− |. q
21−```
22−
23−## Discussion
24−
25−Note that `p` is a seed, not a moss; `:gasp` doesn't bunt your sample as
26−`:gate` does.
27−
28−## Syntax
29−
30−Regular: *2-fixed*.
docs/hoon/twig/bar-core/dot-trap.mddeleted−85
@@ -1,85 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 3
4−
5−---
6−
7−# `:trap |. "bardot"`
8−
9−`{$trap p/seed}`: form a trap, a core with one arm `$`.
10−
11−## Expands to
12−
13−```
14−:core
15−++ $ p
16−--
17−```
18−
19−```
20−|% ++ $ p
21−--
22−```
23−
24−## Syntax
25−
26−Regular: *1-fixed*.
27−
28−## Discussion
29−
30−A trap is a deferred computation.
31−
32−## Examples
33−
34−A trivial trap:
35−
36−```
37−~zod:dojo> =foo :trap(42)
38−~zod:dojo> :rap($ foo)
39−42
40−~zod:dojo> (foo)
41−42
42−```
43−
44−```
45−~zod:dojo> =foo |.(42)
46−~zod:dojo> $:foo
47−42
48−~zod:dojo> (foo)
49−42
50−```
51−
52−A more interesting trap:
53−
54−```
55−~zod:dojo> =foo :var reps 10
56− :var step 0
57− :var outp 0
58− :trap
59− :if =(step reps)
60− outp
61− :moar(outp (add outp 2), step +(step))
62−~zod:dojo> (foo)
63−20
64−```
65−
66−```
67−~zod:dojo> =foo =/ reps 10
68− =/ step 0
69− =/ outp 0
70− |.
71− ?: =(step reps)
72− outp
73− $(outp (add outp 2), step +(step))
74−~zod:dojo> (foo)
75−20
76−```
77−
78−Note that we can use `:moar()` or `$()` to recurse back into the
79−trap, since it's a core with an `$` arm.
80−
81−> `:moar()` expands to `:make($)`, accepting a *jogging* body containing a list
82−> of changes to the subject.
83−
84−> `$()` expands to `%=($)`, accepting a *jogging* body containing a
85−> list of changes to the subject.
docs/hoon/twig/bar-core/hep-loop.mddeleted−74
@@ -1,74 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 4
4−
5−---
6−
7−# `:loop |- "barhep"`
8−
9−`{$loop p/seed}`: form a trap and kick ("*call*") it.
10−
11−## Expands to
12−
13−```
14−:rap $
15−:trap p
16−```
17−
18−```
19−=<($ |.(p))
20−```
21−
22−## Syntax
23−
24−Regular: *1-fixed*.
25−
26−## Discussion
27−
28−The `:loop` keyword (and `|-` rune) can be thought of as a "recursion point" -
29−since `:loop` makes a `:trap` (a core with one arm named `$`), we can recurse
30−back into it with `:moar()` or `$()`.
31−
32−> `:moar()` expands to `:make($)`, accepting a *jogging* body containing a list
33−> of changes to the subject.
34−
35−> `$()` expands to `%=($)`, accepting a *jogging* body containing a
36−> list of changes to the subject.
37−
38−## Examples
39−
40−A trivial loop doesn't even recurse:
41−
42−```
43−~zod:dojo> :loop(42)
44−42
45−```
46−
47−```
48−~zod:dojo> |-(42)
49−42
50−```
51−
52−The classic loop is a decrement:
53−
54−```
55−~zod:dojo> =foo :var a 42
56− :var b 0
57− :loop
58− :if =(a +(b))
59− b
60− :moar(b +(b))
61−~zod:dojo> foo
62−41
63−```
64−
65−```
66−~zod:dojo> =foo =/ a 42
67− =/ b 0
68− |-
69− ?: =(a +(b))
70− b
71− $(b +(b))
72−~zod:dojo> foo
73−41
74−```
docs/hoon/twig/bar-core/sig-port.mddeleted−38
@@ -1,38 +0,0 @@
1−---
2−navhome: /docs
3−sort: 10
4−
5−---
6−
7−# `:port |~ "barsig"`
8−
9−`{$port p/moss q/seed}`: form an iron gate.
10−
11−## Expands to
12−
13−```
14−:iron :gate(p q)
15−```
16−
17−```
18−^| |=(p q)
19−```
20−
21−## Syntax
22−
23−Regular: *2-fixed*.
24−
25−## Discussion
26−
27−See [this discussion of core variance models](../../../advanced)
28−
29−## Examples
30−
31−```
32−~zod:dojo> :per ~ :like(:port(a/@ *@) :gate(a/* *@))
33−```
34−
35−```
36−~zod:dojo> => ~ ^+(|~(a/@ *@) |=(a/* *@))
37−<1|usl {a/@ $~}>
38−```
docs/hoon/twig/bar-core/tar-gill.mddeleted−74
@@ -1,74 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 6
4−---
5−
6−# `:gill |* "bartar"`
7−
8−`{$gill p/moss q/seed}`: form a gill, a wet one-armed
9−core with sample.
10−
11−## Expands to
12−
13−```
14−:new p
15−:core
16−+- $
17− q
18−--
19−```
20−
21−```
22−=| p
23−|%
24−+- $
25− q
26−--
27−```
28−
29−## Syntax
30−
31−Regular: *2-fixed*.
32−
33−## Discussion
34−
35−In a normal (dry) gate, your argument is converted into the
36−sample type. In a generic (wet) gate or gill, your argument type
37−passes through the function, rather as if it was a macro (there
38−is still only one copy of the code, however).
39−
40−Genericity is a powerful and dangerous tool. Use gills only if
41−you think you know what you're doing.
42−
43−Just as with a `:gate`, we can recurse back into a `:gill` with `:moar()` or `$()`.
44−
45−> `:moar()` expands to `:make($)`, accepting a *jogging* body containing a list
46−> of changes to the subject.
47−
48−> `$()` expands to `%=($)`, accepting a *jogging* body containing a
49−> list of changes to the subject.
50−
51−## Examples
52−
53−Wet and dry gates in a nutshell:
54−
55−```
56−~zod:dojo> =foo :gate({a/* b/*} [b a])
57−~zod:dojo> =bar :gill({a/* b/*} [b a])
58−~zod:dojo> (foo %cat %dog)
59−[6.778.724 7.627.107]
60−~zod:dojo> (bar %cat %dog)
61−[%dog %cat]
62−```
63−
64−```
65−~zod:dojo> =foo |=({a/* b/*} [b a])
66−~zod:dojo> =bar |*({a/* b/*} [b a])
67−~zod:dojo> (foo %cat %dog)
68−[6.778.724 7.627.107]
69−~zod:dojo> (bar %cat %dog)
70−[%dog %cat]
71−```
72−
73−The dry gate does not preserve the span of `a` and `b`; the wet
74−gate does.
docs/hoon/twig/bar-core/tis-gate.mddeleted−73
@@ -1,73 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 2
4−
5−---
6−
7−# `:gate |= "bartis"`
8−
9−`{$gate p/moss q/seed}`: form a gate, a dry one-armed core with sample.
10−
11−## Expands to
12−
13−```
14−:new p
15−:core
16−++ $
17− q
18−--
19−```
20−
21−```
22−=| p
23−|% ++ $ q
24−--
25−```
26−
27−## Syntax
28−
29−Regular: *2-fixed*.
30−
31−## Discussion
32−
33−A gate is a core with one arm named `$`, so, just as with `:loop` (`|-`),
34−we can recurse back into it with `:moar()` or `$()`.
35−
36−
37−> `:moar()` expands to `:make($)`, accepting a *jogging* body containing a list
38−> of changes to the subject.
39−
40−> `$()` expands to `%=($)`, accepting a *jogging* body containing a
41−> list of changes to the subject.
42−
43−## Examples
44−
45−A trivial gate:
46−
47−```
48−~zod:dojo> =foo :gate(a/@ +(a))
49−~zod:dojo> (foo 20)
50−21
51−```
52−
53−```
54−~zod:dojo> =foo |=(a/@ +(a))
55−~zod:dojo> (foo 20)
56−21
57−```
58−
59−A slightly less trivial gate:
60−
61−```
62−~zod:dojo> =foo :gate {a/@ b/@}
63− (add a b)
64−~zod:dojo> :call(foo [20 400])
65−420
66−```
67−
68−```
69−~zod:dojo> =foo |= {a/@ b/@}
70− (add a b)
71−~zod:dojo> (foo 20 400)
72−420
73−```
docs/hoon/twig/buc-mold/base.mddeleted−33
@@ -1,33 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 1
4−
5−---
6−
7−# `:base`
8−
9−`{$base p/$@(?($noun $cell $bean $null) {$atom p/aura})}`: trivial molds.
10−
11−## Produces
12−
13−A mold for the base in `p`. `$noun` is any noun; `$atom` is any
14−atom; `$cell` is a cell of nouns; `$bean` is a loobean, ``?(`@f`0
15−`@f`1)``. `$null` is zero with aura `@n`.
16−
17−## Syntax
18−
19−Irregular: `*` makes `$noun`, `^` makes `$cell`, `?` makes
20−`$bean`, `$~` makes `$null`, `@aura` makes atom `aura`.
21−
22−## Examples
23−
24−```
25−~zod:dojo> (* %foo)
26−7.303.014
27−~zod:dojo> ($~ 0)
28−~
29−~zod:dojo> (^ 0)
30−^
31−~zod:dojo> (@ux [1 1])
32−0x0
33−```
docs/hoon/twig/buc-mold/cab-shoe.mddeleted−58
@@ -1,58 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 9
4−---
5−
6−# `:shoe $_ "buccab"`
7−
8−`{$shoe p/seed}`: mold which normalizes to an example.
9−
10−## Expands to
11−
12−```
13−:gate *
14−p
15−```
16−
17−```
18−|=(* p)
19−```
20−
21−## Syntax
22−
23−Regular: *1-fixed*.
24−
25−Irregular: `_foo` is `:shoe(foo)`.
26−
27−## Discussion
28−
29−A shoe discards the sample it's supposedly normalizing, and
30−produces its example instead.
31−
32−## Examples
33−
34−```
35−~zod:dojo> =foo :shoe([%foobar %moobaz])
36−
37−~zod:dojo> (foo %foo %bar)
38−[%foobar %moobaz]
39−
40−~zod:dojo> `foo`[%foobar %moobaz]
41−[%foobar %moobaz]
42−
43−~zod:dojo $:foo
44−[%foobar %moobaz]
45−```
46−
47−```
48−~zod:dojo> =foo $_([%foobar %moobaz])
49−
50−~zod:dojo> (foo %foo %bar)
51−[%foobar %moobaz]
52−
53−~zod:dojo> `foo`[%foobar %moobaz]
54−[%foobar %moobaz]
55−
56−~zod:dojo $:foo
57−[%foobar %moobaz]
58−```
docs/hoon/twig/buc-mold/cen-book.mddeleted−54
@@ -1,54 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 4
4−
5−---
6−
7−# `:book $% "buccen"`
8−
9−`{$book p/(list {{aura @} moss})}`: mold which recognizes a union tagged by head atom.
10−
11−## Normalizes to
12−
13−For any item `i` in `p`, a cell whose head is the atom `q.p.i.p`,
14−and whose tail recognizes `q.i.p`.
15−
16−Void if `p` is empty.
17−
18−## Defaults to
19−
20−For the first item `i` in `p`, the cell `[q.p.i.p $:q.i.p]`.
21−Crashes if `p` is empty.
22−
23−## Syntax
24−
25−Regular form: *2-running*.
26−
27−## Discussion
28−
29−A book is a tagged union, an extremely common data model.
30−
31−Each item in a book is called a "page." Make sure the first page
32−in the book terminates, or the default will be an infinite loop!
33−
34−## Examples
35−
36−```
37−~zod:dojo> =foo :book({$foo p/@ud q/@ud} {$bar p/@ud})
38−
39−~zod:dojo> (foo [%bar 37])
40−[%bar p=37]
41−
42−~zod:dojo> $:foo
43−[%foo p=0 q=0]~
44−```
45−
46−```
47−~zod:dojo> =foo $%({$foo p/@ud q/@ud} {$bar p/@ud})
48−
49−~zod:dojo> (foo [%bar 37])
50−[%bar p=37]
51−
52−~zod:dojo> $:foo
53−[%foo p=0 q=0]~
54−```
docs/hoon/twig/buc-mold/hep-lamb.mddeleted−49
@@ -1,49 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 8
4−
5−---
6−
7−# `:lamb $- "buchep"`
8−
9−`{$lamb p/moss q/moss}`: mold which normalizes to an example gate.
10−
11−## Expands to
12−
13−```
14−:shoe
15−:iron
16−:gate p
17−$:q
18−```
19−
20−```
21−$_ ^|
22−|=(p $:q)
23−```
24−
25−## Syntax
26−
27−Regular: *2-fixed*.
28−
29−## Discussion
30−
31−Since a lamb (ie, lambda), is a shoe, it is not useful for normalizing, just
32−for typechecking. In particular, the existence of lambs does *not* let us send
33−gates or other cores over the network!
34−
35−## Examples
36−
37−```
38−~zod:dojo> =foo :lamb($foo $bar)
39−
40−~zod:dojo> ($:foo %foo)
41−%bar
42−```
43−
44−```
45−~zod:dojo> =foo $-($foo $bar)
46−
47−~zod:dojo> ($:foo %foo)
48−%bar
49−```
docs/hoon/twig/buc-mold/ket-bush.mddeleted−55
@@ -1,55 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 6
4−
5−---
6−
7−# `:bush $^ "bucket"`
8−
9−`{$bush p/moss q/moss}`: mold which normalizes a union tagged by head depth.
10−
11−## Normalizes to
12−
13−Default, if the sample is an atom; `p`, if the head of the sample
14−is an atom; `q` otherwise.
15−
16−## Defaults to
17−
18−The default of `p`.
19−
20−## Syntax
21−
22−Regular: *2-fixed*.
23−
24−## Examples
25−
26−```
27−~zod:dojo> =a :book({$foo p/@ud q/@ud} {$bar p/@ud})
28−
29−~zod:dojo> =b :bush({a a} a)
30−
31−~zod:dojo> (b [[%bar 33] [%foo 19 22]])
32−[[%bar p=33] [%foo p=19 q=22]]
33−
34−~zod:dojo> (b [%foo 19 22])
35−[%foo p=19 q=22]
36−
37−~zod:dojo> $:b
38−[%bar p=0]
39−```
40−
41−```
42−~zod:dojo> =a $%({$foo p/@ud q/@ud} {$bar p/@ud})
43−
44−~zod:dojo> =b $^({a a} a)
45−
46−~zod:dojo> (b [[%bar 33] [%foo 19 22]])
47−[[%bar p=33] [%foo p=19 q=22]]
48−
49−~zod:dojo> (b [%foo 19 22])
50−[%foo p=19 q=22]
51−
52−~zod:dojo> $:b
53−[%bar p=0]
54−```
55−
docs/hoon/twig/buc-mold/tis-coat.mddeleted−49
@@ -1,49 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 3
4−
5−---
6−
7−# `:coat $= "buctis"`
8−
9−`{$coat p/@tas q/moss}`: mold which wraps a face around another mold.
10−
11−## Expands to
12−
13−```
14−:gate *
15−:name(p :call(q +6))
16−```
17−
18−```
19−|= *
20−^=(p %-(q +6))
21−```
22−
23−## Syntax
24−
25−Regular: *2-fixed*.
26−
27−Irregular: `foo/bar` is `:coat(foo bar)`.
28−
29−## Discussion
30−
31−Note that the Hoon compiler is at least slightly clever about
32−compiling molds, and almost never has to actually put in a gate
33−layer (as seen in the expansion above) to apply a coat.
34−
35−## Examples
36−
37−```
38−~zod:dojo> =a :coat(p $foo)
39−
40−~zod:dojo> (a %bar)
41−p=%foo
42−```
43−
44−```
45−~zod:dojo> =a $=(p $foo)
46−
47−~zod:dojo> (a %bar)
48−p=%foo
49−```
docs/hoon/twig/buc-mold/wut-pick.mddeleted−60
@@ -1,60 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 7
4−
5−---
6−
7−# `:pick $? "bucwut"`
8−
9−`{$pick p/(list moss)}`: mold which normalizes a general union.
10−
11−## Normalizes to
12−
13−The first item in `p` which normalizes the sample to itself;
14−otherwise, default.
15−
16−Void, if `p` is empty.
17−
18−## Defaults to
19−
20−The first item in `p`.
21−
22−## Syntax
23−
24−Regular: *running*.
25−
26−Irregular: `?(%foo %bar)` is `$?(%foo %bar)`.
27−
28−## Discussion
29−
30−For a union of atoms, a pick is fine. For more complex nouns,
31−always try to use a book, claw or bush, at least if you expect
32−your mold to be used as a normalizer.
33−
34−## Examples
35−
36−```
37−~zod:dojo> =a :pick($foo $bar $baz)
38−
39−~zod:dojo> (a %baz)
40−%baz
41−
42−~zod:dojo> (a [37 45])
43−%foo
44−
45−~zod:dojo> $:a
46−$foo
47−```
48−
49−```
50−~zod:dojo> =a ?($foo $bar $baz)
51−
52−~zod:dojo> (a %baz)
53−%baz
54−
55−~zod:dojo> (a [37 45])
56−%foo
57−
58−~zod:dojo> $:a
59−$foo
60−```
docs/hoon/twig/cen-call.mddeleted−15
@@ -1,15 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 6
4−
5−---
6−
7−# Call, `%` ("cen")
8−
9−We've already covered `$wing` and `$limb`. These are simple
10−forms of the *invocation* family of twigs, `%`, whose general
11−form is `$make`, `%=`.
12−
13−## Stems
14−
15−<list dataPreview="true" className="runes"></list>
docs/hoon/twig/cen-call/cab-keep.mddeleted−55
@@ -1,55 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 2
4−
5−---
6−
7−# `:keep %_ "cencab"`
8−
9−`{$keep p/wing q/(list (pair wing seed))}`: take a wing with changes,
10−preserving type.
11−
12−## Expands to
13−
14−```
15−:like(p :make(p q))
16−```
17−
18−```
19−^+(p %=(p q))
20−```
21−
22−## Syntax
23−
24−Regular: *1-fixed*, then *jogging*.
25−
26−## Discussion
27−
28−`:keep` is different from `:make` because `:make` can change the
29−span of a limb with mutations.
30−
31−## Examples
32−
33−```
34−~zod:dojo> =foo [p=42 q=6]
35−~zod:dojo> foo(p %bar)
36−[p=%bar q=6]
37−~zod:dojo> foo(p [55 99])
38−[p=[55 99] q=6]
39−~zod:dojo> :keep(foo p %bar)
40−[p=7.496.034 99]
41−~zod:dojo> :keep(foo p [55 99])
42−! nest-fail
43−```
44−
45−```
46−~zod:dojo> =foo [p=42 q=6]
47−~zod:dojo> foo(p %bar)
48−[p=%bar q=6]
49−~zod:dojo> foo(p [55 99])
50−[p=[55 99] q=6]
51−~zod:dojo> %_(foo p %bar)
52−[p=7.496.034 99]
53−~zod:dojo> %_(foo p [55 99])
54−! nest-fail
55−```
docs/hoon/twig/cen-call/dot-lace.mddeleted−37
@@ -1,37 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 5
4−---
5−
6−# `:lace %. "cendot"`
7−
8−`{$lace p/seed q/seed}`: call a gate (function), reversed.
9−
10−## Expands to
11−
12−```
13−:call(q p)
14−```
15−
16−```
17−%-(q p)
18−```
19−
20−## Syntax
21−
22−Regular: *2-fixed*.
23−
24−## Examples
25−
26−```
27−~zod:dojo> =add-triple :gate({a/@ b/@ c/@} :(add a b c))
28−~zod:dojo> :lace([1 2 3] add-triple)
29−6
30−```
31−
32−```
33−~zod:dojo> =add-triple |=({a/@ b/@ c/@} :(add a b c))
34−~zod:dojo> %.([1 2 3] add-triple)
35−6
36−```
37−
docs/hoon/twig/cen-call/ket-calq.mddeleted−36
@@ -1,36 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 7
4−---
5−
6−# `:calq %^ "cenket"`
7−
8−`{$calq p/seed q/seed r/seed s/seed}`: call with triple sample.
9−
10−## Expands to
11−
12−```
13−:call(p [q r s])
14−```
15−
16−```
17−%-(p [q r s])
18−```
19−
20−## Syntax
21−
22−Regular: *4-fixed*.
23−
24−## Examples
25−
26−```
27−~zod:dojo> =add-triple :gate({a/@ b/@ c/@} :(add a b c))
28−~zod:dojo> :calq(add-triple 1 2 3)
29−6
30−```
31−
32−```
33−~zod:dojo> =add-triple |=({a/@ b/@ c/@} :(add a b c))
34−~zod:dojo> %^(add-triple 1 2 3)
35−6
36−```
docs/hoon/twig/cen-call/lus-calt.mddeleted−36
@@ -1,36 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 6
4−---
5−
6−# `:calt %+ "cenlus"`
7−
8−`{$calt p/seed q/seed r/seed}`: call with pair sample.
9−
10−## Expands to
11−
12−```
13−:call(p [q r])
14−```
15−
16−```
17−%-(p [q r])
18−```
19−
20−## Syntax
21−
22−Regular: *3-fixed*.
23−
24−## Examples
25−
26−```
27−~zod:dojo> =add-triple :gate({a/@ b/@ c/@} :(add a b c))
28−~zod:dojo> :calt(add-triple 1 [2 3])
29−6
30−```
31−
32−```
33−~zod:dojo> =add-triple |=({a/@ b/@ c/@} :(add a b c))
34−~zod:dojo> %+(add-triple 1 [2 3])
35−6
36−```
docs/hoon/twig/cen-call/sig-open.mddeleted−45
@@ -1,45 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 3
4−---
5−
6−# `:open %~ "censig"`
7−
8−`{$cnsg p/wing q/seed r/seed}`: call with multi-armed door.
9−
10−## Expands to
11−
12−```
13−:pin :name(a q)
14−:rap(p :make(a +6 r))
15−```
16−
17−```
18−=+ a=q
19−=<(p %=(a +6 r))
20−```
21−
22−> Note: the expansion implementation is hygienic -- it doesn't actually add the
23−> `a` face to the subject. It's shown here because `:make` requires a `wing`.
24−
25−## Syntax
26−
27−Regular: *3-fixed*.
28−
29−Irregular: `~(a b c)` is `%~(a b c)`; `~(a b c d e)` is `%~(a b
30−[c d e])`.
31−
32−## Discussion
33−
34−`:open` is the general case of a function call, `:call`. In
35−both, we replace the sample (`+6`) of a core. In `:call` the
36−core is a gate and we pull the `$` arm, in `:open` the
37−core is a door and we can pull any of its arms.
38−
39−Most languages do not have cores, doors, or `:open`. "Just
40−learn to step outside your linear, Western way of thinking."
41−
42−## Examples
43−
44−See [`:door`](../../bar-core/cab-door).
45−
docs/hoon/twig/col-cell.mddeleted−15
@@ -1,15 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 3
4−
5−---
6−
7−# Cells, `:` ("col")
8−
9−The cell twigs, `$cons` and friends, are simple and regular.
10−All `:` twigs expand to `$cons`, which makes a pair (just like
11−the Lisp `cons` operator).
12−
13−## Stems
14−
15−<list dataPreview="true" className="runes"></list>
docs/hoon/twig/col-cell/cab-scon.mddeleted−34
@@ -1,34 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 6
4−---
5−
6−# `:scon :_ "colcab"`
7−
8−`{$scon p/seed q/seed}`; construct a cell, inverted.
9−
10−### Expands to
11−
12−```
13−:cons(q p)
14−```
15−
16−```
17−:-(q p)
18−```
19−
20−### Syntax
21−
22−Regular: *2-fixed*.
23−
24−### Examples
25−
26−```
27−~zod:dojo> :scon(1 2)
28−[2 1]
29−```
30−
31−```
32−~zod:dojo> :_(1 2)
33−[2 1]
34−```
docs/hoon/twig/col-cell/hep-cons.mddeleted−51
@@ -1,51 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 1
4−---
5−
6−# `:cons :- "colhep"`
7−
8−`{$cons p/seed q/seed}`: construct a cell (2-tuple).
9−
10−## Produces
11−
12−The cell of `p` and `q`.
13−
14−## Syntax
15−
16−Regular: *2-fixed*.
17−
18−Irregular: `[a b]` is `:cons(a b)`.
19−
20−Irregular: `[a b c]` is `[a [b c]]`.
21−
22−Irregular: `a^b^c` is `[a b c]`.
23−
24−Irregular: `a+b` is `[%a b]`.
25−
26−Irregular: `` `a`` is `[~ a]`.
27−
28−Irregular: `~[a b]` is `[a b ~]`.
29−
30−Irregular: `[a b c]~` is `[[a b c] ~]`.
31−
32−## Discussion
33−
34−Hoon twigs actually use the same "autocons" pattern as Nock
35−formulas. If you're assembling twigs (which usually only the
36−compiler does), `[a b]` is the same as `[%cons a b]`.
37−
38−## Examples
39−
40−```
41−~zod:dojo> :cons(1 2)
42−[1 2]
43−~zod:dojo> :-(1 2)
44−[1 2]
45−~zod:dojo> 1^2
46−[1 2]
47−~zod:dojo> 1+2
48−[%1 2]
49−~zod:dojo> `1
50−[~ 1]
51−```
docs/hoon/twig/col-cell/ket-conq.mddeleted−44
@@ -1,44 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 3
4−---
5−
6−# `:conq :^ "colket"`
7−
8−`{$conq p/seed q/seed r/seed s/seed}`: construct a quadruple (4-tuple).
9−
10−## Expands to
11−
12−```
13−:cons(p :cons(q :cons(r s)))
14−```
15−
16−```
17−:-(p :-(q :-(r s)))
18−```
19−
20−## Syntax
21−
22−Regular: *4-fixed*.
23−
24−## Examples
25−
26−```
27−/~zod:dojo> :conq(1 2 3 4)
28−[1 2 3 4]
29−/~zod:dojo> :conq 5
30− 6
31− 7
32− 8
33−[5 6 7 8]
34−```
35−
36−```
37−/~zod:dojo> :^(1 2 3 4)
38−[1 2 3 4]
39−/~zod:dojo> :^ 5
40− 6
41− 7
42− 8
43−[5 6 7 8]
44−```
docs/hoon/twig/col-cell/lus-cont.mddeleted−42
@@ -1,42 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 2
4−---
5−
6−# `:cont :+ "collus"`
7−
8−`{$cont p/seed q/seed r/seed}`: construct a triple (3-tuple).
9−
10−## Expands to:
11−
12−```
13−:cons(p :cons(q r))
14−```
15−
16−```
17−:-(p :-(q r))
18−```
19−
20−## Syntax
21−
22−Regular: *3-fixed*.
23−
24−## Examples
25−
26−```
27−/~zod:dojo> :cont 1
28− 2
29− 3
30−[1 2 3]
31−/~zod:dojo> :cont(%a ~ 'b')
32−[%a ~ 'b']
33−```
34−
35−```
36−/~zod:dojo> :+ 1
37− 2
38− 3
39−[1 2 3]
40−/~zod:dojo> :+(%a ~ 'b')
41−[%a ~ 'b']
42−```
docs/hoon/twig/col-cell/sig-conl.mddeleted−68
@@ -1,68 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 5
4−---
5−
6−# `:conl :~ "colsig"`
7−
8−`{$conl p/(list seed)}`: construct a null-terminated list.
9−
10−## Expands to
11−
12−*Pseudocode*, `a`, `b`, `c`, ... as elements of `p`
13−
14−```
15−:cons(a :cons(b :cons(c :cons(... :cons(z ~)))))
16−```
17−
18−### Compiler macro
19−
20−```
21−:loop
22−:ifno p
23− ~
24−:cons i.p
25−:moar(p t.p)
26−```
27−
28−```
29−|-
30−?~ p
31− ~
32−:- i.p
33−$(p t.p)
34−```
35−
36−## Syntax
37−
38−Regular: *running*.
39−
40−## Examples
41−
42−```
43−~zod:dojo> :conl(6 5 3 4 2 1)
44−[6 5 3 4 2 1 ~]
45−~zod:dojo> ~[6 5 3 4 2 1]
46−[6 5 3 4 2 1 ~]
47−~zod:dojo> :conl 5
48− 3
49− 4
50− 2
51− 1
52− ==
53−[5 3 4 2 1 ~]
54−```
55−
56−```
57−~zod:dojo> :~(5 3 4 2 1)
58−[5 3 4 2 1 ~]
59−~zod:dojo> ~[5 3 4 2 1]
60−[5 3 4 2 1 ~]
61−~zod:dojo> :~ 5
62− 3
63− 4
64− 2
65− 1
66− ==
67−[5 3 4 2 1 ~]
68−```
docs/hoon/twig/col-cell/tar-conp.mddeleted−78
@@ -1,78 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 4
4−---
5−
6−# `:conp :* "coltar"`
7−
8−`{$conp p/(list twig)}`: construct an n-tuple.
9−
10−## Expands to
11−
12−*Pseudocode*, `a`, `b`, `c`, ... as elements of `p`
13−
14−```
15−:cons(a :cons(b :cons(c :cons(... z)))))
16−```
17−
18−### Compiler macro
19−
20−```
21−:loop
22−:ifno p
23− !!
24−:ifno t.p
25− i.p
26−:cons i.p
27−:moar(p t.p)
28−```
29−
30−```
31−|-
32−?~ p
33− !!
34−?~ t.p
35− i.p
36−:- i.p
37−$(p t.p)
38−```
39−
40−## Syntax
41−
42−Regular: *running*.
43−
44−## Examples
45−```
46−/~zod:dojo> :conp(5 3 4 1 4 9 0 ~ 'a')
47−[5 3 4 1 4 9 0 ~ 'a']
48−/~zod:dojo> [5 3 4 1 4 9 0 ~ 'a']
49−[5 3 4 1 4 9 0 ~ 'a']
50−/~zod:dojo> :conp 5
51− 3
52− 4
53− 1
54− 4
55− 9
56− 0
57− ~
58− 'a'
59− ==
60−[5 3 4 1 4 9 0 ~ 'a']
61−```
62−```
63−/~zod:dojo> :*(5 3 4 1 4 9 0 ~ 'a')
64−[5 3 4 1 4 9 0 ~ 'a']
65−/~zod:dojo> [5 3 4 1 4 9 0 ~ 'a']
66−[5 3 4 1 4 9 0 ~ 'a']
67−/~zod:dojo> :* 5
68− 3
69− 4
70− 1
71− 4
72− 9
73− 0
74− ~
75− 'a'
76− ==
77−[5 3 4 1 4 9 0 ~ 'a']
78−```
docs/hoon/twig/dot-nock/wut-deep.mddeleted−32
@@ -1,32 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 2
4−---
5−
6−# `:deep .? "dotwut"`
7−
8−`{$deep p/seed}`: test for cell or atom with Nock `3`.
9−
10−## Produces
11−
12−`&`, `%.y`, `0` if `p` is a cell; otherwise `|`, `%.n`, `1`.
13−
14−## Syntax
15−
16−Regular: *1-fixed*.
17−
18−## Examples
19−
20−```
21−~zod:dojo> :deep(~)
22−%.n
23−~zod:dojo> :deep([2 3])
24−%.y
25−```
26−
27−```
28−~zod:dojo> .?(~)
29−%.n
30−~zod:dojo> .?([2 3])
31−%.y
32−```
docs/hoon/twig/ket-cast.mddeleted−17
@@ -1,17 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 9
4−
5−---
6−
7−# Cast, `^` ("ket")
8−
9−`$cast`, `$like`, and `$name` let us adjust spans without
10−violating type constraints.
11−
12−The `nest` algorithm which tests span subtyping is conservative;
13−it never allows invalid nests, it sometimes rejects valid nests.
14−
15−## Twigs
16−
17−<list dataPreview="true" className="runes"></list>
docs/hoon/twig/ket-cast/lus-like.mddeleted−29
@@ -1,29 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 1
4−---
5−
6−# `:like ^+ "ketlus"`
7−
8−`{$like p/seed q/seed}`: typecast by example (seed).
9−
10−## Produces
11−
12−The value of `q` with the span of `p`, if the span of `q` nests
13−within the span of `p`. Otherwise, `nest-fail`.
14−
15−## Syntax
16−
17−Regular: *2-fixed*.
18−
19−## Examples
20−
21−```
22−~zod:dojo> :like('text' %a)
23−'a'
24−```
25−
26−```
27−~zod:dojo> ^+('text' %a)
28−'a'
29−```
docs/hoon/twig/sig-hint/gal-thin.mddeleted−39
@@ -1,39 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 6
4−---
5−
6−# `:thin ~< "siggal"`
7−
8−`{$thin p/$@(term {p/term q/seed}) q/seed}`: raw hint, applied to
9−product.
10−
11−## Expands to
12−
13−`q`.
14−
15−## Syntax
16−
17−Regular: *2-fixed*. For the dynamic form, write `%term.twig`.
18−
19−## Discussion
20−
21−`:thin` is only used for jet hints (`:funk` and `:fast`) at the
22−moment; we are not telling the interpreter something about the
23−computation we're about to perform, but rather about its product.
24−
25−## Examples
26−
27−```
28−~zod:dojo> (make ':thin(%a 42)')
29−[%7 p=[%1 p=42] q=[%10 p=97 q=[%0 p=1]]]
30−~zod:dojo> (make ':thin(%a.+(.) 42)')
31−[%7 p=[%1 p=42] q=[%10 p=[p=97 q=[%4 p=[%0 p=1]]] q=[%0 p=1]]]
32−```
33−
34−```
35−~zod:dojo> (make '~<(%a 42)')
36−[%7 p=[%1 p=42] q=[%10 p=97 q=[%0 p=1]]]
37−~zod:dojo> (make '~<(%a.+(.) 42)')
38−[%7 p=[%1 p=42] q=[%10 p=[p=97 q=[%4 p=[%0 p=1]]] q=[%0 p=1]]]
39−```
docs/hoon/twig/sig-hint/zap-peep.mddeleted−38
@@ -1,38 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 9
4−---
5−
6−# `:peep ~! "sigzap"`
7−
8−`{$peep p/seed q/seed}`: print type on compilation fail.
9−
10−## Expands to
11−
12−`q`.
13−
14−## Convention
15−
16−If compilation of `q` fails, prints the span of `p` in the trace.
17−
18−## Syntax
19−
20−Regular: *2-fixed*.
21−
22−## Examples
23−
24−```
25−~zod:dojo> a
26−! -find.a
27−~zod:dojo> :peep('foo' a)
28−! @t
29−! find.a
30−```
31−
32−```
33−~zod:dojo> a
34−! -find.a
35−~zod:dojo> ~!('foo' a)
36−! @t
37−! find.a
38−```
docs/hoon/twig/tis-flow.mddeleted−34
@@ -1,34 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 4
4−
5−---
6−
7−# Flow, `=` ("tis")
8−
9−Flow twigs change the subject. (Or more precisely, a flow twig
10−compiles at least one of its subtwigs with a different subject.)
11−All non-flow twigs (except cores) pass the subject down unchanged.
12−
13−## Overview
14−
15−The simplest way to change the subject is to compose two twigs,
16−`p` and `q`. Let `x` be `(mint subject p)`, with product span
17−`p.x` and nock formula `q.x`. Let `y` be `(mint p.x q)`. Then
18−their composition is `[p.y [7 q.x q.y]]`.
19−
20−This composition is the `$per` twig. A close relative is `$pin`,
21−which is `$per` over `[p .]`. The new subject is a cell of `p`
22−and the old subject. `$pin` is the simplest Hoon equivalent of
23−"declaring a variable" (introducing new data into the subject).
24−
25−Another way to change the subject is to mutate it. With the
26−`$set` twig, given a wing that resolves to a leg, we can write
27−instead of reading, *installing* a new value at that leg. Of
28−course, we are creating a copy, not modifying the original.
29−
30−There are many flow stems, all small variations on these three.
31−
32−## Twigs
33−
34−<list dataPreview="true" className="runes"></list>
docs/hoon/twig/tis-flow/bar-new.mddeleted−52
@@ -1,52 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 5
4−---
5−
6−# `:new =| "tisbar"`
7−
8−`{$new p/moss q/seed}`: combine a defaulted mold with the subject.
9−
10−## Expands to
11−
12−```
13−:pin(:bunt(p) q)
14−```
15−
16−```
17−=+(*p q)
18−```
19−
20−## Syntax
21−
22−Regular: *2-fixed*.
23−
24−## Discussion
25−
26−`:new` "declares a variable" which is "uninitialized," presumably
27−because you'll set it in a loop or similar.
28−
29−A common mistake is to forget that since `p` is moldy,
30−`:new(foo=@ bar)` is wrong; you mean `:new(foo/@ bar)`, since
31−`foo=@` is `:name(foo @)` (putting a face on a seed) and `foo/@`
32−is `:coat(foo @)` (wrapping a face around a mold).
33−
34−## Examples
35−
36−```
37−~zod:dojo> =foo :gate a/@
38− :new b/@
39− :nip :(add a b c)
40− c=2
41−~zod:dojo> (foo 5)
42−7
43−```
44−
45−```
46−~zod:dojo> =foo |= a/@
47− =| b/@
48− =- :(add a b c)
49− c=2
50−~zod:dojo> (foo 5)
51−7
52−```
docs/hoon/twig/tis-flow/col-fix.mddeleted−42
@@ -1,42 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 9
4−---
5−
6−# `:fix =: "tiscol"`
7−
8−`{$fix p/(list (pair wing seed)) q/seed}`: change multiple legs in the subject.
9−
10−## Expands to
11−
12−```
13−:per(:keep(. p) q)
14−```
15−
16−```
17−=>(%_(. p) q)
18−```
19−
20−## Syntax
21−
22−Regular: *jogging*, then *1-fixed*.
23−
24−## Examples
25−
26−```
27−~zod:dojo> :pin a=[b=1 c=2]
28− :fix c.a 4
29− b.a 3
30− ==
31− a
32−[b=3 c=4]
33−```
34−
35−```
36−~zod:dojo> =+ a=[b=1 c=2]
37− =: c.a 4
38− b.a 3
39− ==
40− a
41−[b=3 c=4]
42−```
docs/hoon/twig/tis-flow/gal-rap.mddeleted−35
@@ -1,35 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 2
4−---
5−
6−# `:rap =< "tisgal"`
7−
8−`{$rap p/seed q/seed}`: compose two twigs, inverted.
9−
10−## Expands to
11−
12−```
13−:per(q p)
14−```
15−
16−```
17−=>(q p)
18−```
19−
20−## Syntax
21−
22−Regular: *2-fixed*.
23−
24−Irregular: `foo:bar` is `:rap(foo bar)`.
25−
26−## Examples
27−
28−```
29−~zod:dojo> :rap(b [a=1 b=2 c=3])
30−2
31−~zod:dojo> b:[a=1 b=2 c=3]
32−2
33−~zod:dojo> [. .]:(add 2 4)
34−[6 6]
35−```
docs/hoon/twig/tis-flow/hep-nip.mddeleted−47
@@ -1,47 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 4
4−---
5−
6−# `:nip =- "tishep"`
7−
8−`{$nip p/seed q/seed}`: combine a new noun with the subject, inverted.
9−
10−## Expands to
11−
12−```
13−:per(:cons(q .) p)
14−```
15−
16−```
17−=>([q .] p)
18−```
19−
20−## Syntax
21−
22−Regular: *2-fixed*.
23−
24−## Discussion
25−
26−`:nip` looks better than `:pin` when the twig you're pinning
27−is much smaller than the twig that uses it.
28−
29−## Examples
30−
31−```
32−~zod:dojo> =foo :gate a/@
33− :pin :name(b 1)
34− :nip :(add a b c)
35− c=2
36−~zod:dojo> (foo 5)
37−8
38−```
39−
40−```
41−~zod:dojo> =foo |= a/@
42− =+ b=1)
43− =- (add a b c)
44− c=2
45−~zod:dojo> (foo 5)
46−8
47−```
docs/hoon/twig/tis-flow/lus-pin.mddeleted−46
@@ -1,46 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 3
4−---
5−
6−# `:pin =+ "tislus"`
7−
8−`{$pin p/seed q/seed}`: combine a new noun with the subject.
9−
10−## Expands to
11−
12−```
13−:per(:cons(p .) q)
14−```
15−
16−```
17−=>([p .] q)
18−```
19−
20−## Syntax
21−
22−Regular: *2-fixed*.
23−
24−## Discussion
25−
26−`:pin` is the simplest way of "declaring a variable."
27−
28−## Examples
29−
30−```
31−~zod:dojo> =foo :gate a/@
32− :pin :name(b 1)
33− :pin :name(c 2)
34− :(add a b c)
35−~zod:dojo> (foo 5)
36−8
37−```
38−
39−```
40−~zod:dojo> =foo |= a/@
41− =+ b=1
42− =+ c=2
43− :(add a b c)
44−~zod:dojo> (foo 5)
45−8
46−```
docs/hoon/twig/tis-flow/sem-rev.mddeleted−43
@@ -1,43 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 7
4−---
5−
6−# `:rev =; "tissem"`
7−
8−`{$rev p/taco q/seed r/seed}`: combine a named and/or typed noun with the
9−subject, inverted.
10−
11−## Expands to
12−
13−```
14−:var(p r q)
15−```
16−
17−```
18−=/(p r q)
19−```
20−
21−## Syntax
22−
23−Regular: *3-fixed*.
24−
25−## Examples
26−
27−```
28−~zod:dojo> =foo :gate a/@
29− :var b 1
30− :rev c/@ :(add a b c)
31− 2
32−~zod:dojo> (foo 5)
33−8
34−```
35−
36−```
37−~zod:dojo> =foo |= a/@
38− =/ b 1
39− =; c/@ :(add a b c)
40− 2
41−~zod:dojo> (foo 5)
42−8
43−```
docs/hoon/twig/tis-flow/sig-tow.mddeleted−50
@@ -1,50 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 12
4−---
5−
6−# `:tow =~ "tissig"`
7−
8−`{$tow p/(list twig)}`: compose many twigs.
9−
10−## Produces
11−
12−The product of the chain composition.
13−
14−## Syntax
15−
16−Regular: *running*.
17−
18−## Examples
19−
20−```
21−~zod:dojo> =foo :new n/@
22− :rap :tow increment
23− increment
24− increment
25− n
26− ==
27− :core
28− ++ increment
29− :loop
30− ..increment(n +(n))
31− --
32−~zod:dojo> foo
33−3
34−```
35−
36−```
37−~zod:dojo> =foo =| n/@
38− =< =~ increment
39− increment
40− increment
41− n
42− ==
43− |%
44− ++ increment
45− |-
46− ..increment(n +(n))
47− --
48−~zod:dojo> foo
49−3
50−```
docs/hoon/twig/wut-test.mddeleted−31
@@ -1,31 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 8
4−---
5−
6−# Test, `?` ("wut")
7−
8−Hoon has the usual branches and logical tests. For pattern
9−matching, it also has a `$fits` twig that tests whether a value
10−matches the icon of a mold. And it has branch inference,
11−learning from `$fits` tests in the condition of `:if` twigs.
12−
13−## Overview
14−
15−All `?` runes expand to `$if` (`?:`) and/or `$fits` (`?=`).
16−
17−If the condition of an `$if` is a `$fits`, *and* the `$fits` is
18−testing a leg of the subject, the compiler specializes the subject
19−span for the branches of the `$if`. Branch inference also works
20−for twigs which expand to `$if`.
21−
22−The test does not have to be a single `$fits`; the compiler can
23−analyze arbitrary boolean logic (`$and`, `$or`, `$not`) with full
24−short-circuiting. Equality tests (`=`) are *not* analyzed.
25−
26−If the compiler detects that the branch is degenerate (only one
27−side is taken), it fails with an error.
28−
29−## Twigs
30−
31−<list dataPreview="true" className="runes"></list>
docs/hoon/twig/wut-test/bar-or.mddeleted−54
@@ -1,54 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 9
4−---
5−
6−# `:or ?| "wutbar"`
7−
8−`{$or p/(list seed)}`: logical or.
9−
10−## Expands to
11−
12−*Pseudocode*, `a`, `b`, `c`, ... as elements of `p`
13−
14−```
15−:if(a & :if(b & :if(c & :if(... :if(z & |)))))
16−```
17−
18−### Compiler macro
19−
20−```
21−:loop
22−:ifno p
23− |
24−:if i.p
25− &
26−:moar(p t.p)
27−```
28−
29−```
30−|-
31−?~ p
32− |
33−?: i.p
34− &
35−$(p t.p)
36−```
37−
38−## Syntax
39−
40−Regular: *running*.
41−
42−Irregular: `|(foo bar baz)` is `?|(foo bar baz)`.
43−
44−## Examples
45−
46−```
47−~zod:dojo> :or(=(6 42) =(42 42))
48−%.y
49−```
50−
51−```
52−~zod:dojo> |(=(6 42) =(42 42))
53−%.y
54−```
docs/hoon/twig/wut-test/dot-lest.mddeleted−57
@@ -1,57 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 2
4−---
5−
6−# `:lest ?. "wutdot"`
7−
8−`{$lest p/seed q/seed r/seed}`: branch on a boolean test, inverted.
9−
10−## Expands to
11−
12−```
13−:if p
14− r
15−q
16−```
17−
18−```
19−?:(p r q)
20−```
21−
22−## Syntax
23−
24−Regular: *3-fixed*.
25−
26−## Discussion
27−
28−As usual with inverted forms, use `:lest` when the positive
29−twig of an `:if` is much heavier than the negative twig.
30−
31−## Examples
32−
33−```
34−~zod:dojo> :lest((gth 1 2) 3 4)
35−3
36−~zod:dojo> :lest(:fits(%a 'a') %not-a %yup)
37−%yup
38−~zod:dojo> :lest %.y
39− 'this false case is less heavy than the true case'
40− :if =(2 3)
41− 'two not equal to 3'
42− 'but see how \'r is much heavier than \'q?'
43−'but see how \'r is much heavier than \'q?'
44−```
45−
46−```
47−~zod:dojo> ?.((gth 1 2) 3 4)
48−3
49−~zod:dojo> ?.(?=(%a 'a') %not-a %yup)
50−%yup
51−~zod:dojo> ?. %.y
52− 'this false case is less heavy than the true case'
53− ?: =(2 3)
54− 'two not equal to 3'
55− 'but see how \'r is much heavier than \'q?'
56−'but see how \'r is much heavier than \'q?'
57−```
docs/hoon/twig/wut-test/lus-deft.mddeleted−79
@@ -1,79 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 13
4−---
5−
6−# `:deft ?+ "wutlus"`
7−
8−`{$case p/wing q/seed r/(list (pair moss seed))}`: switch against
9−a union, with a default.
10−
11−## Expands to
12−
13−*Pseudocode*, `a`, `b`, `c`, ... as elements of `r`
14−
15−```
16−:if :fits(p.a) q.a
17−:if :fits(p.b) q.b
18−:if :fits(p.c) q.c
19−...
20−q
21−```
22−
23−### Compiler macro
24−
25−```
26−:loop
27−:ifno r
28− q
29−:if :fits(p.i.r p)
30− q.i.r
31−:moar(r t.r)
32−```
33−
34−```
35−|-
36−?. r
37− q
38−?: ?=(p.i.r p)
39− q.i.r
40−$(r t.r)
41−```
42−
43−## Syntax
44−
45−Regular: *2-fixed*, then *jogging*.
46−
47−## Discussion
48−
49−An extra case will throw `mint-vain`. A lost case defaults.
50−
51−## Examples
52−
53−```
54−~zod:dojo> =cor :gate vat/?($a $b)
55− :deft vat 240
56− $a 20
57− $b 42
58− ==
59−~zod:dojo> (cor %a)
60−20
61−~zod:dojo> (cor %b)
62−42
63−~zod:dojo> (cor %c)
64−240
65−```
66−
67−```
68−~zod:dojo> =cor |= vat/?($a $b)
69− ?+ vat 240
70− $a 20
71− $b 42
72− ==
73−~zod:dojo> (cor %a)
74−20
75−~zod:dojo> (cor %b)
76−42
77−~zod:dojo> (cor %c)
78−240
79−```
docs/hoon/twig/wut-test/pam-and.mddeleted−54
@@ -1,54 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 8
4−---
5−
6−# `:and ?& "wutpam"`
7−
8−`{$and p/(list seed)}`: logical and.
9−
10−## Expands to
11−
12−*Pseudocode*, `a`, `b`, `c`, ... as elements of `p`
13−
14−```
15−:lest(a | :lest(b | :lest(c | :lest(... :lest(z | &)))))
16−```
17−
18−### Compiler macro
19−
20−```
21−:loop
22−:ifno p
23− &
24−:lest i.p
25− |
26−:moar(p t.p)
27−```
28−
29−```
30−|-
31−?~ p
32− &
33−?. i.p
34− |
35−$(p t.p)
36−```
37−
38−## Syntax
39−
40−Regular: *running*.
41−
42−Irregular: `&(foo bar baz)` is `?&(foo bar baz)`.
43−
44−## Examples
45−
46−```
47−~zod:dojo> :and(=(6 6) =(42 42))
48−%.y
49−```
50−
51−```
52−~zod:dojo> &(=(6 6) =(42 42))
53−%.y
54−```
docs/hoon/twig/wut-test/sig-ifno.mddeleted−44
@@ -1,44 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 3
4−---
5−
6−# `:ifno ?~ "wutsig"`
7−
8−`{$ifno p/wing q/seed r/seed}`: branch on whether a wing
9−of the subject is null.
10−
11−## Expands to
12−
13−```
14−:if :fits($~ p)
15− q
16−r
17−```
18−
19−```
20−?:(?=($~ p) q r)
21−```
22−
23−## Syntax
24−
25−Regular: *3-fixed*.
26−
27−## Discussion
28−
29−It's bad style to use `:ifno` to test for any zero atom. Use it
30−only for a true null, `~`.
31−
32−## Examples
33−
34−```
35−~zod:dojo> =foo ""
36−~zod:dojo> :ifno(foo 1 2)
37−1
38−```
39−
40−```
41−~zod:dojo> =foo ""
42−~zod:dojo> ?~(foo 1 2)
43−1
44−```
docs/hoon/twig/zap-wild/gar-wrap.mddeleted−33
@@ -1,33 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 2
4−---
5−
6−# `:wrap !> "zapgar"`
7−
8−`{$wrap p/seed}`: wrap a noun in its span.
9−
10−## Produces
11−
12−A cell whose tail is `p`, and whose head is the static span of p.
13−
14−## Syntax
15−
16−Regular: *1-fixed*.
17−
18−## Discussion
19−
20−In Hoon, dynamic type is static type compiled at runtime. This
21−span-noun cell is generally called a `vase`.
22−
23−## Examples
24−
25−```
26−~zod:dojo> :wrap(1)
27−[p=#t/@ud q=1]
28−```
29−
30−```
31−~zod:dojo> !>(1)
32−[p=#t/@ud q=1]
33−```
docs/hoon/twig/zap-wild/zap-fail.mddeleted−32
@@ -1,32 +0,0 @@
1−---
2−navhome: /docs/
3−sort: 1
4−---
5−
6−# `:fail !! "zapzap"`
7−
8−`{$fail $~}`: crash.
9−
10−## Produces
11−
12−Nothing. Always crashes, with span `%void`.
13−
14−## Syntax
15−
16−`!!`
17−
18−## Discussion
19−
20−`%void` nests in every other span, so you can stub out anything with `!!`.
21−
22−## Examples
23−
24−```
25−~zod:dojo> :fail
26−! exit
27−```
28−
29−```
30−~zod:dojo> !!
31−! exit
32−```
docs/nock.md+1−1
@@ -7,6 +7,6 @@ title: Nock
77
88# Nock
99
10−Nock is our nano-VM. If you're into combinators or want to understand the foundation of Urbit, dive in.
10+Nock is our nano-VM. If you want to understand the foundation of Urbit, dive in.
1111
1212<list/>
docs/byte.md → docs/urbyte.mdrenamed

The content is the same.

docs/byte/0.md → docs/urbyte/0.mdrenamed

The content is the same.

docs/byte/1.md → docs/urbyte/1.mdrenamed

The content is the same.

docs/byte/2.md → docs/urbyte/2.mdrenamed+6−7
@@ -143,8 +143,6 @@ which is its address. The root of the tree is `1`. If the
143143address of a cell is `n`, the address of its head is `2n` and the
144144address of its tail is `2n+1`.
145145
146−
147−
148146A picture might help:
149147```
150148 1
@@ -365,15 +363,16 @@ from "two or more spaces."
365363 @ud
36636442
367365
368−> ? :per a x
366+> ? => a x
369367 @ud
37036842
371369
372−> =b :per a :core ++ foo x ++ bar [q.y foo] --
370+> =b => a |% ++ foo x ++ bar [q.y foo] --
373371```
374372
375373We're seeing some Hoon regular forms for the first time. `x:a`
376−turns out to be an irregular relative of the regular `:per` form.
374+turns out to be an irregular relative of the regular `=>`
375+(["tisgar"](../../hoon/rune/tis/gar)) form.
377376
378377We'll get more into syntax in a later Urbyte. If some of these
379378examples seem syntactically a little funky, this isn't usually
@@ -381,8 +380,8 @@ way we'd do them in "real life." We don't normally write cores
381380on a single command line. In a file this would be:
382381
383382```
384− :per a
385− :core
383+ => a
384+ |%
386385 ++ foo x
387386 ++ bar [q.y foo]
388387 --