on master help sign in
update dot, zap tis

- add zappat to zap and update glossary.js - re-restructure dot

commit1948a55fdc8e4bee68a1c3515c972a3b50964f3f authorTinnus Napbus <admin@tinnus-napbus.xyz> dateSun 3 Apr 2022, 22:57 (5 years ago) parentf604b7e
4 files changed+1008−371
content/docs/hoon/reference/rune/dot.md+74−70 content/docs/hoon/reference/rune/tis.md+613−186 content/docs/hoon/reference/rune/zap.md+314−115 lib/glossary.js+7
content/docs/hoon/reference/rune/dot.md+74−70
@@ -11,17 +11,7 @@ Anything Nock can do, Hoon can do also. These runes are used for carrying out No
1111
1212Load from the Arvo namespace (scry) with a fake Nock instruction: Nock 12.
1313
14−#### AST
15−
16−```hoon
17−[%dtkt p=spec q=hoon]
18−```
19−
20−#### Produces
21−
22−The noun `q`, cast to the type `p`.
23−
24−#### Regular syntax
14+#### Syntax
2515
2616Two arguments, with the second optionally split into an arbitrary number of
2717elements.
@@ -32,27 +22,37 @@ with a `==`. Note also that the `==` does not make the arguments into a list as
3222you might expect, so `q` must be explicitly null-terminated if its elements are
3323specified separately.
3424
35−Tall-form:
25+Tall form:
3626
3727```hoon
3828.^ p
39− q-1
40− q-2
41− q-3
42− q-n
29+ q1
30+ q2
31+ q3
32+ qn
4333==
4434```
4535
46−Wide-form:
36+Wide form:
4737
4838```hoon
49−.^(p q-1 q-2)
39+.^(p q1 q2)
5040```
5141
52−#### Irregular syntax
42+Irregular form:
5343
5444None.
5545
46+#### AST
47+
48+```hoon
49+[%dtkt p=spec q=hoon]
50+```
51+
52+#### Produces
53+
54+The noun `q`, cast to the type `p`.
55+
5656#### Discussion
5757
5858Nock has no `12` instruction! But the virtual Nock
@@ -120,38 +120,38 @@ You can modify the time of the file listing quite simply and ask for a listing f
120120
121121Increment an atom with Nock `4`.
122122
123−#### AST
124−
125−```hoon
126−[%dtls p=hoon]
127−```
128−
129−#### Produces
130−
131−`p` plus `1` if `p` is an atom; otherwise, crashes. The product atom has no aura.
132−
133−#### Regular syntax
123+#### Syntax
134124
135125One argument, fixed.
136126
137−Tall-form:
127+Tall form:
138128
139129```hoon
140130.+ p
141131```
142132
143−Wide-form:
133+Wide form:
144134
145135```hoon
146136.+(p)
147137```
148138
149−#### Irregular syntax
139+Irregular form:
150140
151141```hoon
152142+(p)
153143```
154144
145+#### AST
146+
147+```hoon
148+[%dtls p=hoon]
149+```
150+
151+#### Produces
152+
153+`p` plus `1` if `p` is an atom; otherwise, crashes. The product atom has no aura.
154+
155155#### Examples
156156
157157```
@@ -174,33 +174,37 @@ nest-fail
174174
175175Evaluate with Nock `2`.
176176
177−#### AST
178−
179−```hoon
180−[%dttr p=hoon q=hoon]
181−```
182−
183177#### Produces
184178
185179Nock of formula `q` and subject `p`, with type `%noun`.
186180
187−#### Regular syntax
181+#### Syntax
188182
189183Two arguments, fixed.
190184
191−Tall-form:
185+Tall form:
192186
193187```hoon
194188.* p
195189q
196190```
197191
198−Wide-form:
192+Wide form:
199193
200194```hoon
201195.*(p q)
202196```
203197
198+Irregular form:
199+
200+None.
201+
202+#### AST
203+
204+```hoon
205+[%dttr p=hoon q=hoon]
206+```
207+
204208#### Discussion
205209
206210`.*(p q)` is used to run Nock formula `q` on the subject `p` from within Hoon.
@@ -238,39 +242,39 @@ therefore possible to use Hoon as a typeless language.
238242
239243Test for equality with Nock `5`.
240244
241−#### AST
242−
243−```hoon
244−[%dtts p=hoon q=hoon]
245−```
246−
247−#### Produces
248−
249−`%.y` if `p` equals `q`; otherwise `%.n`.
250−
251−#### Regular syntax
245+#### Syntax
252246
253247Two arguments, fixed.
254248
255−Tall-form:
249+Tall form:
256250
257251```hoon
258252.= p
259253q
260254```
261255
262−Wide-form:
256+Wide form:
263257
264258```hoon
265259.=(p q)
266260```
267261
268−#### Irregular syntax
262+Irregular form:
269263
270264```hoon
271265=(p q)
272266```
273267
268+#### AST
269+
270+```hoon
271+[%dtts p=hoon q=hoon]
272+```
273+
274+#### Produces
275+
276+`%.y` if `p` equals `q`; otherwise `%.n`.
277+
274278#### Discussion
275279
276280Like Nock equality, `.=` ("dottis") tests whether two nouns are the same,
@@ -304,36 +308,36 @@ nouns. (Comparing large duplicates is a common cause of performance bugs.)
304308
305309Test for cell or atom with Nock `3`.
306310
307−#### AST
308−
309−```hoon
310−[%dtwt p=hoon]
311−```
312−
313−#### Produces
314−
315−`%.y` if `p` is a cell; otherwise `%.n`.
316−
317−#### Regular syntax
311+#### Syntax
318312
319313One argument, fixed.
320314
321−Tall-form:
315+Tall form:
322316
323317```hoon
324318.? p
325319```
326320
327−Wide-form:
321+Wide form:
328322
329323```hoon
330324.?(p)
331325```
332326
333−#### Irregular syntax
327+Irregular form:
334328
335329None.
336330
331+#### AST
332+
333+```hoon
334+[%dtwt p=hoon]
335+```
336+
337+#### Produces
338+
339+`%.y` if `p` is a cell; otherwise `%.n`.
340+
337341#### Examples
338342
339343```
content/docs/hoon/reference/rune/tis.md+613−186
@@ -4,127 +4,254 @@ weight = 5
44template = "doc.html"
55+++
66
7−These runes modify the subject. (Or more precisely, they
7+These runes modify the subject. (Or more precisely, they
88evaluate at least one of their subexpressions with a modified subject.)
99
1010## Overview
1111
12−Hoon doesn't have variables in the ordinary sense. If you want to bind a name
12+Hoon doesn't have variables in the ordinary sense. If you want to bind a name
1313to a value, e.g., `a` to `12`, you do so by pinning `12` to the subject and
14−associating the name with it. This sort of operation is done with the `=`
14+associating the name with it. This sort of operation is done with the `=`
1515family of runes.
1616
17−Let's say you have some old subject `p`. To 'pin' a value to the head means to
18−modify the subject by repacing it with a cell of `[new-value p]`. The head of
19−the cell is the new value. So to pin `12` with the face `a` the new subject
17+Let's say you have some old subject `p`. To 'pin' a value to the head means to
18+modify the subject by repacing it with a cell of `[new-value p]`. The head of
19+the cell is the new value. So to pin `12` with the face `a` the new subject
2020would be: `[a=12 p]`.
2121
2222Of course there are many variations on ways to modify the subject, useful for
23−different situations. Hence the whole family of `=` runes.
23+different situations. Hence the whole family of `=` runes.
2424
25−## Runes
25+---
2626
27−### `=>` "tisgar"
27+## `=>` "tisgar"
2828
29−`[%tsgr p=hoon q=hoon]`: compose two expressions.
29+Compose two expressions.
3030
31−##### Produces
31+#### Syntax
3232
33−the product of `q`, with the product of `p` taken as the subject.
33+Two arguments, fixed.
3434
35−##### Syntax
35+Tall form:
3636
37−Regular: **2-fixed**.
37+```hoon
38+=> p
39+q
40+```
3841
39−##### Examples
42+Wide form:
43+
44+```hoon
45+=>(p q)
46+```
47+
48+Irregular form:
49+
50+None.
51+
52+#### AST
53+
54+```hoon
55+[%tsgr p=hoon q=hoon]
56+```
57+
58+#### Produces
59+
60+the product of `q`, with the product of `p` taken as the subject.
61+
62+#### Examples
4063
4164```
4265> =>([a=1 b=2 c=3] b)
43662
4467
68+> => 9 .
69+9
70+
4571> =>((add 2 4) [. .])
4672[6 6]
73+
74+> =>
75+ |%
76+ ++ foo
77+ |= [a=@ b=@]
78+ [b a]
79+ --
80+ (foo 42 27)
81+[27 42]
4782```
4883
49−### `=|` "tisbar"
84+---
85+
86+## `=|` "tisbar"
87+
88+Combine a default type value ("bunt value") with the subject.
89+
90+#### Syntax
91+
92+Two arguments, fixed.
93+
94+Tall form:
95+
96+```hoon
97+=| p
98+q
99+```
50100
101+Wide form:
51102
52−`[%tsbr p=spec q=hoon]`: combine a default type value with the subject.
103+```hoon
104+=|(p q)
105+```
106+
107+Irregular form:
108+
109+None.
110+
111+#### AST
112+
113+```hoon
114+[%tsbr p=spec q=hoon]
115+```
53116
54−##### Expands to
117+#### Expands to
55118
56119```hoon
57120=+(*p q)
58121```
59122
60−##### Syntax
123+#### Discussion
61124
62−Regular: **2-fixed**.
125+The default (or 'bunt') value of `p` is pinned to the head of the subject.
126+Usually `p` includes a name for ease of reference.
63127
64−##### Discussion
128+Speaking more loosely, `=|` usually "declares a variable" which is
129+"uninitialized," presumably because you'll set it in a loop or similar.
65130
66−The default (or 'bunt') value of `p` is pinned to the head of the subject. Usually `p` includes a name for ease of reference.
131+#### Examples
67132
68−Speaking more loosely, `=|` usually "declares a variable" which is "uninitialized," presumably because you'll set it in a loop or similar.
133+```
134+> =| a=@ud a
135+0
136+
137+> =| a=[@t @t @t] a
138+['' '' '']
139+```
140+
141+---
142+
143+## `=:` "tiscol"
69144
70−##### Examples
145+Change multiple legs in the subject.
71146
147+#### Syntax
148+
149+Two arguments: the first a variable number of pairs, the second is fixed.
150+
151+Tall form:
152+
153+```hoon
154+=: p1a p1b
155+ p2a p2b
156+ p3a p3b
157+ ==
158+q
72159```
73−~zod:dojo> =foo |= a=@
74− =| b=@
75− =- :(add a b c)
76− c=2
77−~zod:dojo> (foo 5)
78−7
160+
161+Wide form:
162+
163+```hoon
164+=:(p1a p1b, p2a p2b, p3a p3b q)
79165```
80166
81−### `=:` "tiscol"
167+Irregular form:
82168
83−`[%tscl p=(list (pair wing hoon)) q=hoon]`: change multiple legs in the subject.
169+None.
84170
85−##### Expands to
171+#### AST
86172
87173```hoon
88−=>(%_(. p) q)
174+[%tscl p=(list (pair wing hoon)) q=hoon]
89175```
90176
91−##### Syntax
177+#### Expands to
92178
93−Regular: **jogging**, then **1-fixed**.
179+```hoon
180+=>(%_(. p) q)
181+```
94182
95−##### Discussion
183+#### Discussion
96184
97185This rune is like `=.`, but for modifying the values of multiple legs of the subject.
98186
99−##### Examples
187+#### Examples
100188
101189```
102−~zod:dojo> =+ a=[b=1 c=2]
103− =: c.a 4
104− b.a 3
105− ==
106− a
190+> =+ a=[b=1 c=2]
191+ =: c.a 4
192+ b.a 3
193+ ==
194+ a
107195[b=3 c=4]
108196```
109197
110−### `=,` "tiscom"
198+---
199+
200+## `=,` "tiscom"
201+
202+Expose namespace.
203+
204+#### Syntax
205+
206+Two arguments, fixed.
207+
208+Tall form:
209+
210+```hoon
211+=, p
212+q
213+```
214+
215+Wide form:
216+
217+```hoon
218+=,(p q)
219+```
111220
112−`[%tscm p=hoon q=hoon]`: expose namespace
221+Irregular form:
113222
114−`p` evaluates to a noun with some namespace. From within `q` you may access `p`'s names without a wing path (i.e., you can use face `b` rather than `b.p`). This is especially useful for calling arms from an imported library core or for calling arms from a stdlib core repeatedly.
223+None.
115224
116−##### Syntax
225+#### AST
117226
118−Regular: **2-fixed**.
227+```hoon
228+[%tscm p=hoon q=hoon]
229+```
119230
120−##### Examples
231+#### Produces
232+
233+`p` evaluates to a noun with some namespace. From within `q` you may access
234+`p`'s names without a wing path (i.e., you can use face `b` rather than `b.p`).
235+
236+#### Discussion
237+
238+This is especially useful for calling arms from an imported library core or for
239+calling arms from a stdlib core repeatedly. For example, JSON reparsers like
240+`so:dejs:format` and `of:dejs:format` can be called as `so` and `of` after
241+doing:
242+
243+```hoon
244+=, dejs:format
245+```
246+
247+#### Examples
121248
122249With an imported core:
123250
124251```
125252> (sum -7 --7)
126253-find.sum
127−[crash message]
254+dojo: hoon expression failed
128255
129256> (sum:si -7 --7)
130257--0
@@ -142,26 +269,53 @@ With a dojo-defined face:
142269[2 4]
143270```
144271
145−### `=.` "tisdot"
272+---
273+
274+## `=.` "tisdot"
275+
276+Change one leg in the subject.
146277
147−`[%tsdt p=wing q=hoon r=hoon]`: change one leg in the subject.
278+#### Syntax
148279
149−##### Expands to
280+Three arguments, fixed.
281+
282+Tall form:
150283
151284```hoon
152−=>(%_(. p q) r)
285+=. p q
286+r
153287```
154288
155−##### Syntax
289+Wide form:
156290
157−Regular: **3-fixed**.
291+```hoon
292+=.(p q r)
293+```
158294
159−##### Discussion
295+Irregular form:
160296
161−Technically the `=.` rune doesn't change the subject. It creates
162−a new subject just like the old one except for a changed value at `p`. Note that the mutation uses [`%_` ("cencab")](/docs/hoon/reference/rune/cen#cencab), so the type at `p` doesn't change. Trying to change the value type results in a `nest-fail`.
297+None.
163298
164−##### Examples
299+#### AST
300+
301+```hoon
302+[%tsdt p=wing q=hoon r=hoon]
303+```
304+
305+#### Expands to
306+
307+```hoon
308+=>(%_(. p q) r)
309+```
310+
311+#### Discussion
312+
313+Technically the `=.` rune doesn't change the subject. It creates a new subject
314+just like the old one except for a changed value at `p`. Note that the mutation
315+uses [`%_` ("cencab")](/docs/hoon/reference/rune/cen#cencab), so the type at `p`
316+doesn't change. Trying to change the value type results in a `nest-fail`.
317+
318+#### Examples
165319
166320```
167321> =+ a=[b=1 c=2]
@@ -178,62 +332,117 @@ a new subject just like the old one except for a changed value at `p`. Note tha
178332nest-fail
179333```
180334
181−### `=-` "tishep"
335+---
182336
183−`[%tshp p=hoon q=hoon]`: combine a new noun with the subject, inverted.
337+## `=-` "tishep"
184338
185−##### Expands to
339+Combine a new noun with the subject, inverted.
340+
341+#### Syntax
342+
343+Two arguments, fixed.
344+
345+Tall form:
186346
187347```hoon
188−=>([q .] p)
348+=- p
349+q
350+```
351+
352+Wide form:
353+
354+```hoon
355+=-(p q)
189356```
190357
191−##### Syntax
358+Irregular form:
192359
193−Regular: **2-fixed**.
360+None.
194361
195−##### Discussion
362+#### AST
196363
197−`=-` is just like `=+` but its subexpressions are reversed. `=-` looks better than `=+` when the expression you're pinning to the subject is much smaller than the expression that uses it.
364+```hoon
365+[%tshp p=hoon q=hoon]
366+```
367+
368+#### Expands to
369+
370+```hoon
371+=>([q .] p)
372+```
373+
374+#### Discussion
375+
376+`=-` is just like `=+` but its subexpressions are reversed. `=-` looks better
377+than `=+` when the expression you're pinning to the subject is much smaller than
378+the expression that uses it.
198379
199−##### Examples
380+#### Examples
200381
201382```
202−~zod:dojo> =foo |= a=@
203− =+ b=1
204− =- (add a b c)
205− c=2
206−~zod:dojo> (foo 5)
383+> =foo |= a=@
384+ =+ b=1
385+ =- (add a b c)
386+ c=2
387+> (foo 5)
2073888
208389```
209390
210−### `=^` "tisket"
391+---
211392
212−`[%tskt p=skin q=wing r=hoon s=hoon]`: pin the head of a pair; change
213−a leg with the tail.
393+## `=^` "tisket"
214394
215−##### Expands to
395+Pin the head of a pair; change a leg with the tail.
396+
397+#### Syntax
398+
399+Four arguments, fixed.
400+
401+Tall form:
216402
217403```hoon
218−=/(p -.r =.(q +.r s))
404+=^ p q
405+ r
406+s
219407```
220408
221−##### Syntax
409+Wide form:
222410
223−Regular: **4-fixed**.
411+```hoon
412+=^(p q r s)
413+```
224414
225−##### Discussion
415+Irregular form:
226416
227−`p` is a new name (possibly with type annotation, e.g., `a=@`) of a value to be pinned to the subject. The value of `p` is the head of the product of `r`. `q` is given the value of the tail of `r`'s product. Then `s` is evaluated against this new subject.
417+None.
418+
419+#### AST
420+
421+```hoon
422+[%tskt p=skin q=wing r=hoon s=hoon]
423+```
424+
425+#### Expands to
426+
427+```hoon
428+=/(p -.r =.(q +.r s))
429+```
430+
431+#### Discussion
432+
433+`p` is a new name (possibly with type annotation, e.g., `a=@`) of a value to be
434+pinned to the subject. The value of `p` is the head of the product of `r`. `q`
435+is given the value of the tail of `r`'s product. Then `s` is evaluated against
436+this new subject.
228437
229438We generally use `=^` when we have a state machine with a function, `r`, that
230439produces a cell, whose head is a result and whose tail is a new
231−state. The head value is given a new name `p`, and the
440+state. The head value is given a new name `p`, and the
232441tail is stuffed back into wherever we stored the old state, `q`.
233442
234443This may also remind you of Haskell's State monad.
235444
236−##### Examples
445+#### Examples
237446
238447The `og` core is a stateful pseudo-random number generator.
239448We have to change the core state every time we generate a
@@ -247,114 +456,235 @@ random number, so we use `=^`:
247456[99 46]
248457```
249458
250−### `=<` "tisgal"
459+---
460+
461+## `=<` "tisgal"
251462
252−`[%tsgl p=hoon q=hoon]`: compose two expressions, inverted.
463+Compose two expressions, inverted.
253464
254−##### Expands to
465+#### Syntax
466+
467+Two arguments, fixed
468+
469+Tall form:
255470
256471```hoon
257−=>(q p)
472+=< p
473+q
258474```
259475
260−##### Syntax
476+Wide form:
261477
262−Regular: **2-fixed**.
478+```hoon
479+=<(p q)
480+```
263481
264−Irregular: `foo:baz` is `=<(foo baz)`.
482+Irregular form:
265483
266−##### Discussion
484+```hoon
485+p:q
486+```
487+
488+#### AST
489+
490+```hoon
491+[%tsgl p=hoon q=hoon]
492+```
493+
494+#### Expands to
495+
496+```hoon
497+=>(q p)
498+```
499+
500+#### Discussion
267501
268502`=<` is just `=>` backwards.
269503
270−##### Examples
504+#### Examples
271505
272506```
273−~zod:dojo> =<(b [a=1 b=2 c=3])
507+> =<(b [a=1 b=2 c=3])
2745082
275509
276−~zod:dojo> =< b
277− [a=1 b=2 c=3]
510+> =< b
511+ [a=1 b=2 c=3]
2785122
279513
280−~zod:dojo> b:[a=1 b=2 c=3]
514+> b:[a=1 b=2 c=3]
2815152
282516
283−~zod:dojo> [. .]:(add 2 4)
517+> [. .]:(add 2 4)
284518[6 6]
285519```
286520
287−### `=+` "tislus"
521+---
288522
523+## `=+` "tislus"
289524
290−`[%tsls p=hoon q=hoon]`: combine a new noun with the subject.
525+Combine a new noun with the subject.
291526
292−##### Expands to
527+#### Syntax
528+
529+Two arguments, fixed.
530+
531+Tall form:
293532
294533```hoon
295−=>([p .] q)
534+=+ p
535+q
296536```
297537
298−##### Syntax
538+Wide form:
299539
300−Regular: **2-fixed**.
540+```hoon
541+=+(p q)
542+```
543+
544+Irregular form:
545+
546+None.
547+
548+#### AST
549+
550+```hoon
551+[%tsls p=hoon q=hoon]
552+```
553+
554+#### Expands to
301555
302−##### Discussion
556+```hoon
557+=>([p .] q)
558+```
559+
560+#### Discussion
303561
304−The subject of the `=+` expression, call it `a`, becomes the cell `[p a]` for the evaluation of `q`. That is, `=+` 'pins a value', `p`, to the head of the subject.
562+The subject of the `=+` expression, call it `a`, becomes the cell `[p a]` for
563+the evaluation of `q`. That is, `=+` 'pins a value', `p`, to the head of the
564+subject.
305565
306566Loosely speaking, `=+` is the simplest way of "declaring a variable."
307567
308−##### Examples
568+#### Examples
569+
570+```
571+> =+ 42 -
572+42
573+
574+> =+ x=42 x
575+42
576+
577+> =+ [a='foo' b='bar'] a
578+'foo'
579+```
580+
581+---
582+
583+## `=;` "tismic"
309584
310−### `=;` "tismic"
585+Combine a named noun with the subject, possibly with type annotation; inverted
586+order.
311587
312−`[%tsmc p=skin q=hoon r=hoon]`: combine a named noun with the subject, possibly with type annotation; inverted order.
588+#### Syntax
313589
314−##### Expands to
590+Three arguments, fixed.
591+
592+Tall form:
315593
316594```hoon
317−=/(p r q)
595+=; p
596+ q
597+r
318598```
319599
320−##### Syntax
600+Wide form:
321601
322−Regular: **3-fixed**.
602+```hoon
603+=;(p q r)
604+```
323605
324−##### Discussion
606+Irregular form:
325607
326−`=;` is exactly like `=/` except that the order of its last two subexpressions is reversed.
608+None.
327609
328−##### Examples
610+#### AST
329611
612+```hoon
613+[%tsmc p=skin q=hoon r=hoon]
330614```
331−~zod:dojo> =foo |= a=@
332− =/ b 1
333− =; c=@ :(add a b c)
334− 2
335−~zod:dojo> (foo 5)
615+
616+#### Expands to
617+
618+```hoon
619+=/(p r q)
620+```
621+
622+#### Discussion
623+
624+`=;` is exactly like `=/` except that the order of its last two subexpressions
625+is reversed.
626+
627+#### Examples
628+
629+```
630+> =foo |= a=@
631+ =/ b 1
632+ =; c=@
633+ :(add a b c)
634+ 2
635+> (foo 5)
3366368
337637```
338638
339−### `=/` "tisfas"
639+---
640+
641+## `=/` "tisfas"
642+
643+Combine a named noun with the subject, possibly with type annotation.
644+
645+#### Syntax
646+
647+Three arguments, fixed.
648+
649+Tall form:
650+
651+```hoon
652+=/ p
653+ q
654+r
655+```
656+
657+Wide form:
658+
659+```hoon
660+=/(p q r)
661+```
662+
663+Irregular form:
340664
341−`[%tsfs p=skin q=hoon r=hoon]`: combine a named noun with the subject, possibly with type annotation.
665+None.
342666
343−##### Expands to
667+#### AST
344668
345−**if `p` is a name**, (e.g. `a`):
669+```hoon
670+[%tsfs p=skin q=hoon r=hoon]
671+```
672+
673+#### Expands to
674+
675+if `p` is a name, (e.g. `a`):
346676
347677```hoon
348678=+(^=(p q) r)
349679```
350680
351−**if `p` is a name with a type** (e.g., `a=@`):
681+if `p` is a name with a type (e.g., `a=@`):
352682
353683```hoon
354684=+(^-(p q) r)
355685```
356686
357−##### Desugaring
687+#### Desugaring
358688
359689```hoon
360690?@ p
@@ -364,76 +694,139 @@ Regular: **3-fixed**.
364694r
365695```
366696
367−##### Syntax
697+#### Discussion
368698
369−Regular: **3-fixed**.
699+`p` can be either a name or a `name=type`. If it's just a name, `=/` ("tisfas")
700+"declares a type-inferred variable." If it has a type, `=/` "declares a
701+type-checked variable."
370702
371−##### Discussion
703+#### Examples
372704
373−`p` can be either a name or a name=type. If it's just a name,
374−`=/` ("tisfas") "declares a type-inferred variable." If it has a type, `=/`
375−"declares a type-checked variable."
705+```
706+> =/ a=@t 'hello' a
707+'hello'
376708
377−##### Examples
709+> =/ x [1 2 3] x
710+[1 2 3]
378711
379−```
380−~zod:dojo> =foo |= a=@
381− =/ b 1
382− =/ c=@ 2
383− :(add a b c)
384−~zod:dojo> (foo 5)
712+> =foo |= a=@
713+ =/ b 1
714+ =/ c=@ 2
715+ :(add a b c)
716+> (foo 5)
3857178
386718```
387719
388−### `=~` "tissig"
720+---
389721
722+## `=~` "tissig"
390723
391−`[%tssg p=(list hoon)]`: compose many expressions.
724+Compose many expressions.
392725
393−##### Produces
726+#### Syntax
394727
395−The product of the chain composition.
728+Variable number of arguments.
396729
397−##### Syntax
730+Tall form:
398731
399−Regular: **running**.
732+```hoon
733+=~ p1
734+ p2
735+ p3
736+ pn
737+==
738+```
400739
401−##### Examples
740+Wide form:
402741
742+```hoon
743+=~(p1 p2 p3 pn)
744+```
745+
746+Irregular form:
747+
748+None.
749+
750+#### AST
751+
752+```hoon
753+[%tssg p=(list hoon)]
403754```
404−~zod:dojo> =~ [sub (mul 3 20) (add 10 20)]
755+
756+#### Produces
757+
758+The product of the chain composition.
759+
760+#### Examples
761+
762+```
763+> =~ 10
764+ [20 .]
765+ [30 .]
766+ [40 .]
767+ .
768+ ==
769+[40 30 20 10]
770+
771+> =~ [sub (mul 3 20) (add 10 20)]
405772 (sub +)
406773 +(.)
407774 ==
40877531
409776
410−~zod:dojo> =foo =| n=@
411− =< =~ increment
412− increment
413− increment
414− n
415− ==
416− |%
417− ++ increment
418− ..increment(n +(n))
419− --
420−~zod:dojo> foo
777+> =foo =| n=@
778+ =< =~ increment
779+ increment
780+ increment
781+ n
782+ ==
783+ |%
784+ ++ increment
785+ ..increment(n +(n))
786+ --
787+> foo
4217883
422789```
423790
424−### `=*` "tistar" {#tistar}
791+---
425792
426−`[%tstr p=term q=hoon r=hoon]`: define a deferred expression.
793+## `=*` "tistar" {#tistar}
427794
428−##### Produces
795+Define a deferred expression.
429796
430−`r`, compiled with a subject in which `p` is a deferred expression for `q`.
797+#### Syntax
798+
799+Three arguments, fixed.
800+
801+Tall form:
802+
803+```hoon
804+=* p
805+ q
806+r
807+```
808+
809+Wide form:
810+
811+```hoon
812+=*(p q r)
813+```
814+
815+Irregular form:
431816
432−##### Syntax
817+None.
433818
434−Regular: **3-fixed**.
819+#### AST
820+
821+```hoon
822+[%tstr p=term q=hoon r=hoon]
823+```
824+
825+#### Produces
826+
827+`r`, compiled with a subject in which `p` is a deferred expression for `q`.
435828
436−##### Discussion
829+#### Discussion
437830
438831`=*` assigns a name to an expression that will be evaluated in each place the
439832name is dereferenced. This allows you to "write" through it to the original
@@ -443,47 +836,81 @@ calculated every time you use `p`.
443836This rune has some similarities with macros, and some similarities with aliases,
444837but it is not really either.
445838
446−##### Examples
839+This rune is commonly used to give a Gall agent's state the name `state` like:
840+
841+```hoon
842+=* state -
843+```
844+
845+This lets you reference the whole `state` while also being able to reference its
846+individual elements like `foo` and `bar`, without having to do `foo.state`,
847+`bar.state`, etc.
848+
849+#### Examples
447850
448851```
449−~zod:dojo>
450− =+ a=1
451− =* b a
452− [a b]
852+> =+ a=1
853+ =* b a
854+ [a b]
453855[1 1]
454856
455−~zod:dojo>
456− =+ a=1
457− =* b a
458− =. a 2
459− [a b]
857+> =+ a=1
858+ =* b a
859+ =. a 2
860+ [a b]
460861[2 2]
461862```
462863
463−### `=?` "tiswut"
864+---
865+
866+## `=?` "tiswut"
867+
868+Conditionally change one leg in the subject.
869+
870+#### Syntax
464871
465−`[$tswt p=wing q=hoon r=hoon s=hoon]`: conditionally change one leg in the subject.
872+Four arguments, fixed.
466873
467−##### Expands to
874+Tall form:
468875
469876```hoon
470−=. p ?:(q r p)
877+=? p q
878+ r
471879s
472880```
473881
474−##### Syntax
882+Wide form:
883+
884+```hoon
885+=?(p q r s)
886+```
887+
888+Irregular form:
889+
890+None.
891+
892+#### AST
893+
894+```hoon
895+[%tswt p=wing q=hoon r=hoon s=hoon]
896+```
897+
898+#### Expands to
475899
476−Regular: **4-fixed**.
900+```hoon
901+=. p ?:(q r p)
902+s
903+```
477904
478−##### Discussion
905+#### Discussion
479906
480907Use `=?` to replace the value of leg `p` with `r` on condition `q`. As
481908usual, we are not actually mutating the subject, just creating
482−a new subject with a changed value. The change in value includes a
909+a new subject with a changed value. The change in value includes a
483910type check against the old subject; the type of `r` must nest under
484911the type of `p`.
485912
486−##### Examples
913+#### Examples
487914
488915```
489916> =a 12
content/docs/hoon/reference/rune/zap.md+314−115
@@ -5,167 +5,158 @@ template = "doc.html"
55aliases = ["docs/reference/hoon-expressions/rune/zap/"]
66+++
77
8−## Runes
8+## `!>` "zapgar"
99
10−### `!>` "zapgar"
10+Wrap a noun in its type (form a [`vase`](/docs/hoon/reference/stdlib/4o#vase)).
1111
12−`[%zpgr p=hoon]`: wrap a noun in its type.
12+#### Syntax
1313
14−##### Produces
14+One argument, fixed.
1515
16−A cell whose tail is the product of `p`, and whose head is the static type of `p`.
16+Tall form:
17+
18+```hoon
19+!> p
20+```
21+
22+Wide form:
23+
24+```hoon
25+!>(p)
26+```
27+
28+Irregular form:
29+
30+None.
31+
32+#### AST
1733
18−##### Syntax
34+```hoon
35+[%zpgr p=hoon]
36+```
37+
38+#### Produces
1939
20−Regular: **1-fixed**.
40+A cell whose tail is the product of `p`, and whose head is the static type of `p`.
2141
22−##### Discussion
42+#### Discussion
2343
24−In Hoon, a dynamic type is a static type compiled at runtime. This type-noun cell is generally called a `vase`.
44+In Hoon, a dynamic type is a static type compiled at runtime. This type-noun
45+cell is generally called a [`vase`](/docs/hoon/reference/stdlib/4o#vase).
2546
26−##### Examples
47+#### Examples
2748
2849```
2950> !>(1)
3051[#t/@ud q=1]
3152```
3253
33−If you want just the type value, use a 'type spear'. This is `-:!>`, i.e., the head of the cell produced by `!>`:
54+If you want just the type value, use a 'type spear'. This is `-:!>`, i.e., the
55+head of the cell produced by `!>`:
3456
3557```
3658> -:!>(1)
3759#t/@ud
3860```
3961
40−### `!<` "zapgal"
41−
42−`[%zpld p=spec q=hoon]`
62+---
4363
44−Takes a mold and a `vase` and dynamically checks that the type in the `vase`
45−matches the mold.
64+## `!<` "zapgal"
4665
47−##### Produces
66+Extracts a [`vase`](/docs/hoon/reference/stdlib/4o#vase) to the given mold if
67+its type nests.
4868
49−The value of `vase` typed with the type of the mold if possible, else a
50−`nest-fail`.
69+#### Syntax
5170
52−##### Syntax
71+Two arguments, fixed.
5372
54−Regular: **2-fixed**
55−
56−##### Discussion
57−
58−This is something like a partial inverse to the `!>` rune and can be used to extract
59−a typed value from a `vase`.
60−
61−##### Examples
73+Tall form:
6274
75+```hoon
76+!< p
77+q
6378```
64−> !< @ !> ~zod
65−0
6679
67−> !< @p !> 0
68−nest-fail
80+Wide form:
6981
70−> =m !> 0
71−> =n !> 1
72−> !< [@ @] (slop m n)
73−[0 1]
82+```hoon
83+!<(p q)
7484```
7585
76−### `!:` "zapcol"
77−
78−`[%dbug p=hoon]`: turn on stack trace
86+Irregular form:
7987
80−##### Produces
88+None.
8189
82−The product of `p` unless `p` crashes, in which case a stack trace is given.
83−
84−##### Syntax
85−
86−Regular: **1-fixed**.
90+#### AST
8791
8892```hoon
89−!: p=hoon
93+[%zpgl p=spec q=hoon]
9094```
9195
92−##### Discussion
96+#### Produces
97+
98+The value of vase `q` typed with the type of mold `p` if possible, else a
99+`nest-fail`.
100+
101+#### Discussion
93102
94−`!:` is used to turn on a debugging stack trace option for any code you have in `p`.
103+This is something like a partial inverse to the `!>` rune and can be used to
104+extract a typed value from a `vase`.
95105
96−##### Examples
106+#### Examples
97107
98108```
99−> ?:(=(0 1) 123 !!)
100−ford: %ride failed to execute:
109+> !< @ !> ~zod
110+0
101111
102−> !: ?:(=(0 1) 123 !!)
103−/~zod/base/~2018.10.15..19.50.06..74af:<[1 5].[1 22]>
104−/~zod/base/~2018.10.15..19.50.06..74af:<[1 19].[1 21]>
105−ford: %ride failed to execute:
112+> !< @p !> 0
113+nest-fail
114+
115+> !< tape !>("foobar")
116+"foobar"
106117```
107118
108−### `!.` "zapdot"
119+---
109120
110−Turn off stack trace for a subexpression `p`
121+## `!=` "zaptis"
111122
112−##### Produces
123+Make the Nock formula for a Hoon expression.
113124
114−The product of `p`. If `p` crashes, no stack trace entries are given for that code.
125+#### Syntax
115126
116−##### Syntax
127+One argument, fixed.
117128
118−Regular: **1-fixed**.
129+Tall form:
119130
120131```hoon
121−!. p=hoon
132+!= p
122133```
123134
124−`p` is any Hoon expression.
125−
126−##### Discussion
127−
128−`!.` is used to turn off a debugging stack trace option for any code you have in `p`. This rune can be embedded under a `!:` rune for inner loops of your code that you don't want or need to trace. This is especially useful if a trace overflows the stack.
129−
130−##### Examples
135+Wide form:
131136
137+```hoon
138+!=(p)
132139```
133−> %.(1 |=(a=@ ^-(@ ?:(=(a 10) !! $(a +(a))))))
134−ford: %ride failed to execute:
135140
136−> !: %.(1 |=(a=@ ^-(@ ?:(=(a 10) !! $(a +(a))))))
137−/~zod/base/~2018.10.15..20.01.21..6b0c:<[1 5].[1 49]>
138−/~zod/base/~2018.10.15..20.01.21..6b0c:<[1 17].[1 47]>
139−/~zod/base/~2018.10.15..20.01.21..6b0c:<[1 22].[1 46]>
140−/~zod/base/~2018.10.15..20.01.21..6b0c:<[1 36].[1 45]>
141−...skipping some lines...
142−/~zod/base/~2018.10.15..20.01.21..6b0c:<[1 17].[1 47]>
143−/~zod/base/~2018.10.15..20.01.21..6b0c:<[1 22].[1 46]>
144−/~zod/base/~2018.10.15..20.01.21..6b0c:<[1 33].[1 35]>
145−ford: %ride failed to execute:
141+Irregular form:
146142
147−> !: %.(1 !.(|=(a=@ ^-(@ ?:(=(a 10) !! $(a +(a)))))))
148−/~zod/base/~2018.10.15..20.01.35..0529:<[1 5].[1 53]>
149−ford: %ride failed to execute:
150−```
143+None.
151144
152−### `!=` "zaptis"
145+#### AST
153146
154−`[%zpts p=hoon]`: make the Nock formula for a Hoon expression.
147+```hoon
148+[%zpts p=hoon]
149+```
155150
156−##### Produces
151+#### Produces
157152
158153The Nock generated by `p`.
159154
160−##### Syntax
161−
162−Regular: **1-fixed**.
163−
164−##### Discussion
155+#### Discussion
165156
166157Don't confuse `!=` with a negation, `!`, followed by a test for equality, `=(10 11)`.
167158
168−##### Examples
159+#### Examples
169160
170161```
171162> !=(20)
@@ -188,53 +179,261 @@ Don't confuse the `!=` rune with:
188179%.n
189180```
190181
191−The syntax difference is that a test for equality takes two subexpressions, and the `!=` rune only one.
182+The syntax difference is that a test for equality takes two subexpressions, and
183+the `!=` rune only one.
192184
193−### `!?` "zapwut"
185+---
194186
195−`[%zpwt p=@ q=hoon]`: restrict Hoon version.
187+## `!?` "zapwut"
196188
197−##### Produces
189+Restrict Hoon version.
198190
199−`q`, if `p` is greater than or equal to the Hoon kelvin version.
200−(Versions count down; the current version is 140.)
191+#### Syntax
192+
193+Two arguments, fixed.
194+
195+Tall form:
196+
197+```hoon
198+!? p
199+q
200+```
201+
202+Wide form:
203+
204+```hoon
205+!?(p q)
206+```
207+
208+Irregular form:
201209
202−##### Syntax
210+None.
203211
204−Regular: **2-fixed**.
212+#### AST
205213
206−##### Examples
214+```hoon
215+[%zpwt p=$@(p=@ [p=@ q=@]) q=hoon]
216+```
217+
218+#### Produces
219+
220+When `p` is an atom:
221+
222+- `q` if `p` ≥ Hoon kelvin version, otherwise crash.
223+
224+When `p` is a cell:
225+
226+- `q`, if `p.p` ≥ Hoon kelvin version ≥ `q.p`, otherwise crash.
227+
228+(Versions count down; the current version is 140.)
229+
230+#### Examples
207231
208232```
209−> !?(264 (add 2 2))
233+> !? [142 140] (add 2 2)
2102344
211235
212−> !?(164 (add 2 2))
236+> !? 142 (add 2 2)
2132374
214238
215−> !?(64 (add 2 2))
239+> !? 64 (add 2 2)
216240! exit
217241```
218242
219−### `!!` "zapzap"
243+---
220244
221−`[%zpzp ~]`: crash.
245+## `!@` "zappat"
222246
223−##### Produces
247+Branch on whether a wing exists.
224248
225−Nothing. Always crashes, with type `%void`.
249+#### Syntax
226250
227−##### Syntax
251+Three arguments, fixed.
228252
229−`!!`
253+Tall form:
230254
231−##### Discussion
255+```hoon
256+!@ p
257+ q
258+r
259+```
260+
261+Wide form:
262+
263+```hoon
264+!@(p q r)
265+```
266+
267+Irregular form:
268+
269+None.
270+
271+#### AST
272+
273+```hoon
274+[%zppt p=(list wing) q=hoon r=hoon]
275+```
276+
277+#### Discussion
278+
279+`p` is a wing reference like `foo`, `bar.foo`, etc. If `p` exists, `q`. If `p`
280+does not exist, `r`. Essentially, this is like `?:` for wing existence.
281+
282+#### Examples
283+
284+```
285+> =foo 42
286+
287+> !@(foo 'exists' 'does not exist')
288+'exists'
289+
290+> !@(baz 'exists' 'does not exist')
291+'does not exist'
292+```
293+
294+---
295+
296+## `!!` "zapzap"
297+
298+Crash.
299+
300+#### Syntax
301+
302+No arguments.
303+
304+Tall & wide form:
305+
306+```hoon
307+!!
308+```
309+
310+Irregular form:
311+
312+None.
313+
314+#### AST
315+
316+```hoon
317+[%zpzp ~]
318+```
319+
320+#### Produces
321+
322+Nothing. Always crashes, with type `%void`.
323+
324+#### Discussion
232325
233326`%void` nests in every other type, so you can stub out anything with `!!`.
234327
235−##### Examples
328+#### Examples
236329
237330```
238331> !!
239−ford: build failed
332+dojo: hoon expression failed
333+```
334+
335+---
336+
337+## `!:` "zapcol"
338+
339+Turn on stack trace.
340+
341+#### Syntax
342+
343+One argument, fixed
344+
345+Tall form:
346+
347+```hoon
348+!: p
240349```
350+
351+Wide form:
352+
353+```hoon
354+!:(p)
355+```
356+
357+Irregular form:
358+
359+None.
360+
361+#### Produces
362+
363+The product of `p` unless `p` crashes, in which case a stack trace is given.
364+
365+#### Discussion
366+
367+`!:` is used to turn on a debugging stack trace option for any code you have in
368+`p`.
369+
370+#### Examples
371+
372+```
373+> ?:(=(0 1) 123 !!)
374+dojo: hoon expression failed
375+
376+> !: ?:(=(0 1) 123 !!)
377+/~zod/base/~2022.4.2..08.54.53..07d7:<[1 5].[1 22]>
378+/~zod/base/~2022.4.2..08.54.53..07d7:<[1 19].[1 21]>
379+dojo: hoon expression failed
380+```
381+
382+---
383+
384+## `!.` "zapdot"
385+
386+Turn off stack trace for a subexpression `p`
387+
388+#### Syntax
389+
390+One argument, fixed.
391+
392+Tall form:
393+
394+```hoon
395+!. p
396+```
397+
398+Wide form:
399+
400+```hoon
401+!.(p)
402+```
403+
404+Irregular form:
405+
406+None.
407+
408+#### Produces
409+
410+The product of `p`. If `p` crashes, no stack trace entries are given for that code.
411+
412+#### Discussion
413+
414+`!.` is used to turn off a debugging stack trace option for any code you have in
415+`p`. This rune can be embedded under a `!:` rune for inner loops of your code
416+that you don't want or need to trace. This is especially useful if a trace
417+overflows the stack.
418+
419+#### Examples
420+
421+```
422+> %.(1 |=(a=@ ^-(@ ?:(=(a 10) !! $(a +(a))))))
423+dojo: hoon expression failed
424+
425+> !: %.(1 |=(a=@ ^-(@ ?:(=(a 10) !! $(a +(a))))))
426+/~zod/base/~2022.4.2..08.56.45..5ecc:<[1 5].[1 49]>
427+/~zod/base/~2022.4.2..08.56.45..5ecc:<[1 17].[1 47]>
428+/~zod/base/~2022.4.2..08.56.45..5ecc:<[1 22].[1 46]>
429+...skipping some lines...
430+/~zod/base/~2022.4.2..08.56.45..5ecc:<[1 22].[1 46]>
431+/~zod/base/~2022.4.2..08.56.45..5ecc:<[1 33].[1 35]>
432+dojo: hoon expression failed
433+
434+> !: %.(1 !.(|=(a=@ ^-(@ ?:(=(a 10) !! $(a +(a)))))))
435+/~zod/base/~2022.4.2..08.57.07..d40b:<[1 5].[1 53]>
436+dojo: hoon expression failed
437+```
438+
439+---
lib/glossary.js+7
@@ -91,6 +91,13 @@ export const glossary = [
9191 slug: "/docs/hoon/reference/rune/zap/#-zapwut",
9292 desc: "<code>[%zpwt p=@ q=hoon]</code>: restrict Hoon version.",
9393 },
94+ {
95+ name: "zappat",
96+ symbol: "!@",
97+ usage: "wild",
98+ slug: "/docs/hoon/reference/rune/zap/#-zappat",
99+ desc: "<code>[%zppt p=(list wing) q=hoon r=hoon]</code>: branch on wing existence.",
100+ },
94101 {
95102 name: "zapzap",
96103 symbol: "!!",