on master help sign in
Examples fixes for buc runes (#724)
489bacdjfranklin9000
reference/hoon-expressions/rune/buc.md+13−9
@@ -104,26 +104,30 @@ Regular form: **2-running**.
104
104
105A `$%` is a tagged union, a common data model.
105A `$%` is a tagged union, a common data model.
106
106
107−Make sure the first item in your `$%` terminates, or the default will
107+Make sure the last item in your `$%` terminates, or the default will
108−be an infinite loop!
108+be an infinite loop! Alteratively, you can use `$~` to define a custom
109+type default value.
109
110
110##### Examples
111##### Examples
111
112
112```
113```
113~zod:dojo> =foo $%([%foo p=@ud q=@ud] [%baz p=@ud])
114~zod:dojo> =foo $%([%foo p=@ud q=@ud] [%baz p=@ud])
114
115
116+~zod:dojo> (foo [%foo 4 2])
117+[%foo p=4 q=2]
118+
115~zod:dojo> (foo [%baz 37])
119~zod:dojo> (foo [%baz 37])
116[%baz p=37]
120[%baz p=37]
117
121
118~zod:dojo> $:foo
122~zod:dojo> $:foo
119−[%foo p=0 q=0]~
123+[%baz p=0]
120```
124```
121
125
122### $: "buccol"
126### $: "buccol"
123
127
124`[%bscl p=(list spec)]`: form a cell type.
128`[%bscl p=(list spec)]`: form a cell type.
125
129
126−##### Normalizes
130+##### Normalizes to
127
131
128The tuple the length of `p`, normalizing each item.
132The tuple the length of `p`, normalizing each item.
129
133
@@ -282,7 +286,7 @@ Using `$~`:
282
286
283`[%bsvt p=spec q=spec]`: structure which normalizes a union tagged by head depth (atom).
287`[%bsvt p=spec q=spec]`: structure which normalizes a union tagged by head depth (atom).
284
288
285−###### Normalizes to
289+##### Normalizes to
286
290
287`p`, if the sample is an atom; `q`, if the sample is a cell.
291`p`, if the sample is an atom; `q`, if the sample is a cell.
288
292
@@ -311,7 +315,7 @@ Example:
311[p=%baz q=99]
315[p=%baz q=99]
312
316
313~zod:dojo> $:a
317~zod:dojo> $:a
314−[%foo p=0 q=0]
318+%foo
315```
319```
316
320
317
321
@@ -347,14 +351,14 @@ layer (as seen in the expansion above) to apply a `$=`.
347p=%foo
351p=%foo
348
352
349~zod:dojo> (a %baz)
353~zod:dojo> (a %baz)
350−p=%foo
354+ford: %ride failed to execute:
351```
355```
352
356
353### $? "bucwut"
357### $? "bucwut"
354
358
355`[%bswt p=(list spec)]`: form a type from a union of other types.
359`[%bswt p=(list spec)]`: form a type from a union of other types.
356
360
357−###### Normalizes to
361+##### Normalizes to
358
362
359The first item in `p` which normalizes the sample to itself.
363The first item in `p` which normalizes the sample to itself.
360
364
@@ -386,7 +390,7 @@ normalizer.
386%baz
390%baz
387
391
388~zod:dojo> (a [37 45])
392~zod:dojo> (a [37 45])
389−%baz
393+ford: %ride failed to execute:
390
394
391~zod:dojo> $:a
395~zod:dojo> $:a
392%baz
396%baz