on master help sign in
rest of entry
commit31524f474d9c7874f2a1db3fdf3ac58be088a8f6 authorJONATHAN PAPROCKI <jon@tlon.io> dateThu 28 May 2020, 15:53 (6 years ago) parent7ea7fa5
1 file changed+32−1
reference/hoon-expressions/rune/buc.md+32−1
reference/hoon-expressions/rune/buc.md+32−1
@@ -305,11 +305,42 @@ Regular: **2-fixed**.
305305
306306`[%bspd p=spec q=hoon]`: repair a value of a tagged union type
307307
308−
309308##### Syntax
310309
311310Regular: **2-fixed**.
312311
312+```hoon
313+$&(combined-mold=spec normalizing-gate=hoon)
314+```
315+Here `combined-mold` is a tagged union type (typically made with `$%`) and `normalizing-gate` is a
316+gate which accepts values of `combined-mold` and normalizes them to be of one particular type
317+in `combined-mold`.
318+
319+##### Normalizes to
320+
321+The product of the normalizing gate and sample.
322+
323+##### Defaults to
324+
325+The default of the last type listed in `p`, normalized with the normalizing gate.
326+
327+##### Discussion
328+
329+This rune is used to "upgrade" or "repair" values of a structure, typically from
330+an old version to a new version. For example, this may happen when migrating state after
331+updating an app.
332+
333+##### Examples
334+
335+```hoon
336++$ old [%0 @]
337++$ new [%1 ^]
338++$ combined $%(old new)
339++$ adapting $&(combined |=(?-(-.a %0 [%1 1 +.a], %1 a)))
340+```
341+Here `adapting` is a structure that bunts to `[%1 ^]` but also normalizes from
342+`[%0 @]` if called on such a noun.
343+
313344
314345### $~ "bucsig"
315346