on master help sign in
Merge pull request #1138 from tinnus-napbus/update-stdlib-1a-1b-1c-2a

update stdlib refs 1a, 1b, 1c & 2a

commit380644f3bf6da126d7fba2d90f3f67de3d7861f6 authortinnus-napbus <77721746+tinnus-napbus@users.noreply.github.com> dateSat 18 Sep 2021, 20:08 (5 years ago) parent6f9e703fb12936
6 files changed+1025−588
content/docs/hoon/reference/stdlib/1a.md+390−271 content/docs/hoon/reference/stdlib/1b.md+122−86 content/docs/hoon/reference/stdlib/1c.md+187−108 content/docs/hoon/reference/stdlib/2a.md+287−120 content/docs/hoon/reference/stdlib/table-of-contents.md+10−2 lib/glossary.js+29−1
content/docs/hoon/reference/stdlib/1a.md+390−271
@@ -23,40 +23,53 @@ An [`atom`](/docs/glossary/atom).
2323#### Source
2424
2525```hoon
26− ++ add
27− ~/ %add
28− |= [a=@ b=@]
29− ^- @
30− ?: =(0 a) b
31− $(a (dec a), b +(b))
26+++ add
27+ ~/ %add
28+ |= [a=@ b=@]
29+ ^- @
30+ ?: =(0 a) b
31+ $(a (dec a), b +(b))
3232```
3333
3434#### Examples
3535
3636```
37− > (add 2 2)
38− 4
37+> (add 2 2)
38+4
39+```
3940
40− > (add 1 1.000.000)
41− 1.000.001
41+```
42+> (add 1 1.000.000)
43+1.000.001
44+```
4245
43− > (add 1.333 (mul 2 2))
44− 1.337
46+```
47+> (add 1.333 (mul 2 2))
48+1.337
49+```
4550
46− > (add 'a' 4)
47− 101
51+```
52+> (add 'a' 4)
53+101
54+```
4855
49− > (add 'a' 'b')
50− 195
56+```
57+> (add 'a' 'b')
58+195
59+```
5160
52− > (add 0xc 0xf)
53− 27
61+```
62+> (add 0xc 0xf)
63+27
64+```
5465
55− > `@ux`(add 0xc 0xf)
56− 0x1b
66+```
67+> `@ux`(add 0xc 0xf)
68+0x1b
5769```
5870
5971---
72+
6073### `++dec`
6174
6275Decrement
@@ -74,40 +87,46 @@ An [`atom`](/docs/glossary/atom).
7487#### Source
7588
7689```hoon
77− ++ dec
78− ~/ %dec
79− |= a=@
80− ~| %decrement-underflow
81− ?< =(0 a)
82− =+ b=0
83− |- ^- @
84− ?: =(a +(b)) b
85− $(b +(b))
90+++ dec
91+ ~/ %dec
92+ |= a=@
93+ ~_ leaf+"decrement-underflow"
94+ ?< =(0 a)
95+ =+ b=0
96+ |- ^- @
97+ ?: =(a +(b)) b
98+ $(b +(b))
8699```
87100
88101#### Examples
89102
90103```
91− > (dec 7)
92− 6
93−
94− > (dec 0)
95− ! decrement-underflow
96− ! exit
104+> (dec 7)
105+6
106+```
97107
98− > (dec 'b')
99− 97
100− > `@t`(dec 'b')
101− 'a'
108+```
109+> (dec 0)
110+! decrement-underflow
111+! exit
112+```
102113
103− > (dec 0xc)
104− 11
105− > `@ux`(dec 0xc)
106− 0xb
114+```
115+> (dec 'b')
116+97
117+> `@t`(dec 'b')
118+'a'
107119```
108120
121+```
122+> (dec 0xc)
123+11
124+> `@ux`(dec 0xc)
125+0xb
126+```
109127
110128---
129+
111130### `++div`
112131
113132Divide
@@ -127,42 +146,51 @@ An [`atom`](/docs/glossary/atom).
127146#### Source
128147
129148```hoon
130− ++ div
131− ~/ %div
132− |: [a=`@`1 b=`@`1]
133− ^- @
134− ~_ leaf+"divide-by-zero"
135− ?< =(0 b)
136− =+ c=0
137− |-
138− ?: (lth a b) c
139− $(a (sub a b), c +(c))
149+++ div
150+ ~/ %div
151+ |: [a=`@`1 b=`@`1]
152+ ^- @
153+ ~_ leaf+"divide-by-zero"
154+ ?< =(0 b)
155+ =+ c=0
156+ |-
157+ ?: (lth a b) c
158+ $(a (sub a b), c +(c))
140159```
141160
142161#### Examples
143162
144163```
145− > (div 4 2)
146− 2
164+> (div 4 2)
165+2
166+```
147167
148− > (div 17 8)
149− 2
168+```
169+> (div 17 8)
170+2
171+```
150172
151− > (div 20 30)
152− 0
173+```
174+> (div 20 30)
175+0
176+```
153177
154− > (div 'ab' 'a')
155− 259
156− > `@`'ab'
157− 25.185
158− > `@`a
159− 97
178+```
179+> (div 'ab' 'a')
180+259
181+> `@`'ab'
182+25.185
183+> `@`a
184+97
185+```
160186
161− > (div 0x9f 0x29)
162− 6
187+```
188+> (div 0x9f 0x29)
189+6
163190```
164191
165192---
193+
166194### `++dvr`
167195
168196Divide with remainder
@@ -182,37 +210,46 @@ A cell of [`atoms`](/docs/glossary/atom).
182210#### Source
183211
184212```hoon
185− ++ dvr
186− ~/ %dvr
187− |= [a=@ b=@]
188− ^- [p=@ q=@]
189− [(div a b) (mod a b)]
213+++ dvr
214+ ~/ %dvr
215+ |= [a=@ b=@]
216+ ^- [p=@ q=@]
217+ [(div a b) (mod a b)]
190218```
191219
192220#### Examples
193221
194222```
195− > (dvr 17 8)
196− [p=2 q=1]
223+> (dvr 17 8)
224+[p=2 q=1]
225+```
197226
198− > (dvr 17 6)
199− [p=2 q=5]
227+```
228+> (dvr 17 6)
229+[p=2 q=5]
230+```
200231
201− > (dvr 18 6)
202− [p=3 q=0]
232+```
233+> (dvr 18 6)
234+[p=3 q=0]
235+```
203236
204− > (dvr 4 2)
205− [p=2 q=0]
237+```
238+> (dvr 4 2)
239+[p=2 q=0]
240+```
206241
207− > (dvr 'ab 'a')
208− [p=259 q=62]
209− > `@`'a'
210− 97
211− > `@`'ab'
212− 25.185
242+```
243+> (dvr 'ab 'a')
244+[p=259 q=62]
245+> `@`'a'
246+97
247+> `@`'ab'
248+25.185
213249```
214250
215251---
252+
216253### `++gte`
217254
218255Greater-than/equal
@@ -232,27 +269,32 @@ A flag.
232269#### Source
233270
234271```hoon
235− ++ gte
236− ~/ %gte
237− |= [a=@ b=@]
238− ^- ?
239− !(lth a b)
272+++ gte
273+ ~/ %gte
274+ |= [a=@ b=@]
275+ ^- ?
276+ !(lth a b)
240277```
241278
242279#### Examples
243280
244281```
245− > (gte 100 10)
246− %.y
282+> (gte 100 10)
283+%.y
284+```
247285
248− > (gte 4 4)
249− %.y
286+```
287+> (gte 4 4)
288+%.y
289+```
250290
251− > (gte 3 4)
252− %.n
291+```
292+> (gte 3 4)
293+%.n
253294```
254295
255296---
297+
256298### `++gth`
257299
258300Greater-than
@@ -272,28 +314,32 @@ A flag.
272314#### Source
273315
274316```hoon
275− ++ gth
276− ~/ %gth
277− |= [a=@ b=@]
278− ^- ?
279− !(lte a b)
317+++ gth
318+ ~/ %gth
319+ |= [a=@ b=@]
320+ ^- ?
321+ !(lte a b)
280322```
281323
282−
283324#### Examples
284325
285326```
286− > (gth 'd' 'c')
287− %.y
327+> (gth 'd' 'c')
328+%.y
329+```
288330
289− > (gth ~h1 ~m61)
290− %.n
331+```
332+> (gth ~h1 ~m61)
333+%.n
334+```
291335
292− > (gth 'steak' 'brisket')
293− %.n
336+```
337+> (gth 'steak' 'brisket')
338+%.n
294339```
295340
296341---
342+
297343### `++lte`
298344
299345Less-than/equal
@@ -313,44 +359,55 @@ A flag.
313359#### Source
314360
315361```hoon
316− ++ lte
317− ~/ %lte
318− |= [a=@ b=@]
319− |(=(a b) (lth a b))
362+++ lte
363+ ~/ %lte
364+ |= [a=@ b=@]
365+ |(=(a b) (lth a b))
320366```
321367
322368#### Examples
323369
324370```
325− > (lte 4 5)
326− %.y
327−
328− > (lte 5 4)
329− %.n
330−
331− > (lte 5 5)
332− %.y
371+> (lte 4 5)
372+%.y
373+```
333374
334− > (lte 0 0)
335− %.y
375+```
376+> (lte 5 4)
377+%.n
378+```
336379
380+```
381+> (lte 5 5)
382+%.y
383+```
337384
338− > (lte 'a' 'b')
339− %.y
340− > `@`'a'
341− 97
342− > `@`'b'
343− 98
385+```
386+> (lte 0 0)
387+%.y
388+```
344389
345− > (lte 'abraham' 'bob')
346− %.n
390+```
391+> (lte 'a' 'b')
392+%.y
393+> `@`'a'
394+97
395+> `@`'b'
396+98
397+```
347398
348− > (lte ~m61 ~h1)
349− %.n
399+```
400+> (lte 'abraham' 'bob')
401+%.n
350402```
351403
404+```
405+> (lte ~m61 ~h1)
406+%.n
407+```
352408
353409---
410+
354411### `++lth`
355412
356413Less-than
@@ -370,45 +427,56 @@ A flag.
370427#### Source
371428
372429```hoon
373− ++ lth
374− ~/ %lth
375− |= [a=@ b=@]
376− ^- ?
377− ?& !=(a b)
378− |-
379− ?| =(0 a)
380− ?& !=(0 b)
381− $(a (dec a), b (dec b))
382− == == ==
430+++ lth
431+ ~/ %lth
432+ |= [a=@ b=@]
433+ ^- ?
434+ ?& !=(a b)
435+ |-
436+ ?| =(0 a)
437+ ?& !=(0 b)
438+ $(a (dec a), b (dec b))
439+ == == ==
383440```
384441
385442#### Examples
386443
387444```
388− > (lth 4 5)
389− %.y
445+> (lth 4 5)
446+%.y
447+```
390448
391− > (lth 5 4)
392− %.n
449+```
450+> (lth 5 4)
451+%.n
452+```
393453
394− > (lth 5 5)
395− %.n
454+```
455+> (lth 5 5)
456+%.n
457+```
396458
397− > (lth 5 0)
398− %.n
459+```
460+> (lth 5 0)
461+%.n
462+```
399463
400− > (lth 'a' 'b')
401− %.y
402− > `@`'a'
403− 97
404− > `@`'b'
405− 98
464+```
465+> (lth 'a' 'b')
466+%.y
467+> `@`'a'
468+97
469+> `@`'b'
470+98
471+```
406472
407− > (lth 'abraham' 'bob')
408− %.n
473+```
474+> (lth 'abraham' 'bob')
475+%.n
409476```
410477
411478---
479+
412480### `++max`
413481
414482Maximum
@@ -428,43 +496,58 @@ An [`atom`](/docs/glossary/atom).
428496#### Source
429497
430498```hoon
431− ++ max
432− ~/ %max
433− |= [a=@ b=@]
434− ^- @
435− ?: (gth a b) a
436− b
499+++ max
500+ ~/ %max
501+ |= [a=@ b=@]
502+ ^- @
503+ ?: (gth a b) a
504+ b
437505```
438506
439507#### Examples
440508
441509```
442− > (max 10 100)
443− 100
510+> (max 10 100)
511+100
512+```
444513
445− > (max 10.443 9)
446− 10.443
514+```
515+> (max 10.443 9)
516+10.443
517+```
447518
448− > (max 1 1)
449− 1
519+```
520+> (max 1 1)
521+1
522+```
450523
451− > (max 'abraham' 'bob')
452− 30.787.873.400.840.801
524+```
525+> (max 'abraham' 'bob')
526+30.787.873.400.840.801
527+```
453528
454− > `@t`(max 'abraham' 'bob')
455− 'abraham'
529+```
530+> `@t`(max 'abraham' 'bob')
531+'abraham'
532+```
456533
457− > `@t`(max 'abraham' 'benjamin')
458− 'benjamin'
534+```
535+> `@t`(max 'abraham' 'benjamin')
536+'benjamin'
537+```
459538
460− > `@dr`(max ~m6 ~h1)
461− ~h1
539+```
540+> `@dr`(max ~m6 ~h1)
541+~h1
542+```
462543
463− >`@ux`(max 0xe1 0x1e)
464− 0xe1
544+```
545+>`@ux`(max 0xe1 0x1e)
546+0xe1
465547```
466548
467549---
550+
468551### `++min`
469552
470553Minimum
@@ -484,41 +567,53 @@ An [`atom`](/docs/glossary/atom).
484567#### Source
485568
486569```hoon
487− ++ min
488− ~/ %min
489− |= [a=@ b=@]
490− ^- @
491− ?: (lth a b) a
492− b
570+++ min
571+ ~/ %min
572+ |= [a=@ b=@]
573+ ^- @
574+ ?: (lth a b) a
575+ b
493576```
494577
495578#### Examples
496579
497580```
498− > (min 10 100)
499− 10
500−
501− > (min 10.443 9)
502− 9
581+> (min 10 100)
582+10
583+```
503584
504− > (min 1 1)
505− 1
585+```
586+> (min 10.443 9)
587+9
588+```
506589
507− > (min 'abraham' 'bob')
508− 6.451.042
590+```
591+> (min 1 1)
592+1
593+```
509594
510− > `@t`(min 'abraham' 'bob')
511− 'bob'
595+```
596+> (min 'abraham' 'bob')
597+6.451.042
598+```
512599
513− > `@t`(min 'abraham' 'benjamin')
514− 'abraham'
600+```
601+> `@t`(min 'abraham' 'bob')
602+'bob'
603+```
515604
516− > `@dr`(min ~m6 ~h1)
517− ~m6
605+```
606+> `@t`(min 'abraham' 'benjamin')
607+'abraham'
518608```
519609
610+```
611+> `@dr`(min ~m6 ~h1)
612+~m6
613+```
520614
521615---
616+
522617### `++mod`
523618
524619Modulus
@@ -538,38 +633,47 @@ An [`atom`](/docs/glossary/atom).
538633#### Source
539634
540635```hoon
541− ++ mod
542− ~/ %mod
543− |: [a=`@`1 b=`@`1]
544− ^- @
545− ?< =(0 b)
546− (sub a (mul b (div a b)))
636+++ mod
637+ ~/ %mod
638+ |: [a=`@`1 b=`@`1]
639+ ^- @
640+ ?< =(0 b)
641+ (sub a (mul b (div a b)))
547642```
548643
549644#### Examples
550645
551646```
552− > (mod 5 2)
553− 1
647+> (mod 5 2)
648+1
649+```
554650
555− > (mod 5 5)
556− 0
651+```
652+> (mod 5 5)
653+0
654+```
557655
558− > (mod 2 5)
559− 2
656+```
657+> (mod 2 5)
658+2
659+```
560660
561− > (mod 40 20)
562− 0
661+```
662+> (mod 40 20)
663+0
664+```
563665
564− > `@`'c'
565− 99
566− >`@`'a'
567− 97
568− > (mod 'c' 'a')
569− 2
666+```
667+> `@`'c'
668+99
669+>`@`'a'
670+97
671+> (mod 'c' 'a')
672+2
570673```
571674
572675---
676+
573677### `++mul`
574678
575679Multiply
@@ -589,38 +693,44 @@ An [`atom`](/docs/glossary/atom).
589693#### Source
590694
591695```hoon
592− ++ mul
593− ~/ %mul
594− |: [a=`@`1 b=`@`1]
595− ^- @
596− =+ c=0
597− |-
598− ?: =(0 a) c
599− $(a (dec a), c (add b c))
696+++ mul
697+ ~/ %mul
698+ |: [a=`@`1 b=`@`1]
699+ ^- @
700+ =+ c=0
701+ |-
702+ ?: =(0 a) c
703+ $(a (dec a), c (add b c))
600704```
601705
602706#### Examples
603707
604708```
605− > (mul 3 4)
606− 12
607−
608− > (mul 0 1)
609− 0
709+> (mul 3 4)
710+12
711+```
610712
611− > `@`'a'
612− 97
613− > `@`'b'
614− 98
615− > (mul 'a' 'b')
616− 9.506
713+```
714+> (mul 0 1)
715+0
716+```
617717
618− >`@ux`(mul 0x1f 0xe)
619− 0x1b2
718+```
719+> `@`'a'
720+97
721+> `@`'b'
722+98
723+> (mul 'a' 'b')
724+9.506
620725```
621726
727+```
728+>`@ux`(mul 0x1f 0xe)
729+0x1b2
730+```
622731
623732---
733+
624734### `++sub`
625735
626736Subtract
@@ -640,41 +750,50 @@ An [`atom`](/docs/glossary/atom).
640750#### Source
641751
642752```hoon
643− ++ sub
644− ~/ %sub
645− |= [a=@ b=@]
646− ~_ leaf+"subtract-underflow"
647− ^- @
648− ?: =(0 b) a
649− $(a (dec a), b (dec b))
753+++ sub
754+ ~/ %sub
755+ |= [a=@ b=@]
756+ ~_ leaf+"subtract-underflow"
757+ ^- @
758+ ?: =(0 b) a
759+ $(a (dec a), b (dec b))
650760```
651761
652−
653762#### Examples
654763
655764```
656− > (sub 10 5)
657− 5
765+> (sub 10 5)
766+5
767+```
658768
659− > (sub 243 44)
660− 199
769+```
770+> (sub 243 44)
771+199
772+```
661773
662− > (sub 5 0)
663− 5
774+```
775+> (sub 5 0)
776+5
777+```
664778
665− > (sub 0 5)
666− ! subtract-underflow
667− ! exit
779+```
780+> (sub 0 5)
781+! subtract-underflow
782+! exit
783+```
668784
669− > (sub 'c' 'a')
670− 2
671− > `@`'c'
672− 99
673− > `@`'a'
674− 97
785+```
786+> (sub 'c' 'a')
787+2
788+> `@`'c'
789+99
790+> `@`'a'
791+97
792+```
675793
676− > (sub 0x1f 0xe)
677− 17
678− > `@ux`(sub 0x1f 0xe)
679− 0x11
680−```
794+```
795+> (sub 0x1f 0xe)
796+17
797+> `@ux`(sub 0x1f 0xe)
798+0x11
799+```
content/docs/hoon/reference/stdlib/1b.md+122−86
@@ -15,7 +15,6 @@ Tests whether the tree address `a` is in the head or the tail of a [`noun`](/doc
1515Produces the constant [`atom`](/docs/glossary/atom) `%2` if it is within the head (subtree `+2`), or
1616the constant [`atom`](/docs/glossary/atom) `%3` if it is within the tail (subtree `+3`).
1717
18−
1918#### Accepts
2019
2120`a` is an [`atom`](/docs/glossary/atom).
@@ -27,45 +26,56 @@ A constant [`atom`](/docs/glossary/atom).
2726#### Source
2827
2928```hoon
30− ++ cap
31− ~/ %cap
32− |= a=@
33− ^- ?($2 $3)
34− ?- a
35− $2 %2
36− $3 %3
37− ?(%0 %1) !!
38− * $(a (div a 2))
39− ==
29+++ cap
30+ ~/ %cap
31+ |= a=@
32+ ^- ?(%2 %3)
33+ ?- a
34+ %2 %2
35+ %3 %3
36+ ?(%0 %1) !!
37+ * $(a (div a 2))
38+ ==
4039```
4140
4241#### Examples
4342
4443```
45− > (cap 4)
46− %2
44+> (cap 4)
45+%2
46+```
4747
48− > (cap 6)
49− %3
48+```
49+> (cap 6)
50+%3
51+```
5052
51− > (cap (add 10 9))
52− %2
53+```
54+> (cap (add 10 9))
55+%2
56+```
5357
54− > (cap 1) ::address '1' is in neither the head nor the tail
55− ! exit
58+```
59+> (cap 1) ::address '1' is in neither the head nor the tail
60+! exit
61+```
5662
57− > (cap 0x40))
58− %2
59− > `@`0x40
60− 64
63+```
64+> (cap 0x40))
65+%2
66+> `@`0x40
67+64
68+```
6169
62− > (cap 'a')
63− %3
64− > `@`'a'
65− 97
70+```
71+> (cap 'a')
72+%3
73+> `@`'a'
74+97
6675```
6776
6877---
78+
6979### `++mas`
7080
7181Address within head/tail
@@ -84,51 +94,66 @@ An [`atom`](/docs/glossary/atom).
8494#### Source
8595
8696```hoon
87− ++ mas
88− ~/ %mas
89− |= a=@
90− ^- @
91− ?- a
92− 1 !!
93− 2 1
94− 3 1
95− * (add (mod a 2) (mul $(a (div a 2)) 2))
96− ==
97+++ mas
98+ ~/ %mas
99+ |= a=@
100+ ^- @
101+ ?- a
102+ ?(%2 %3) 1
103+ ?(%0 %1) !!
104+ * (add (mod a 2) (mul $(a (div a 2)) 2))
105+ ==
97106```
98107
99108#### Examples
100109
101110```
102− > (mas 3)
103− 1
111+> (mas 3)
112+1
113+```
104114
105− > (mas 4)
106− 2
115+```
116+> (mas 4)
117+2
118+```
107119
108− > (mas 5)
109− 3
110− > (cap 5) ::`(cap a)` computes whether address `a` is in the head or the tail
111− %2
120+```
121+> (mas 5)
122+3
123+> (cap 5) ::`(cap a)` computes whether address `a` is in the head or the tail
124+%2
125+```
112126
113− > (mas 7)
114− 3
115− > (cap 7)
116− %3
127+```
128+> (mas 7)
129+3
130+> (cap 7)
131+%3
132+```
117133
118− > (mas 11)
119− 7
134+```
135+> (mas 11)
136+7
137+```
120138
121− > (mas (mas 11))
122− 3
139+```
140+> (mas (mas 11))
141+3
142+```
123143
124− > (cap (mas 6))
125− %3
144+```
145+> (cap (mas 6))
146+%3
147+```
126148
127− > (mas 0)
128− ! exit ::address `0` is in neither the head nor the tail
149+```
150+> (mas 0) ::address `0` is in neither the head nor the tail
151+! exit
152+```
129153
130− > (mas 1)
131− ! exit ::address `1` is in neither the head nor the tail
154+```
155+> (mas 1) ::address `1` is in neither the head nor the tail
156+! exit
132157```
133158
134159#### Discussion
@@ -166,6 +191,7 @@ Notice how the old values in the head (subtree `+2`) were not illustrated in
166191this case, because `+7` is within the tail (subtree `+3`).
167192
168193---
194+
169195### `++peg`
170196
171197Address within address
@@ -186,43 +212,54 @@ An [`atom`](/docs/glossary/atom).
186212#### Source
187213
188214```hoon
189− ++ peg
190− ~/ %peg
191− |= [a=@ b=@]
192− ?< =(0 a)
193− ^- @
194− ?- b
195− $1 a
196− $2 (mul a 2)
197− $3 +((mul a 2))
198− * (add (mod b 2) (mul $(b (div b 2)) 2))
199− ==
215+++ peg
216+ ~/ %peg
217+ |= [a=@ b=@]
218+ ?< =(0 a)
219+ ^- @
220+ ?- b
221+ %1 a
222+ %2 (mul a 2)
223+ %3 +((mul a 2))
224+ * (add (mod b 2) (mul $(b (div b 2)) 2))
225+ ==
200226```
201227
202228#### Examples
203229
204230```
205− > (peg 4 1)
206− 4
207−
208− > (peg 1 4)
209− 4
231+> (peg 4 1)
232+4
233+```
210234
211− > (peg 4 2)
212− 8
235+```
236+> (peg 1 4)
237+4
238+```
213239
214− > (peg 4 8)
215− 32
240+```
241+> (peg 4 2)
242+8
243+```
216244
217− > (peg 4 (4 2))
218− 32
245+```
246+> (peg 4 8)
247+32
248+```
219249
220− > (peg 8 45)
221− 269
250+```
251+> (peg 4 (4 2))
252+32
253+```
222254
223− > (cap (peg 4 2)) ::`(cap a)` computes whether address `a` is in the head or the tail
224− %2
255+```
256+> (peg 8 45)
257+269
258+```
225259
260+```
261+> (cap (peg 4 2)) ::`(cap a)` computes whether address `a` is in the head or the tail
262+%2
226263```
227264
228265#### Discussion
@@ -269,5 +306,4 @@ Notice how relative address `+4` is at the same position as absolute address
269306 (continues...)
270307```
271308
272−
273309---
content/docs/hoon/reference/stdlib/1c.md+187−108
@@ -110,27 +110,34 @@ See the [bit arithmetic](/docs/hoon/reference/stdlib/2c) section for operations
110110Mold of fork between two types
111111
112112A mold generator. Produces a discriminated fork between two types, defaulting to
113−`a`.
113+`this`.
114114
115115#### Source
116116
117− ++ each
118− |*([a=mold b=mold] $%([$| p=b] [$& p=a]))
119−
117+```hoon
118+++ each
119+ |$ [this that]
120+ $% [%| p=that]
121+ [%& p=this]
122+ ==
123+```
120124
121125#### Examples
122126
123127```
124− > ? *(each cord time)
125− ?({$.y p/@t} {$.n p/@da})
126− [%.y p='']
128+> ? *(each cord time)
129+ ?([%.y p=@t] [%.n p=@da])
130+[%.y p='']
131+```
127132
128− > ? *(each * tape)
129− ?({$.y p/*} {$.n p/""})
130− [%.y p=0]
133+```
134+> ? *(each * tape)
135+ ?([%.y p=*] [%.n p=""])
136+[%.y p=0]
131137```
132138
133139---
140+
134141### `++gate`
135142
136143Function
@@ -139,7 +146,6 @@ A [`core`](/docs/glossary/core) with one arm, `$`--the empty name--which transfo
139146product noun. If used dryly as a type, the subject must have a sample type of
140147`*`.
141148
142−
143149#### Source
144150
145151```hoon
@@ -150,16 +156,23 @@ product noun. If used dryly as a type, the subject must have a sample type of
150156#### Examples
151157
152158```
153− > ? gate
154− <1.rdl {* <31.ohr 1.jmk $143>}>
155− <1.rdl {* <31.ohr 1.jmk $143>}>
159+> ? gate
160+ <1.ddq [* <46.hgz 1.pnw %140>]>
161+<1.ddq [* <46.hgz 1.pnw %140>]>
162+```
156163
157− > (`gate`|=(a=* [a 'b']) 1)
158− [1 98]
164+```
165+> (`gate`|=(a=* [a 'b']) 1)
166+[1 98]
167+```
159168
160− > (`gate`|=(a=@ [a 'b']) 1)
161− ! nest-fail
162− ! exit
169+```
170+> (`gate`|=(a=@ [a 'b']) 1)
171+mint-nice
172+-need.@
173+-have.*
174+nest-fail
175+dojo: hoon expression failed
163176```
164177
165178#### Discussion
@@ -171,6 +184,7 @@ mathematical sense. Any `gate` normalizes to an iron `gate`.
171184See also: [`++lift`](/docs/hoon/reference/stdlib/2a#lift), [`++cork`](/docs/hoon/reference/stdlib/2n#cork)
172185
173186---
187+
174188### `++list`
175189
176190List
@@ -178,35 +192,42 @@ List
178192A mold generator. Generates a mold of a null-terminated list of a
179193homogenous type.
180194
181−
182195#### Source
183196
184197```hoon
185− ++ list
186− |*(a=mold $@($~ (lest a)))
198+++ list
199+ |$ [item]
200+ $@(~ [i=item t=(list item)])
187201```
188202
189203#### Examples
190204
191205```
192− > *(list)
193− ~
194−
195− > `(list @)`"abc"
196− ~[97 98 99]
206+> *(list)
207+~
208+```
197209
198− > (snag 0 "abc")
199− 'a'
210+```
211+> `(list @)`"abc"
212+~[97 98 99]
213+```
200214
201− > `(list @)`[1 2 'j' ~]
202− ~[1 2 106]
215+```
216+> (snag 0 "abc")
217+'a'
218+```
203219
204220```
221+> `(list @)`[1 2 'j' ~]
222+~[1 2 106]
223+```
224+
205225#### Discussion
206226
207227See also: [`++turn`](/docs/hoon/reference/stdlib/2b#turn), [`++snag`](/docs/hoon/reference/stdlib/2b#snag)
208228
209229---
230+
210231### `++lone`
211232
212233Face on mold
@@ -216,55 +237,67 @@ A mold generator. Puts face of `p` on the passed-in mold.
216237#### Source
217238
218239```hoon
219− ++ lone
220− |*(a=mold [p=a])
240+++ lone
241+ |$ [item]
242+ p=item
221243```
222244
223245#### Examples
224246
225247```
226− > ? *cord
227− @t
228− ''
229− > ? *(lone cord)
230− p/@t
231− p=''
248+> ? *cord
249+@t
250+''
251+```
252+
253+```
254+> ? *(lone cord)
255+ p=@t
256+p=''
257+```
258+
259+```
260+> ? *(lone @)
261+ p=@
262+p=0
263+```
232264
233− > ? *(lone @)
234− p/@
235− p=0
236− > ? *@
237− @
238− 0
265+```
266+> ? *@
267+ @
268+0
239269```
240270
241271---
272+
242273### `++pair`
243274
244275Mold of pair of types
245276
246277A mold generator. Produces a tuple of two of the types passed in.
247278
248−
249279#### Source
250280
251281```hoon
252− ++ pair
253− |*([a=mold b=mold] [p=a q=b])
282+++ pair
283+ |$ [head tail]
284+ [p=head q=tail]
254285```
255286
256287#### Examples
257288
258289```
259− > *(pair ? cord)
260− [p=%.y q='']
261−
262− > *(pair tape @)
263− [p="" q=0]
290+> *(pair ? cord)
291+[p=%.y q='']
292+```
264293
294+```
295+> *(pair tape @)
296+[p="" q=0]
265297```
266298
267299---
300+
268301### `++pole`
269302
270303Faceless [`list`](/docs/hoon/reference/stdlib/1c#list)
@@ -274,23 +307,25 @@ A mold generator. A [`list`](/docs/hoon/reference/stdlib/1c#list) without the fa
274307#### Source
275308
276309```hoon
277− ++ pole
278− |*(a=mold $@($~ [a (pole a)]))
310+++ pole
311+ |$ [item]
312+ $@(~ [item (pole item)])
279313```
280314
281−
282315#### Examples
283316
284317```
285− > =/(a "asdf" ?>(?=(^ a) `(lest @tD)`a))
286− [i='a' t=[i='s' t=[i='d' t=[i='f' t=~]]]]
287−
288− > `(pole char)`"asdf"
289− ['a' ['s' ['d' ['f' ~]]]]
318+> =/(a "asdf" ?>(?=(^ a) `(lest @tD)`a))
319+[i='a' t=[i='s' t=[i='d' t=[i='f' t=~]]]]
290320```
291321
322+```
323+> `(pole char)`"asdf"
324+['a' ['s' ['d' ['f' ~]]]]
325+```
292326
293327---
328+
294329### `++qual`
295330
296331Mold of 4-type tuple
@@ -300,43 +335,49 @@ A mold generator. Produces a tuple of four of the types passed in.
300335#### Source
301336
302337```hoon
303− ++ qual
304− |* [a=mold b=mold c=mold d=mold]
305− [p=a q=b r=c s=d]
338+++ qual
339+ |$ [first second third fourth]
340+ [p=first q=second r=third s=fourth]
306341```
307342
308343#### Examples
309344
310345```
311− > *(qual date time tape cord)
312− [p=[[a=%.y y=0] m=0 t=[d=0 h=0 m=0 s=0 f=~]] q=~292277024401-.1.1 r="" s='']
346+> *(qual date time tape cord)
347+[p=[[a=%.y y=0] m=0 t=[d=0 h=0 m=0 s=0 f=~]] q=~2000.1.1 r="" s='']
348+```
313349
314− > *(qual (list @) @u @ud @ux)
315− [p=~ q=0 r=0 s=0x0]
350+```
351+> *(qual (list @) @u @ud @ux)
352+[p=~ q=0 r=0 s=0x0]
316353```
317354
318355---
356+
319357### `++quip`
320358
321359Mold of pair of [`list`](/docs/hoon/reference/stdlib/1c#list) and type
322360
323−A mold generator. Produces a tuple of a [`list`](/docs/hoon/reference/stdlib/1c#list) of `a` and the mold of `b`.
361+A mold generator. Produces a tuple of a [`list`](/docs/hoon/reference/stdlib/1c#list) of `item` and the mold of `state`.
324362
325363#### Source
326364
327365```hoon
328− ++ quip
329− |*([a=mold b=mold] [(list a) b])
366+++ quip
367+ |$ [item state]
368+ [(list item) state]
330369```
331370
332371#### Examples
333372
334373```
335− > *(quip @ _'hi')
336− [~ 'hi']
374+> *(quip @ _'hi')
375+[~ 'hi']
376+```
337377
338− > `(quip @ @ux)`[[1 2 3 4 ~] 0x10]
339− [~[1 2 3 4] 0x10]
378+```
379+> `(quip @ @ux)`[[1 2 3 4 ~] 0x10]
380+[~[1 2 3 4] 0x10]
340381```
341382
342383#### Discussion
@@ -345,6 +386,32 @@ A common pattern in Hoon code is to return a `list` of changes, along with a
345386new state. You'll often see `quip` used in Gall apps.
346387
347388---
389+
390+### `++step`
391+
392+Atom size or offset, in [bloq](#bloq)s.
393+
394+#### Source
395+
396+```
397+++ step
398+ _`@u`1
399+```
400+
401+#### Examples
402+
403+```
404+> `step`0
405+0
406+```
407+
408+```
409+> `step`2
410+2
411+```
412+
413+---
414+
348415### `++trap`
349416
350417[`Core`](/docs/glossary/core) with one arm `$`
@@ -354,25 +421,30 @@ A trap is a [`core`](/docs/glossary/core) with one arm `$`.
354421#### Source
355422
356423```hoon
357− ++ trap
358− |*(a=mold _|?(*a))
424+++ trap
425+ |$ [product]
426+ _|?($:product)
359427```
360428
361429#### Examples
362430
363431```
364− > (*trap)
365− <1?dxy 1.oeg {a/<1|rbb {* <31.ohr 1.jmk $143>}> <31.ohr 1.jmk $143>}>
366−
367− > *(*trap)
368− 0
432+> (*trap)
433+<1?ruo 1.mhl [product=<1|xpg [* * *]> <46.hgz 1.pnw %140>]>
434+```
369435
370− > (|.(42))
371− 42
436+```
437+> *(*trap)
438+0
372439```
373440
441+```
442+> (|.(42))
443+42
444+```
374445
375446---
447+
376448### `++tree`
377449
378450Tree mold generator
@@ -383,19 +455,20 @@ left/right sub `tree` of the same type. Pretty-printed with `{}`.
383455#### Source
384456
385457```hoon
386− ++ tree
387− |*(a=mold $@($~ [n=a l=(tree a) r=(tree a)]))
458+++ tree
459+ |$ [node]
460+ $@(~ [n=node l=(tree node) r=(tree node)])
388461```
389462
390463#### Examples
391464
392465```
393− > `(tree [@ tape])`[[1 "hi"] [[2 "bye"] ~ ~] ~]
394− {[2 "bye"] [1 "hi"]}
466+> `(tree [@ tape])`[[1 "hi"] [[2 "bye"] ~ ~] ~]
467+{[2 "bye"] [1 "hi"]}
395468```
396469
397−
398470---
471+
399472### `++trel`
400473
401474Mold of three types
@@ -405,49 +478,55 @@ A mold generator. A mold of the tuple of the three types passed in.
405478#### Source
406479
407480```hoon
408− ++ trel
409− |*([a=mold b=mold c=mold] [p=a q=b r=c])
481+++ trel
482+ |$ [first second third]
483+ [p=first q=second r=third]
410484```
411485
412486#### Examples
413487
414488```
415− > *(trel @ud @t @s)
416− [p=0 q='' r=--0]
489+> *(trel @ud @t @s)
490+[p=0 q='' r=--0]
491+```
417492
418− > *(trel cord bloq tape)
419− [p='' q=0 r=""]
493+```
494+> *(trel cord bloq tape)
495+[p='' q=0 r=""]
420496```
421497
422498---
499+
423500### `++unit`
424501
425502Maybe
426503
427−A mold generator. A `unit` is either `~` or `[~ u=a]`, where `a` is the
504+A mold generator. A `unit` is either `~` or `[~ u=item]`, where `item` is the
428505type that was passed in.
429506
430−
431507#### Source
432508
433509```hoon
434− ++ unit
435− |*(a=mold $@($~ [$~ u=a]))
510+++ unit
511+ |$ [item]
512+ $@(~ [~ u=item])
436513```
437514
438515#### Examples
439516
440517```
441− > ? *(unit time)
442− ?({$~ u/@da} $~)
443− ~
518+> ? *(unit time)
519+ u(@da)
520+~
521+```
444522
445− > =a |= a=@
446− ^- (unit @)
447− ?~ a ~
448− [~ a]
449− > (a 2)
450− [~ u=2]
523+```
524+> =a |= a=@
525+ ^- (unit @)
526+ ?~ a ~
527+ [~ a]
528+> (a 2)
529+[~ 2]
451530```
452531
453532#### Discussion
content/docs/hoon/reference/stdlib/2a.md+287−120
@@ -24,24 +24,26 @@ A [`unit`](/docs/hoon/reference/stdlib/1c#unit).
2424#### Source
2525
2626```hoon
27− ++ biff
28− |* [a=(unit) b=$-(* (unit))]
29− ?~ a ~
30− (b u.a)
27+++ biff
28+ |* [a=(unit) b=$-(* (unit))]
29+ ?~ a ~
30+ (b u.a)
3131```
3232
3333#### Examples
3434
3535```
36− > (biff (some 5) |=(a=@ (some (add a 2))))
37− [~ u=7]
38−
39− > (biff ~ |=(a=@ (some (add a 2))))
40− ~
36+> (biff (some 5) |=(a=@ (some (add a 2))))
37+[~ u=7]
4138```
4239
40+```
41+> (biff ~ |=(a=@ (some (add a 2))))
42+~
43+```
4344
4445---
46+
4547### `++bind`
4648
4749Non-unit function to [`unit`](/docs/hoon/reference/stdlib/1c#unit), producing [`unit`](/docs/hoon/reference/stdlib/1c#unit)
@@ -63,26 +65,27 @@ A [`unit`](/docs/hoon/reference/stdlib/1c#unit).
6365#### Source
6466
6567```hoon
66− ++ bind
67− |* [a=(unit) b=gate]
68− ?~ a ~
69− [~ u=(b u.a)]
68+++ bind
69+ |* [a=(unit) b=gate]
70+ ?~ a ~
71+ [~ u=(b u.a)]
7072```
7173
72−
7374#### Examples
7475
7576```
76− > (bind ((unit @) [~ 97]) ,@t)
77− [~ u='a']
78−
79− > =a |=(a=@ (add a 1))
80− > (bind ((unit @) [~ 2]) a)
81− [~ u=3]
77+> (bind ((unit @) [~ 97]) ,@t)
78+[~ u='a']
8279```
8380
81+```
82+> =a |=(a=@ (add a 1))
83+> (bind ((unit @) [~ 2]) a)
84+[~ u=3]
85+```
8486
8587---
88+
8689### `++bond`
8790
8891Replace null
@@ -103,11 +106,11 @@ Either the product of `a` or the value inside of [`unit`](/docs/hoon/reference/s
103106#### Source
104107
105108```hoon
106− ++ bond
107− |* a=(trap)
108− |* b=(unit)
109− ?~ b $:a
110− u.b
109+++ bond
110+ |* a=(trap)
111+ |* b=(unit)
112+ ?~ b $:a
113+ u.b
111114```
112115
113116#### Examples
@@ -117,13 +120,15 @@ Either the product of `a` or the value inside of [`unit`](/docs/hoon/reference/s
117120 1.024
118121 > ((bond |.((bex 10))) ~)
119122 1.024
123+```
120124
125+```
121126 > ((bond |.((bex 10))) (slaw %ud '123'))
122127 123
123128```
124129
125−
126130---
131+
127132### `++both`
128133
129134Group [`unit`](/docs/hoon/reference/stdlib/1c#unit) values into pair
@@ -145,31 +150,36 @@ A [`unit`](/docs/hoon/reference/stdlib/1c#unit) of the two initial values.
145150#### Source
146151
147152```hoon
148− ++ both
149− |* [a=(unit) b=(unit)]
150− ?~ a ~
151− ?~ b ~
152− [~ u=[u.a u.b]]
153+++ both
154+ |* [a=(unit) b=(unit)]
155+ ?~ a ~
156+ ?~ b ~
157+ [~ u=[u.a u.b]]
153158```
154159
155160#### Examples
156161
157162```
158− > (both (some 1) (some %b))
159− [~ u=[1 %b]]
163+> (both (some 1) (some %b))
164+[~ u=[1 %b]]
165+```
160166
161− > (both ~ (some %b))
162− ~
167+```
168+> (both ~ (some %b))
169+~
163170```
164171
165172---
173+
166174### `++clap`
167175
168−Apply function to two [`units`](/docs/hoon/reference/stdlib/1c#unit)
176+Combine two [`units`](/docs/hoon/reference/stdlib/1c#unit) with function
169177
170178Applies a binary function `c`--which does not usually accept or produce a
171179[`unit`](/docs/hoon/reference/stdlib/1c#unit)-- to the values of two [`units`](/docs/hoon/reference/stdlib/1c#unit), `a` and `b`, producing a [`unit`](/docs/hoon/reference/stdlib/1c#unit).
172180
181+If `a` is null, produces `b`. If `b` is null, produces `a`. Otherwise, produces the produce of `c` in a `unit`.
182+
173183#### Accepts
174184
175185`a` is a [`unit`](/docs/hoon/reference/stdlib/1c#unit).
@@ -185,31 +195,81 @@ A [`unit`](/docs/hoon/reference/stdlib/1c#unit).
185195#### Source
186196
187197```hoon
188− ++ clap :: combine
189− |* [a=(unit) b=(unit) c=_|=(^ +<-)]
190− ?~ a b
191− ?~ b a
192− [~ u=(c u.a u.b)]
198+++ clap
199+ |* [a=(unit) b=(unit) c=_=>(~ |=(^ +<-))]
200+ ?~ a b
201+ ?~ b a
202+ [~ u=(c u.a u.b)]
193203```
194204
195205#### Examples
196206
197207```
198− > =u ((unit @t) [~ 'a'])
199− > =v ((unit @t) [~ 'b'])
200− > (clap u v |=([a=@t b=@t] (welp (trip a) (trip b))))
201− [~ u="ab"]
208+> (clap ~ `'b' |=([a=@tD b=@tD] `tape`[a b ~]))
209+[~ u='b']
210+```
211+
212+```
213+> (clap `'a' ~ |=([a=@tD b=@tD] `tape`[a b ~]))
214+[~ u='a']
215+```
216+
217+```
218+> (clap `'a' `'b' |=([a=@tD b=@tD] `tape`[a b ~]))
219+[~ u="ab"]
220+```
221+
222+---
223+
224+### `++clef`
225+
226+Compose two [`units`](/docs/hoon/reference/stdlib/1c#unit) with function
227+
228+Applies a binary function `c`--which does not usually accept [`units`](/docs/hoon/reference/stdlib/1c#unit)-- to the values of two [`units`](/docs/hoon/reference/stdlib/1c#unit), `a` and `b`, producing a [`unit`](/docs/hoon/reference/stdlib/1c#unit).
229+
230+If `a` or `b` are null, produces null. Otherwise, produces the produce of `c`.
231+
232+#### Accepts
233+
234+`a` is a `unit`.
235+
236+`b` is a `unit`.
237+
238+`c` is a `gate` that takes a `cell` and produces a `unit`.
239+
240+#### Produces
241+
242+A `unit`.
243+
244+#### Source
245+
246+```hoon
247+++ clef
248+ |* [a=(unit) b=(unit) c=_=>(~ |=(^ `+<-))]
249+ ?~ a ~
250+ ?~ b ~
251+ (c u.a u.b)
252+```
253+
254+#### Examples
202255
203− > =a ((unit @u) [~ 1])
204− > =b ((unit @u) [~ 2])
205− > =c |=([a=@ b=@] (add a b))
256+```
257+> (clef ~ `'b' |=([a=@tD b=@tD] `(unit tape)`[~ [a b ~]]))
258+~
259+```
206260
207− > (clap a b c)
208− [~ 3]
261+```
262+> (clef `'a' ~ |=([a=@tD b=@tD] `(unit tape)`[~ [a b ~]]))
263+~
209264```
210265
266+```
267+> (clef `'a' `'b' |=([a=@tD b=@tD] `(unit tape)`[~ [a b ~]]))
268+[~ "ab"]
269+```
211270
212271---
272+
213273### `++drop`
214274
215275[`Unit`](/docs/hoon/reference/stdlib/1c#unit) to list
@@ -227,26 +287,28 @@ A list.
227287#### Source
228288
229289```hoon
230− ++ drop :: enlist
231− |* a=(unit)
232− ?~ a ~
233− [i=u.a t=~]
290+++ drop
291+ |* a=(unit)
292+ ?~ a ~
293+ [i=u.a t=~]
234294```
235295
236296#### Examples
237297
238298```
239− > =a ((unit @) [~ 97])
240− > (drop a)
241− [i=97 t=~]
242−
243− > =a ((unit @) [~])
244− > (drop a)
245− ~
299+> =a ((unit @) [~ 97])
300+> (drop a)
301+[i=97 t=~]
246302```
247303
304+```
305+> =a ((unit @) [~])
306+> (drop a)
307+~
308+```
248309
249310---
311+
250312### `++fall`
251313
252314Give [`unit`](/docs/hoon/reference/stdlib/1c#unit) a default value
@@ -266,32 +328,125 @@ Either a [`noun`](/docs/glossary/noun) `b` or the unwrapped value of [`unit`](/d
266328#### Source
267329
268330```hoon
269− ++ fall :: default
270− |* [a=(unit) b=*]
271− ?~(a b u.a)
331+++ fall
332+ |* [a=(unit) b=*]
333+ ?~(a b u.a)
334+```
335+
336+#### Examples
337+
338+```
339+> (fall ~ 'a')
340+'a'
341+> (fall [~ u=0] 'a')
342+0
343+```
344+
345+---
346+
347+### `++flit`
348+
349+Make filter
350+
351+Accepts gate `a` which produces a `?`. Applies `a` to `b`, producing `b` wrapped in a `unit` if true, otherwise produces null.
352+
353+`+flit` is a wet gate that takes `a` and produces a new wet gate that takes `b`.
354+
355+#### Accepts
356+
357+`a` is a `gate` which produces `?`, and is the sample of the outer wet gate.
358+
359+`b` is any `noun`, and is the sample of the inner wet gate.
360+
361+#### Produces
362+
363+`(unit [type])`, where `[type]` is the type of `b`.
364+
365+#### Source
366+
367+```hoon
368+++ flit
369+ |* a=$-(* ?)
370+ |* b=*
371+ ?.((a b) ~ [~ u=b])
372+```
373+
374+#### Examples
375+
376+```
377+> =f (flit |=(=@ud ?:(=(ud 1) %.y %.n)))
378+> (f 1)
379+[~ 1]
380+> (f 2)
381+~
382+```
383+
384+---
385+
386+### `++hunt`
387+
388+First of units
389+
390+Apply binary gate `ord`, which produces a `?`, to units `a` and `b`. Produce `a` if true and `b` if false. If `a` is null, produce `b`. If `b` is null, produce `a`.
391+
392+This allows selecting between two units by some rule.
393+
394+#### Accepts
395+
396+`ord` is a `$-(^ ?)` - a binary gate that produces `?`.
397+
398+`a` is a `unit`.
399+
400+`b` is a `unit`.
401+
402+#### Produces
403+
404+A `unit`.
405+
406+#### Source
407+
408+```hoon
409+++ hunt
410+ |* [ord=$-(^ ?) a=(unit) b=(unit)]
411+ ^- %- unit
412+ $? _?>(?=(^ a) u.a)
413+ _?>(?=(^ b) u.b)
414+ ==
415+ ?~ a b
416+ ?~ b a
417+ ?:((ord u.a u.b) a b)
272418```
273419
274420#### Examples
275421
276422```
277− > (fall ~ 'a')
278− 'a'
279− > (fall [~ u=0] 'a')
280− 0
423+> (hunt gte ~ `20)
424+[~ 20]
425+```
426+
427+```
428+> (hunt gte `10 ~)
429+[~ 10]
430+```
431+
432+```
433+> (hunt gte `10 `20)
434+[~ 20]
281435```
282436
283437---
438+
284439### `++lift`
285440
286441Curried bind
287442
288−Accepts a `++gate` `a` and produces a function that accepts [`unit`](/docs/hoon/reference/stdlib/1c#unit)
443+Accepts function `a` and produces a function that accepts [`unit`](/docs/hoon/reference/stdlib/1c#unit)
289444`b` to which it applies `a`. Used when you want a function that does not accept
290445or produce a [`unit`](/docs/hoon/reference/stdlib/1c#unit) to both accept and produce a [`unit`](/docs/hoon/reference/stdlib/1c#unit).
291446
292447#### Accepts
293448
294−`a` is a gate.
449+`a` is a `mold`.
295450
296451`b` is a [`unit`](/docs/hoon/reference/stdlib/1c#unit).
297452
@@ -302,24 +457,26 @@ A [`unit`](/docs/hoon/reference/stdlib/1c#unit).
302457#### Source
303458
304459```hoon
305− ++ lift :: lift gate (fmap)
306− |* a=gate :: flipped
307− |* b=(unit) :: curried
308− (bind b a) :: bind
460+++ lift
461+ |* a=mold
462+ |* b=(unit)
463+ (bind b a)
309464```
310465
311466#### Examples
312467
313468```
314− > ((lift dec) `(unit @)`~)
315− ~
316−
317− > ((lift dec) `(unit @)`[~ 20])
318− [~ 19]
469+> ((lift dec) `(unit @)`~)
470+~
319471```
320472
473+```
474+> ((lift dec) `(unit @)`[~ 20])
475+[~ 19]
476+```
321477
322478---
479+
323480### `++mate`
324481
325482Choose
@@ -343,35 +500,39 @@ A [`unit`](/docs/hoon/reference/stdlib/1c#unit) or crash.
343500#### Source
344501
345502```hoon
346− ++ mate :: choose
347− |* [a=(unit) b=(unit)]
348− ?~ b a
349− ?~ a b
350− ?.(=(u.a u.b) ~|('mate' !!) a)
503+++ mate
504+ |* [a=(unit) b=(unit)]
505+ ?~ b a
506+ ?~ a b
507+ ?.(=(u.a u.b) ~>(%mean.'mate' !!) a)
351508```
352509
353510#### Examples
354511
355512```
356− > =a ((unit @) [~ 97])
357− > =b ((unit @) [~ 97])
358− > (mate a b)
359− [~ 97]
360−
361− > =a ((unit @) [~ 97])
362− > =b ((unit @) [~])
363− > (mate a b)
364− [~ 97]
513+> =a ((unit @) [~ 97])
514+> =b ((unit @) [~ 97])
515+> (mate a b)
516+[~ 97]
517+```
365518
366− > =a ((unit @) [~ 97])
367− > =b ((unit @) [~ 98])
368− > (mate a b)
369− ! 'mate'
370− ! exit
519+```
520+> =a ((unit @) [~ 97])
521+> =b ((unit @) [~])
522+> (mate a b)
523+[~ 97]
371524```
372525
526+```
527+> =a ((unit @) [~ 97])
528+> =b ((unit @) [~ 98])
529+> (mate a b)
530+! 'mate'
531+! exit
532+```
373533
374534---
535+
375536### `++need`
376537
377538Unwrap [`unit`](/docs/hoon/reference/stdlib/1c#unit)
@@ -389,30 +550,35 @@ Either the unwrapped value of `a` (`u.a`), or crash.
389550#### Source
390551
391552```hoon
392− ++ need :: demand
393− |* a=(unit)
394− ?~ a ~|(%need !!)
395− u.a
553+++ need
554+ ~/ %need
555+ |* a=(unit)
556+ ?~ a ~>(%mean.'need' !!)
557+ u.a
396558```
397559
398560#### Examples
399561
400562```
401− > =a ((unit [@t @t]) [~ ['a' 'b']])
402− > (need a)
403− ['a' 'b']
404−
405− > =a ((unit @ud) [~ 17])
406− > (need a)
407− 17
563+> =a ((unit [@t @t]) [~ ['a' 'b']])
564+> (need a)
565+['a' 'b']
566+```
408567
409− > =a ((unit @) [~])
410− > (need a)
411− ! exit
568+```
569+> =a ((unit @ud) [~ 17])
570+> (need a)
571+17
412572```
413573
574+```
575+> =a ((unit @) [~])
576+> (need a)
577+! exit
578+```
414579
415580---
581+
416582### `++some`
417583
418584Wrap value in a [`unit`](/docs/hoon/reference/stdlib/1c#unit)
@@ -430,20 +596,21 @@ A [`unit`](/docs/hoon/reference/stdlib/1c#unit).
430596#### Source
431597
432598```hoon
433− ++ some :: lift (pure)
434− |* a=*
435− [~ u=a]
599+++ some
600+ |* a=*
601+ [~ u=a]
436602```
437603
438604#### Examples
439605
440606```
441− > (some ['a' 'b'])
442− [~ u=['a' 'b']]
443−
444− > (some &)
445− [~ u=%.y]
607+> (some ['a' 'b'])
608+[~ u=['a' 'b']]
446609```
447610
611+```
612+> (some &)
613+[~ u=%.y]
614+```
448615
449616---
content/docs/hoon/reference/stdlib/table-of-contents.md+10−2
@@ -90,7 +90,8 @@ Can be navigated [alphabetically](#alphabetical) or [by section](#by-section).
9090<a class="tooltip" href='/docs/hoon/reference/stdlib/2q/#char' title="Character"><code>++char</code></a>
9191<a class="tooltip" href='/docs/hoon/reference/stdlib/4o/#chum' title="Jet hint information"><code>++chum</code></a>
9292<a class="tooltip" href='/docs/hoon/reference/stdlib/4i/#cit' title="Octal digit"><code>++cit</code></a>
93−<a class="tooltip" href='/docs/hoon/reference/stdlib/2a/#clap' title="Apply function to two units"><code>++clap</code></a>
93+<a class="tooltip" href='/docs/hoon/reference/stdlib/2a/#clap' title="Combine two units with function"><code>++clap</code></a>
94+<a class="tooltip" href='/docs/hoon/reference/stdlib/2a/#clef' title="Compose two units with function"><code>++clef</code></a>
9495<a class="tooltip" href='/docs/hoon/reference/stdlib/3a/#cmpsi' title="Compare (signed integer)"><code>++cmp:si</code></a>
9596<a class="tooltip" href='/docs/hoon/reference/stdlib/4k/#co' title="Literal rendering engine"><code>++co</code></a>
9697<a class="tooltip" href='/docs/hoon/reference/stdlib/4o/#coil' title="Tuple of core information"><code>++coil</code></a>
@@ -201,6 +202,7 @@ Can be navigated [alphabetically](#alphabetical) or [by section](#by-section).
201202<a class="tooltip" href='/docs/hoon/reference/stdlib/2b/#find' title="First index in list"><code>++find</code></a>
202203<a class="tooltip" href='/docs/hoon/reference/stdlib/4c/#fitre' title="Fit on one line test"><code>++fit:re</code></a>
203204<a class="tooltip" href='/docs/hoon/reference/stdlib/3b/#flifl' title="Flip sign"><code>++fli:fl</code></a>
205+<a class="tooltip" href='/docs/hoon/reference/stdlib/2a/#flit' title="Make filter"><code>++flit</code></a>
204206<a class="tooltip" href='/docs/hoon/reference/stdlib/2b/#flop' title="Reverse list"><code>++flop</code></a>
205207<a class="tooltip" href='/docs/hoon/reference/stdlib/3b/#fmaff' title="Fused multiplyadd (IEEE float)"><code>++fma:ff</code></a>
206208<a class="tooltip" href='/docs/hoon/reference/stdlib/3b/#fmafl' title="Fused multiplyadd"><code>++fma:fl</code></a>
@@ -281,6 +283,7 @@ Can be navigated [alphabetically](#alphabetical) or [by section](#by-section).
281283<a class="tooltip" href='/docs/hoon/reference/stdlib/2f/#hor' title="Horizontal hash order"><code>++hor</code></a>
282284<a class="tooltip" href='/docs/hoon/reference/stdlib/3c/#horyo' title="Seconds in hour"><code>++hor:yo</code></a>
283285<a class="tooltip" href='/docs/hoon/reference/stdlib/4j/#hufab' title="Parse two phonetic pairs"><code>++huf:ab</code></a>
286+<a class="tooltip" href='/docs/hoon/reference/stdlib/2a/#hunt' title="Select between two units by a rule"><code>++hunt</code></a>
284287<a class="tooltip" href='/docs/hoon/reference/stdlib/4j/#hyfab' title="Parse 8 phonetic bytes"><code>++hyf:ab</code></a>
285288
286289### i
@@ -643,6 +646,7 @@ Can be navigated [alphabetically](#alphabetical) or [by section](#by-section).
643646<a class="tooltip" href='/docs/hoon/reference/stdlib/4m/#stab' title="Parse cord to path"><code>++stab</code></a>
644647<a class="tooltip" href='/docs/hoon/reference/stdlib/4f/#stag' title="Add label"><code>++stag</code></a>
645648<a class="tooltip" href='/docs/hoon/reference/stdlib/4f/#star' title="Produce list of matches"><code>++star</code></a>
649+<a class="tooltip" href='/docs/hoon/reference/stdlib/1c/#step' title="Atom size or offset, in bloqs"><code>++step</code></a>
646650<a class="tooltip" href='/docs/hoon/reference/stdlib/4f/#stet' title="Add faces to rangeparser pairs in list"><code>++stet</code></a>
647651<a class="tooltip" href='/docs/hoon/reference/stdlib/4f/#stew' title="Switch by first"><code>++stew</code></a>
648652<a class="tooltip" href='/docs/hoon/reference/stdlib/4f/#stir' title="Parse repeatedly"><code>++stir</code></a>
@@ -844,6 +848,7 @@ Can be navigated [alphabetically](#alphabetical) or [by section](#by-section).
844848<a class="tooltip" href='/docs/hoon/reference/stdlib/1c/#pair' title="Mold of pair of types"><code>++pair</code></a>
845849<a class="tooltip" href='/docs/hoon/reference/stdlib/1c/#pole' title="Mold generator of faceless list"><code>++pole</code></a>
846850<a class="tooltip" href='/docs/hoon/reference/stdlib/1c/#quip' title="Mold generator (tuple of list and type)"><code>++quip</code></a>
851+<a class="tooltip" href='/docs/hoon/reference/stdlib/1c/#step' title="Atom size or offset, in bloqs"><code>++step</code></a>
847852<a class="tooltip" href='/docs/hoon/reference/stdlib/1c/#trap' title="Core with one arm $"><code>++trap</code></a>
848853<a class="tooltip" href='/docs/hoon/reference/stdlib/1c/#tree' title="Mold generator (tree)"><code>++tree</code></a>
849854<a class="tooltip" href='/docs/hoon/reference/stdlib/1c/#trel' title="Mold generator (tuple of three types)"><code>++trel</code></a>
@@ -855,9 +860,12 @@ Can be navigated [alphabetically](#alphabetical) or [by section](#by-section).
855860<a class="tooltip" href='/docs/hoon/reference/stdlib/2a/#bind' title="Nonunit function to unit, producing unit"><code>++bind</code></a>
856861<a class="tooltip" href='/docs/hoon/reference/stdlib/2a/#bond' title="Replace null"><code>++bond</code></a>
857862<a class="tooltip" href='/docs/hoon/reference/stdlib/2a/#both' title="Group unit values into pair"><code>++both</code></a>
858−<a class="tooltip" href='/docs/hoon/reference/stdlib/2a/#clap' title="Apply function to two units"><code>++clap</code></a>
863+<a class="tooltip" href='/docs/hoon/reference/stdlib/2a/#clap' title="Combine two units with function"><code>++clap</code></a>
864+<a class="tooltip" href='/docs/hoon/reference/stdlib/2a/#clef' title="Compose two units with function"><code>++clef</code></a>
859865<a class="tooltip" href='/docs/hoon/reference/stdlib/2a/#drop' title="Unit to list"><code>++drop</code></a>
860866<a class="tooltip" href='/docs/hoon/reference/stdlib/2a/#fall' title="Give unit a default value"><code>++fall</code></a>
867+<a class="tooltip" href='/docs/hoon/reference/stdlib/2a/#flit' title="Make filter"><code>++flit</code></a>
868+<a class="tooltip" href='/docs/hoon/reference/stdlib/2a/#hunt' title="Select between two units by a rule"><code>++hunt</code></a>
861869<a class="tooltip" href='/docs/hoon/reference/stdlib/2a/#lift' title="Curried bind"><code>++lift</code></a>
862870<a class="tooltip" href='/docs/hoon/reference/stdlib/2a/#mate' title="Choose"><code>++mate</code></a>
863871<a class="tooltip" href='/docs/hoon/reference/stdlib/2a/#need' title="Unwrap unit"><code>++need</code></a>
lib/glossary.js+29−1
@@ -1872,12 +1872,19 @@ export const glossary = [
18721872 desc: "Used in the Hoon standard library.",
18731873 },
18741874 {
1875− name: "Apply function to two units",
1875+ name: "Combine two units with function",
18761876 symbol: "clap",
18771877 usage: "stdlib",
18781878 slug: "https://urbit.org/docs/reference/library/2a/#clap",
18791879 desc: "Used in the Hoon standard library.",
18801880 },
1881+ {
1882+ name: "Compose two units with function",
1883+ symbol: "clef",
1884+ usage: "stdlib",
1885+ slug: "https://urbit.org/docs/reference/library/2a/#clef",
1886+ desc: "Used in the Hoon standard library.",
1887+ },
18811888 {
18821889 name: "Compare (signed integer)",
18831890 symbol: "cmp:si",
@@ -2599,6 +2606,13 @@ export const glossary = [
25992606 slug: "https://urbit.org/docs/reference/library/3b/#fli-fl",
26002607 desc: "Used in the Hoon standard library.",
26012608 },
2609+ {
2610+ name: "Make filter",
2611+ symbol: "flit",
2612+ usage: "stdlib",
2613+ slug: "https://urbit.org/docs/reference/library/2a/#flit",
2614+ desc: "Used in the Hoon standard library.",
2615+ },
26022616 {
26032617 name: "Reverse list",
26042618 symbol: "flop",
@@ -3117,6 +3131,13 @@ export const glossary = [
31173131 slug: "https://urbit.org/docs/reference/library/4j/#huf-ab",
31183132 desc: "Used in the Hoon standard library.",
31193133 },
3134+ {
3135+ name: "Select between two units by a rule",
3136+ symbol: "hunt",
3137+ usage: "stdlib",
3138+ slug: "https://urbit.org/docs/reference/library/2a/#hunt",
3139+ desc: "Used in the Hoon standard library.",
3140+ },
31203141 {
31213142 name: "Parse 8 phonetic bytes",
31223143 symbol: "hyf:ab",
@@ -5399,6 +5420,13 @@ export const glossary = [
53995420 slug: "https://urbit.org/docs/reference/library/4f/#star",
54005421 desc: "Used in the Hoon standard library.",
54015422 },
5423+ {
5424+ name: "Atom size or offset, in bloqs",
5425+ symbol: "step",
5426+ usage: "stdlib",
5427+ slug: "https://urbit.org/docs/reference/library/1c/#step",
5428+ desc: "Used in the Hoon standard library.",
5429+ },
54025430 {
54035431 name: "Add faces to range-parser pairs in list",
54045432 symbol: "stet",