@@ -24,24 +24,26 @@ A [`unit`](/docs/hoon/reference/stdlib/1c#unit).
24#### Source
24#### Source
28− |* [a=(unit) b=$-(* (unit))]
28+ |* [a=(unit) b=$-(* (unit))]
33#### Examples
33#### Examples
36− > (biff (some 5) |=(a=@ (some (add a 2))))
36+> (biff (some 5) |=(a=@ (some (add a 2))))
39− > (biff ~ |=(a=@ (some (add a 2))))
41+> (biff ~ |=(a=@ (some (add a 2))))
45### `++bind`
47### `++bind`
47Non-unit function to [`unit`](/docs/hoon/reference/stdlib/1c#unit), producing [`unit`](/docs/hoon/reference/stdlib/1c#unit)
49Non-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).
63#### Source
65#### Source
67− |* [a=(unit) b=gate]
69+ |* [a=(unit) b=gate]
69− [~ u=(b u.a)]
71+ [~ u=(b u.a)]
73#### Examples
74#### Examples
76− > (bind ((unit @) [~ 97]) ,@t)
77+> (bind ((unit @) [~ 97]) ,@t)
77− [~ u='a']
78+[~ u='a']
79− > =a |=(a=@ (add a 1))
80− > (bind ((unit @) [~ 2]) a)
82+> =a |=(a=@ (add a 1))
83+> (bind ((unit @) [~ 2]) a)
86### `++bond`
89### `++bond`
88Replace null
91Replace null
@@ -103,11 +106,11 @@ Either the product of `a` or the value inside of [`unit`](/docs/hoon/reference/s
103#### Source
106#### Source
107− |* a=(trap)
110+ |* a=(trap)
108− |* b=(unit)
111+ |* b=(unit)
109− ?~ b $:a
112+ ?~ b $:a
113#### Examples
116#### Examples
@@ -117,13 +120,15 @@ Either the product of `a` or the value inside of [`unit`](/docs/hoon/reference/s
118 > ((bond |.((bex 10))) ~)
121 > ((bond |.((bex 10))) ~)
121 > ((bond |.((bex 10))) (slaw %ud '123'))
126 > ((bond |.((bex 10))) (slaw %ud '123'))
127### `++both`
132### `++both`
129Group [`unit`](/docs/hoon/reference/stdlib/1c#unit) values into pair
134Group [`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.
145#### Source
150#### Source
149− |* [a=(unit) b=(unit)]
154+ |* [a=(unit) b=(unit)]
152− [~ u=[u.a u.b]]
157+ [~ u=[u.a u.b]]
155#### Examples
160#### Examples
158− > (both (some 1) (some %b))
163+> (both (some 1) (some %b))
159− [~ u=[1 %b]]
164+[~ u=[1 %b]]
161− > (both ~ (some %b))
168+> (both ~ (some %b))
166### `++clap`
174### `++clap`
168−Apply function to two [`units`](/docs/hoon/reference/stdlib/1c#unit)
176+Combine two [`units`](/docs/hoon/reference/stdlib/1c#unit) with function
170Applies a binary function `c`--which does not usually accept or produce a
178Applies a binary function `c`--which does not usually accept or produce a
171[`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).
179[`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).
181+If `a` is null, produces `b`. If `b` is null, produces `a`. Otherwise, produces the produce of `c` in a `unit`.
173#### Accepts
183#### Accepts
175`a` is a [`unit`](/docs/hoon/reference/stdlib/1c#unit).
185`a` is a [`unit`](/docs/hoon/reference/stdlib/1c#unit).
@@ -185,31 +195,81 @@ A [`unit`](/docs/hoon/reference/stdlib/1c#unit).
185#### Source
195#### Source
188− ++ clap :: combine
198+++ clap
189− |* [a=(unit) b=(unit) c=_|=(^ +<-)]
199+ |* [a=(unit) b=(unit) c=_=>(~ |=(^ +<-))]
192− [~ u=(c u.a u.b)]
202+ [~ u=(c u.a u.b)]
195#### Examples
205#### Examples
198− > =u ((unit @t) [~ 'a'])
208+> (clap ~ `'b' |=([a=@tD b=@tD] `tape`[a b ~]))
199− > =v ((unit @t) [~ 'b'])
209+[~ u='b']
200− > (clap u v |=([a=@t b=@t] (welp (trip a) (trip b))))
210+```
213+> (clap `'a' ~ |=([a=@tD b=@tD] `tape`[a b ~]))
218+> (clap `'a' `'b' |=([a=@tD b=@tD] `tape`[a b ~]))
201− [~ u="ab"]
219+[~ u="ab"]
226+Compose two [`units`](/docs/hoon/reference/stdlib/1c#unit) with function
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).
230+If `a` or `b` are null, produces null. Otherwise, produces the produce of `c`.
238+`c` is a `gate` that takes a `cell` and produces a `unit`.
248+ |* [a=(unit) b=(unit) c=_=>(~ |=(^ `+<-))]
203− > =a ((unit @u) [~ 1])
256+```
204− > =b ((unit @u) [~ 2])
257+> (clef ~ `'b' |=([a=@tD b=@tD] `(unit tape)`[~ [a b ~]]))
205− > =c |=([a=@ b=@] (add a b))
258+~
207− > (clap a b c)
261+```
208− [~ 3]
262+> (clef `'a' ~ |=([a=@tD b=@tD] `(unit tape)`[~ [a b ~]]))
267+> (clef `'a' `'b' |=([a=@tD b=@tD] `(unit tape)`[~ [a b ~]]))
213### `++drop`
273### `++drop`
215[`Unit`](/docs/hoon/reference/stdlib/1c#unit) to list
275[`Unit`](/docs/hoon/reference/stdlib/1c#unit) to list
@@ -227,26 +287,28 @@ A list.
227#### Source
287#### Source
230− ++ drop :: enlist
290+++ drop
231− |* a=(unit)
291+ |* a=(unit)
233− [i=u.a t=~]
293+ [i=u.a t=~]
236#### Examples
296#### Examples
239− > =a ((unit @) [~ 97])
299+> =a ((unit @) [~ 97])
240− > (drop a)
300+> (drop a)
241− [i=97 t=~]
301+[i=97 t=~]
250### `++fall`
312### `++fall`
252Give [`unit`](/docs/hoon/reference/stdlib/1c#unit) a default value
314Give [`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
266#### Source
328#### Source
269− ++ fall :: default
331+++ fall
270− |* [a=(unit) b=*]
332+ |* [a=(unit) b=*]
271− ?~(a b u.a)
333+ ?~(a b u.a)
351+Accepts gate `a` which produces a `?`. Applies `a` to `b`, producing `b` wrapped in a `unit` if true, otherwise produces null.
353+`+flit` is a wet gate that takes `a` and produces a new wet gate that takes `b`.
357+`a` is a `gate` which produces `?`, and is the sample of the outer wet gate.
359+`b` is any `noun`, and is the sample of the inner wet gate.
363+`(unit [type])`, where `[type]` is the type of `b`.
377+> =f (flit |=(=@ud ?:(=(ud 1) %.y %.n)))
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`.
392+This allows selecting between two units by some rule.
396+`ord` is a `$-(^ ?)` - a binary gate that produces `?`.
410+ |* [ord=$-(^ ?) a=(unit) b=(unit)]
417+ ?:((ord u.a u.b) a b)
274#### Examples
420#### Examples
277− > (fall ~ 'a')
423+> (hunt gte ~ `20)
279− > (fall [~ u=0] 'a')
425+```
284### `++lift`
439### `++lift`
286Curried bind
441Curried bind
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)
289`b` to which it applies `a`. Used when you want a function that does not accept
444`b` to which it applies `a`. Used when you want a function that does not accept
290or produce a [`unit`](/docs/hoon/reference/stdlib/1c#unit) to both accept and produce a [`unit`](/docs/hoon/reference/stdlib/1c#unit).
445or produce a [`unit`](/docs/hoon/reference/stdlib/1c#unit) to both accept and produce a [`unit`](/docs/hoon/reference/stdlib/1c#unit).
292#### Accepts
447#### Accepts
294−`a` is a gate.
449+`a` is a `mold`.
296`b` is a [`unit`](/docs/hoon/reference/stdlib/1c#unit).
451`b` is a [`unit`](/docs/hoon/reference/stdlib/1c#unit).
@@ -302,24 +457,26 @@ A [`unit`](/docs/hoon/reference/stdlib/1c#unit).
302#### Source
457#### Source
305− ++ lift :: lift gate (fmap)
460+++ lift
306− |* a=gate :: flipped
461+ |* a=mold
307− |* b=(unit) :: curried
462+ |* b=(unit)
308− (bind b a) :: bind
463+ (bind b a)
311#### Examples
466#### Examples
314− > ((lift dec) `(unit @)`~)
317− > ((lift dec) `(unit @)`[~ 20])
469+> ((lift dec) `(unit @)`~)
474+> ((lift dec) `(unit @)`[~ 20])
323### `++mate`
480### `++mate`
@@ -343,35 +500,39 @@ A [`unit`](/docs/hoon/reference/stdlib/1c#unit) or crash.
343#### Source
500#### Source
346− ++ mate :: choose
503+++ mate
347− |* [a=(unit) b=(unit)]
504+ |* [a=(unit) b=(unit)]
350− ?.(=(u.a u.b) ~|('mate' !!) a)
507+ ?.(=(u.a u.b) ~>(%mean.'mate' !!) a)
353#### Examples
510#### Examples
356− > =a ((unit @) [~ 97])
513+> =a ((unit @) [~ 97])
357− > =b ((unit @) [~ 97])
514+> =b ((unit @) [~ 97])
358− > (mate a b)
515+> (mate a b)
361− > =a ((unit @) [~ 97])
516+[~ 97]
362− > =b ((unit @) [~])
517+```
366− > =a ((unit @) [~ 97])
520+> =a ((unit @) [~ 97])
367− > =b ((unit @) [~ 98])
521+> =b ((unit @) [~])
368− > (mate a b)
522+> (mate a b)
527+> =a ((unit @) [~ 97])
528+> =b ((unit @) [~ 98])
375### `++need`
536### `++need`
377Unwrap [`unit`](/docs/hoon/reference/stdlib/1c#unit)
538Unwrap [`unit`](/docs/hoon/reference/stdlib/1c#unit)
@@ -389,30 +550,35 @@ Either the unwrapped value of `a` (`u.a`), or crash.
389#### Source
550#### Source
392− ++ need :: demand
553+++ need
393− |* a=(unit)
555+ |* a=(unit)
394− ?~ a ~|(%need !!)
556+ ?~ a ~>(%mean.'need' !!)
398#### Examples
560#### Examples
401− > =a ((unit [@t @t]) [~ ['a' 'b']])
563+> =a ((unit [@t @t]) [~ ['a' 'b']])
402− > (need a)
564+> (need a)
403− ['a' 'b']
565+['a' 'b']
405− > =a ((unit @ud) [~ 17])
409− > =a ((unit @) [~])
569+> =a ((unit @ud) [~ 17])
410− > (need a)
570+> (need a)
416### `++some`
582### `++some`
418Wrap value in a [`unit`](/docs/hoon/reference/stdlib/1c#unit)
584Wrap value in a [`unit`](/docs/hoon/reference/stdlib/1c#unit)
@@ -430,20 +596,21 @@ A [`unit`](/docs/hoon/reference/stdlib/1c#unit).
430#### Source
596#### Source
433− ++ some :: lift (pure)
599+++ some
438#### Examples
604#### Examples
441− > (some ['a' 'b'])
607+> (some ['a' 'b'])
442− [~ u=['a' 'b']]
608+[~ u=['a' 'b']]