on master help sign in
converts standard library to .umd
commite5863d1353d18025745ceef1493822f6b093dedf authorRobert <robert@tlon.io> dateFri 21 Sep 2018, 11:22 (8 years ago) parent7fa97bd
50 files changed+11253−3449
docs/reference/library/1a.umd+109−74 docs/reference/library/1b.umd+44−27 docs/reference/library/1c.umd+86−48 docs/reference/library/2a.umd+144−148 docs/reference/library/2b.umd+164−92 docs/reference/library/2c.umd+143−68 docs/reference/library/2d.umd+51−23 docs/reference/library/2e.umd+34−20 docs/reference/library/2f.umd+462−26 docs/reference/library/2g.umd+19−10 docs/reference/library/2h.umd+106−56 docs/reference/library/2i.umd+146−62 docs/reference/library/2j.umd+85−34 docs/reference/library/2k.umd+200−140 docs/reference/library/2l.umd+32−14 docs/reference/library/2m.umd+59−22 docs/reference/library/2n.umd+84−41 docs/reference/library/2o.umd+42−25 docs/reference/library/2p.umd+33−17 docs/reference/library/2q.umd+94−61 docs/reference/library/3a.umd+129−46 docs/reference/library/3b.umd+5828−2 docs/reference/library/3c.umd+109−53 docs/reference/library/3d.umd+89−34 docs/reference/library/3e.umd+6−4 docs/reference/library/3f.umd+96−37 docs/reference/library/3g.umd+91−53 docs/reference/library/4a.umd+36−13 docs/reference/library/4b.umd+247−229 docs/reference/library/4c.umd+69−63 docs/reference/library/4d.umd+16−9 docs/reference/library/4e.umd+117−105 docs/reference/library/4f.umd+289−268 docs/reference/library/4g.umd+55−47 docs/reference/library/4h.umd+330−243 docs/reference/library/4i.umd+7−3 docs/reference/library/4j.umd+461−457 docs/reference/library/4k.umd+322−263 docs/reference/library/4l.umd+96−87 docs/reference/library/4m.umd+102−109 docs/reference/library/4n.umd+71−79 docs/reference/library/4o.umd+439−163 docs/reference/library/5a.umd+7−3 docs/reference/library/5b.umd+7−3 docs/reference/library/5c.umd+7−3 docs/reference/library/5d.umd+8−3 docs/reference/library/5e.umd+8−3 docs/reference/library/5f.umd+54−50 docs/reference/library/5g.umd+9−3 docs/reference/library/zuse.umd+11−6
docs/reference/library/1a.umd+109−74
@@ -1,9 +1,13 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'1'
3+ title/'1a: Basic Arithmetic'
4+ ==
5+
6+;>
47
58
69# 1a: basic arithmetic
10+
711### `++add`
812
913Add
@@ -22,15 +26,18 @@ An atom.
2226
2327#### Source
2428
25− ++ add
29+```
30+ ++ add
2631 ~/ %add
2732 |= [a=@ b=@]
2833 ^- @
2934 ?: =(0 a) b
3035 $(a (dec a), b +(b))
36+```
3137
3238#### Examples
3339
40+```
3441 > (add 2 2)
3542 4
3643
@@ -40,19 +47,20 @@ An atom.
4047 > (add 1.333 (mul 2 2))
4148 1.337
4249
43− > (add 'a' 4)
50+ > (add 'a' 4)
4451 101
4552
4653 > (add 'a' 'b')
47− 195
54+ 195
4855
49− > (add 0xc 0xf)
56+ > (add 0xc 0xf)
5057 27
5158
52− > `@ux`(add 0xc 0xf)
59+ > `@ux`(add 0xc 0xf)
5360 0x1b
61+```
5462
55−***
63+---
5664### `++dec`
5765
5866Decrement
@@ -69,7 +77,8 @@ An atom.
6977
7078#### Source
7179
72− ++ dec
80+```
81+ ++ dec
7382 ~/ %dec
7483 |= a=@
7584 ~| %decrement-underflow
@@ -78,9 +87,11 @@ An atom.
7887 |- ^- @
7988 ?: =(a +(b)) b
8089 $(b +(b))
90+```
8191
8292#### Examples
8393
94+```
8495 > (dec 7)
8596 6
8697
@@ -93,14 +104,14 @@ An atom.
93104 > `@t`(dec 'b')
94105 'a'
95106
96− > (dec 0xc)
107+ > (dec 0xc)
97108 11
98− > `@ux`(dec 0xc)
109+ > `@ux`(dec 0xc)
99110 0xb
111+```
100112
101113
102−
103−***
114+---
104115### `++div`
105116
106117Divide
@@ -119,7 +130,8 @@ An atom.
119130
120131#### Source
121132
122− ++ div
133+```
134+ ++ div
123135 ~/ %div
124136 |: [a=`@`1 b=`@`1]
125137 ^- @
@@ -129,11 +141,11 @@ An atom.
129141 |-
130142 ?: (lth a b) c
131143 $(a (sub a b), c +(c))
132−
144+```
133145
134146#### Examples
135147
136−
148+```
137149 > (div 4 2)
138150 2
139151
@@ -152,9 +164,9 @@ An atom.
152164
153165 > (div 0x9f 0x29)
154166 6
167+```
155168
156−
157−***
169+---
158170### `++dvr`
159171
160172Divide with remainder
@@ -173,14 +185,17 @@ A cell of atoms.
173185
174186#### Source
175187
188+```
176189 ++ dvr
177190 ~/ %dvr
178191 |= [a=@ b=@]
179192 ^- [p=@ q=@]
180193 [(div a b) (mod a b)]
194+```
181195
182196#### Examples
183197
198+```
184199 > (dvr 17 8)
185200 [p=2 q=1]
186201
@@ -195,12 +210,13 @@ A cell of atoms.
195210
196211 > (dvr 'ab 'a')
197212 [p=259 q=62]
198− > `@`'a'
199− 97
213+ > `@`'a'
214+ 97
200215 > `@`'ab'
201− 25.185
216+ 25.185
217+```
202218
203−***
219+---
204220### `++gte`
205221
206222Greater-than/equal
@@ -219,15 +235,17 @@ A flag.
219235
220236#### Source
221237
222− ++ gte
238+```
239+ ++ gte
223240 ~/ %gte
224241 |= [a=@ b=@]
225242 ^- ?
226243 !(lth a b)
227−
244+```
228245
229246#### Examples
230247
248+```
231249 > (gte 100 10)
232250 %.y
233251
@@ -236,10 +254,9 @@ A flag.
236254
237255 > (gte 3 4)
238256 %.n
257+```
239258
240−
241−
242−***
259+---
243260### `++gth`
244261
245262Greater-than
@@ -258,16 +275,18 @@ A flag.
258275
259276#### Source
260277
261− ++ gth
278+```
279+ ++ gth
262280 ~/ %gth
263281 |= [a=@ b=@]
264282 ^- ?
265283 !(lte a b)
266−
284+```
267285
268286
269287#### Examples
270288
289+```
271290 > (gth 'd' 'c')
272291 %.y
273292
@@ -276,9 +295,9 @@ A flag.
276295
277296 > (gth 'steak' 'brisket')
278297 %.n
298+```
279299
280−
281−***
300+---
282301### `++lte`
283302
284303Less-than/equal
@@ -297,14 +316,16 @@ A flag.
297316
298317#### Source
299318
300− ++ lte
319+```
320+ ++ lte
301321 ~/ %lte
302322 |= [a=@ b=@]
303323 |(=(a b) (lth a b))
304−
324+```
305325
306326#### Examples
307327
328+```
308329 > (lte 4 5)
309330 %.y
310331
@@ -328,12 +349,12 @@ A flag.
328349 > (lte 'abraham' 'bob')
329350 %.n
330351
331− > (lte ~m61 ~h1)
352+ > (lte ~m61 ~h1)
332353 %.n
354+```
333355
334356
335−
336−***
357+---
337358### `++lth`
338359
339360Less-than
@@ -352,7 +373,8 @@ A flag.
352373
353374#### Source
354375
355− ++ lth
376+```
377+ ++ lth
356378 ~/ %lth
357379 |= [a=@ b=@]
358380 ^- ?
@@ -362,9 +384,11 @@ A flag.
362384 ?& !=(0 b)
363385 $(a (dec a), b (dec b))
364386 == == ==
387+```
365388
366389#### Examples
367390
391+```
368392 > (lth 4 5)
369393 %.y
370394
@@ -379,16 +403,16 @@ A flag.
379403
380404 > (lth 'a' 'b')
381405 %.y
382− > `@`'a'
383− 97
406+ > `@`'a'
407+ 97
384408 > `@`'b'
385409 98
386410
387411 > (lth 'abraham' 'bob')
388412 %.n
413+```
389414
390−
391−***
415+---
392416### `++max`
393417
394418Maximum
@@ -407,15 +431,18 @@ An atom.
407431
408432#### Source
409433
410− ++ max
434+```
435+ ++ max
411436 ~/ %max
412437 |= [a=@ b=@]
413438 ^- @
414439 ?: (gth a b) a
415440 b
441+```
416442
417443#### Examples
418444
445+```
419446 > (max 10 100)
420447 100
421448
@@ -428,19 +455,20 @@ An atom.
428455 > (max 'abraham' 'bob')
429456 30.787.873.400.840.801
430457
431− > `@t`(max 'abraham' 'bob')
458+ > `@t`(max 'abraham' 'bob')
432459 'abraham'
433460
434461 > `@t`(max 'abraham' 'benjamin')
435462 'benjamin'
436463
437− > `@dr`(max ~m6 ~h1)
464+ > `@dr`(max ~m6 ~h1)
438465 ~h1
439466
440− >`@ux`(max 0xe1 0x1e)
467+ >`@ux`(max 0xe1 0x1e)
441468 0xe1
469+```
442470
443−***
471+---
444472### `++min`
445473
446474Minimum
@@ -459,15 +487,18 @@ An atom.
459487
460488#### Source
461489
462− ++ min
490+```
491+ ++ min
463492 ~/ %min
464493 |= [a=@ b=@]
465494 ^- @
466495 ?: (lth a b) a
467496 b
497+```
468498
469499#### Examples
470500
501+```
471502 > (min 10 100)
472503 10
473504
@@ -480,18 +511,18 @@ An atom.
480511 > (min 'abraham' 'bob')
481512 6.451.042
482513
483− > `@t`(min 'abraham' 'bob')
514+ > `@t`(min 'abraham' 'bob')
484515 'bob'
485516
486517 > `@t`(min 'abraham' 'benjamin')
487518 'abraham'
488519
489− > `@dr`(min ~m6 ~h1)
520+ > `@dr`(min ~m6 ~h1)
490521 ~m6
522+```
491523
492524
493−
494−***
525+---
495526### `++mod`
496527
497528Modulus
@@ -510,17 +541,18 @@ An atom.
510541
511542#### Source
512543
513− ++ mod
544+```
545+ ++ mod
514546 ~/ %mod
515547 |: [a=`@`1 b=`@`1]
516548 ^- @
517549 ?< =(0 b)
518550 (sub a (mul b (div a b)))
519−
551+```
520552
521553#### Examples
522554
523−
555+```
524556 > (mod 5 2)
525557 1
526558
@@ -533,15 +565,15 @@ An atom.
533565 > (mod 40 20)
534566 0
535567
536− > `@`'c'
537− 99
568+ > `@`'c'
569+ 99
538570 >`@`'a'
539571 97
540572 > (mod 'c' 'a')
541573 2
574+```
542575
543−
544−***
576+---
545577### `++mul`
546578
547579Multiply
@@ -560,7 +592,8 @@ An atom.
560592
561593#### Source
562594
563− ++ mul
595+```
596+ ++ mul
564597 ~/ %mul
565598 |: [a=`@`1 b=`@`1]
566599 ^- @
@@ -568,17 +601,19 @@ An atom.
568601 |-
569602 ?: =(0 a) c
570603 $(a (dec a), c (add b c))
604+```
571605
572606#### Examples
573607
608+```
574609 > (mul 3 4)
575610 12
576611
577612 > (mul 0 1)
578613 0
579614
580− > `@`'a'
581− 97
615+ > `@`'a'
616+ 97
582617 > `@`'b'
583618 98
584619 > (mul 'a' 'b')
@@ -586,10 +621,10 @@ An atom.
586621
587622 >`@ux`(mul 0x1f 0xe)
588623 0x1b2
624+```
589625
590626
591−
592−***
627+---
593628### `++sub`
594629
595630Subtract
@@ -608,18 +643,20 @@ An atom.
608643
609644#### Source
610645
611− ++ sub
646+```
647+ ++ sub
612648 ~/ %sub
613649 |= [a=@ b=@]
614650 ~_ leaf+"subtract-underflow"
615651 ^- @
616652 ?: =(0 b) a
617653 $(a (dec a), b (dec b))
618−
654+```
619655
620656
621657#### Examples
622658
659+```
623660 > (sub 10 5)
624661 5
625662
@@ -633,17 +670,15 @@ An atom.
633670 ! subtract-underflow
634671 ! exit
635672
636− > (sub 'c' 'a')
637− 2
638− > `@`'c'
639− 99
673+ > (sub 'c' 'a')
674+ 2
675+ > `@`'c'
676+ 99
640677 > `@`'a'
641678 97
642679
643680 > (sub 0x1f 0xe)
644681 17
645− > `@ux`(sub 0x1f 0xe)
682+ > `@ux`(sub 0x1f 0xe)
646683 0x11
647−
648−
649−***
684+```
docs/reference/library/1b.umd+44−27
@@ -1,14 +1,18 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'2'
3+ title/'1b: Tree Addressing'
4+ ==
45
6+;>
7+
8+[create an anchor](#anchors-in-markdown)
59
610# 1b: tree addressing
711
812Check out the Nock [explanation](docs/nock/explanation/) for more
913information on the tree-addressing system.
1014
11−### `++cap`
15+### `++cap`(#anchors-in-markdown))
1216
1317Tree head
1418
@@ -27,7 +31,8 @@ A constant atom.
2731
2832#### Source
2933
30− ++ cap
34+```
35+ ++ cap
3136 ~/ %cap
3237 |= a=@
3338 ^- ?($2 $3)
@@ -37,10 +42,11 @@ A constant atom.
3742 ?(%0 %1) !!
3843 * $(a (div a 2))
3944 ==
40−
45+```
4146
4247#### Examples
4348
49+```
4450 > (cap 4)
4551 %2
4652
@@ -53,18 +59,18 @@ A constant atom.
5359 > (cap 1) ::address '1' is in neither the head nor the tail
5460 ! exit
5561
56− > (cap 0x40))
62+ > (cap 0x40))
5763 %2
5864 > `@`0x40
59− 64
65+ 64
6066
61− > (cap 'a')
67+ > (cap 'a')
6268 %3
6369 > `@`'a'
64− 97
70+ 97
71+```
6572
66−
67−***
73+---
6874### `++mas`
6975
7076Address within head/tail
@@ -82,7 +88,8 @@ An atom.
8288
8389#### Source
8490
85− ++ mas
91+```
92+ ++ mas
8693 ~/ %mas
8794 |= a=@
8895 ^- @
@@ -92,10 +99,11 @@ An atom.
9299 3 1
93100 * (add (mod a 2) (mul $(a (div a 2)) 2))
94101 ==
95−
102+```
96103
97104#### Examples
98105
106+```
99107 > (mas 3)
100108 1
101109
@@ -121,30 +129,32 @@ An atom.
121129 > (cap (mas 6))
122130 %3
123131
124− > (mas 0)
132+ > (mas 0)
125133 ! exit ::address `0` is in neither the head nor the tail
126134
127135 > (mas 1)
128136 ! exit ::address `1` is in neither the head nor the tail
129−
137+```
130138
131139#### Discussion
132140
133−
141+```
134142 1
135143 / \
136144 / \
137− 2 3 <--here are the head (`+2`) and the tail (`+3`)
145+ 2 3 <--here are the head (`+2`) and the tail (`+3`)
138146 / \ /\
139147 4 5 6 7
140148 /\ /\ /\ /\
141149 (continues...)
150+```
142151
143152Running `(mas 7)` in the Dojo will return `3`, because address `+3` is what
144153`+7` now occupies. The tree below helps illustrate the relationship. With
145154parentheses are `a` values (if `a` is in subtree `+3`), and without parentheses
146155are the values returned with `(mas a)`.
147156
157+```
148158 1(3) ::new/(old) addresses
149159 / \
150160 2 3
@@ -155,11 +165,12 @@ are the values returned with `(mas a)`.
155165 (12) (13) (14) (15)
156166 / \ / \ / \ / \
157167 (continues...)
168+```
158169
159170Notice how the old values in the head (subtree `+2`) were not illustrated in
160171this case, because `+7` is within the tail (subtree `+3`).
161172
162−***
173+---
163174### `++peg`
164175
165176Address within address
@@ -179,20 +190,23 @@ An atom.
179190
180191#### Source
181192
182− ++ peg
193+```
194+ ++ peg
183195 ~/ %peg
184− |= [a=@ b=@]
185− ?< =(0 a)
186− ^- @
187− ?- b
196+ |= [a=@ b=@]
197+ ?< =(0 a)
198+ ^- @
199+ ?- b
188200 $1 a
189201 $2 (mul a 2)
190202 $3 +((mul a 2))
191203 * (add (mod b 2) (mul $(b (div b 2)) 2))
192204 ==
205+```
193206
194207#### Examples
195208
209+```
196210 > (peg 4 1)
197211 4
198212
@@ -214,6 +228,7 @@ An atom.
214228 > (cap (peg 4 2)) ::`(cap a)` computes whether address `a` is in the head or the tail
215229 %2
216230
231+```
217232
218233#### Discussion
219234
@@ -225,6 +240,7 @@ greater tree, is returned.
225240Running `(peg 3 4)` in the Dojo, for example, will return `12`. Looking at
226241a tree diagram makes it easy to see why.
227242
243+```
228244 1
229245 / \
230246 / \
@@ -237,7 +253,7 @@ a tree diagram makes it easy to see why.
237253 8 9 10 11 12 13 14 15
238254 /\ /\ /\ /\ /\ /\ /\ /\
239255 (continues...)
240−
256+```
241257
242258When we consider subtree at address `+3` by itself, it has relative addresses
243259that are structured in the same way as its parent tree's absolute addresses.
@@ -245,6 +261,7 @@ The absolute addresses are given in parentheses in the diagram below.
245261Notice how relative address `+4` is at the same position as absolute address
246262`+12`.
247263
264+```
248265 1(3) ::new/(old) addresses
249266 / \
250267 2 3
@@ -255,7 +272,7 @@ Notice how relative address `+4` is at the same position as absolute address
255272 (12) (13) (14) (15)
256273 / \ / \ / \ / \
257274 (continues...)
275+```
258276
259277
260−
261−***
278+---
docs/reference/library/1c.umd+86−48
@@ -1,6 +1,9 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'3'
3+ title/'1c: Molds and Mold-Builders'
4+ ==
5+
6+;>
47
58
69# 1c: molds and mold builders
@@ -13,22 +16,25 @@ Atom representing block size. A block of size `a` has a bitwidth of `2^a`.
1316
1417#### Source
1518
16− ++ bloq @
19+```
20+ ++ bloq @
21+```
1722
1823#### Examples
1924
25+```
2026 :: ++met measures how many a-bloqs long an atom is.
2127
22− > (met 3 256)
28+ > (met 3 256)
2329 2
2430
25− > (met 3 255)
31+ > (met 3 255)
2632 1
2733
28− > (met 3 65.535)
29− 2
34+ > (met 3 65.535)
35+ 2
3036
31− > (met 2 65.536)
37+ > (met 2 65.536)
3238 > 3
3339
3440 > (met 0 4)
@@ -42,6 +48,7 @@ Atom representing block size. A block of size `a` has a bitwidth of `2^a`.
4248
4349 > (met 2 0xb5)
4450 2
51+```
4552
4653#### Discussion
4754
@@ -62,7 +69,7 @@ And so on.
6269
6370See the [bit arithmetic](../2c) section for operations that use `bloq`s.
6471
65−***
72+---
6673
6774### `++each`
6875
@@ -79,6 +86,7 @@ A mold generator. Produces a discriminated fork between two types, defaulting to
7986
8087#### Examples
8188
89+```
8290 > ? *(each cord time)
8391 ?({$.y p/@t} {$.n p/@da})
8492 [%.y p='']
@@ -86,8 +94,9 @@ A mold generator. Produces a discriminated fork between two types, defaulting to
8694 > ? *(each * tape)
8795 ?({$.y p/*} {$.n p/""})
8896 [%.y p=0]
97+```
8998
90−***
99+---
91100### `++gate`
92101
93102Function
@@ -99,12 +108,14 @@ product noun. If used dryly as a type, the subject must have a sample type of
99108
100109#### Source
101110
102− ++ gate
103− $-(* *)
104−
111+```
112+ ++ gate
113+ $-(* *)
114+```
105115
106116#### Examples
107117
118+```
108119 > ? gate
109120 <1.rdl {* <31.ohr 1.jmk $143>}>
110121 <1.rdl {* <31.ohr 1.jmk $143>}>
@@ -115,6 +126,7 @@ product noun. If used dryly as a type, the subject must have a sample type of
115126 > (`gate`|=(a=@ [a 'b']) 1)
116127 ! nest-fail
117128 ! exit
129+```
118130
119131#### Discussion
120132
@@ -124,7 +136,7 @@ mathematical sense. Any `gate` normalizes to an iron `gate`.
124136
125137See also: [`++lift`](../2a), [`++cork`](../2n)
126138
127−***
139+---
128140### `++list`
129141
130142List
@@ -135,12 +147,14 @@ homogenous type.
135147
136148#### Source
137149
138− ++ list
150+```
151+ ++ list
139152 |*(a=mold $@($~ (lest a)))
140−
153+```
141154
142155#### Examples
143156
157+```
144158 > *(list)
145159 ~
146160
@@ -153,11 +167,12 @@ homogenous type.
153167 > `(list @)`[1 2 'j' ~]
154168 ~[1 2 106]
155169
170+```
156171#### Discussion
157172
158173See also: [`++turn`](../2b), [`++snag`](../2b)
159174
160−***
175+---
161176### `++lone`
162177
163178Face on mold
@@ -166,12 +181,14 @@ A mold generator. Puts face of `p` on the passed-in mold.
166181
167182#### Source
168183
184+```
169185 ++ lone
170186 |*(a=mold [p=a])
187+```
171188
172189#### Examples
173190
174−
191+```
175192 > ? *cord
176193 @t
177194 ''
@@ -185,8 +202,9 @@ A mold generator. Puts face of `p` on the passed-in mold.
185202 > ? *@
186203 @
187204 0
205+```
188206
189−***
207+---
190208### `++pair`
191209
192210Mold of pair of types
@@ -196,21 +214,23 @@ A mold generator. Produces a tuple of two of the types passed in.
196214
197215#### Source
198216
217+```
199218 ++ pair
200219 |*([a=mold b=mold] [p=a q=b])
201−
202−
220+```
203221
204222#### Examples
205223
224+```
206225 > *(pair ? cord)
207226 [p=%.y q='']
208227
209228 > *(pair tape @)
210229 [p="" q=0]
211230
231+```
212232
213−***
233+---
214234### `++pole`
215235
216236Faceless list
@@ -219,22 +239,24 @@ A mold generator. A `list` without the faces `i` and `t`.
219239
220240#### Source
221241
242+```
222243 ++ pole
223244 |*(a=mold $@($~ [a (pole a)]))
224−
245+```
225246
226247
227248#### Examples
228249
250+```
229251 > =/(a "asdf" ?>(?=(^ a) `(lest @tD)`a))
230252 [i='a' t=[i='s' t=[i='d' t=[i='f' t=~]]]]
231253
232254 > `(pole char)`"asdf"
233255 ['a' ['s' ['d' ['f' ~]]]]
256+```
234257
235258
236−
237−***
259+---
238260### `++qual`
239261
240262Mold of 4-type tuple
@@ -243,20 +265,23 @@ A mold generator. Produces a tuple of four of the types passed in.
243265
244266#### Source
245267
246− ++ qual
268+```
269+ ++ qual
247270 |* [a=mold b=mold c=mold d=mold]
248− [p=a q=b r=c s=d]
271+ [p=a q=b r=c s=d]
272+```
249273
250274#### Examples
251275
276+```
252277 > *(qual date time tape cord)
253278 [p=[[a=%.y y=0] m=0 t=[d=0 h=0 m=0 s=0 f=~]] q=~292277024401-.1.1 r="" s='']
254279
255280 > *(qual (list @) @u @ud @ux)
256281 [p=~ q=0 r=0 s=0x0]
282+```
257283
258−
259−***
284+---
260285### `++quip`
261286
262287Mold of pair of `list` and type
@@ -265,23 +290,27 @@ A mold generator. Produces a tuple of a `list` of `a` and the mold of `b`.
265290
266291#### Source
267292
268− ++ quip
269− |*([a=mold b=mold] [(list a) b])
293+```
294+ ++ quip
295+ |*([a=mold b=mold] [(list a) b])
296+```
270297
271298#### Examples
272299
300+```
273301 > *(quip @ _'hi')
274302 [~ 'hi']
275303
276304 > `(quip @ @ux)`[[1 2 3 4 ~] 0x10]
277305 [~[1 2 3 4] 0x10]
306+```
278307
279308#### Discussion
280309
281310A common pattern in Hoon code is to return a `list` of changes, along with a
282311new state. You'll often see `quip` used in Gall apps.
283312
284−***
313+---
285314### `++trap`
286315
287316Core with one arm `$`
@@ -290,12 +319,14 @@ A trap is a core with one arm `$`.
290319
291320#### Source
292321
322+```
293323 ++ trap
294324 |*(a=mold _|?(*a))
295−
325+```
296326
297327#### Examples
298328
329+```
299330 > (*trap)
300331 <1?dxy 1.oeg {a/<1|rbb {* <31.ohr 1.jmk $143>}> <31.ohr 1.jmk $143>}>
301332
@@ -304,10 +335,10 @@ A trap is a core with one arm `$`.
304335
305336 > (|.(42))
306337 42
338+```
307339
308340
309−
310−***
341+---
311342### `++tree`
312343
313344Tree mold generator
@@ -317,18 +348,20 @@ left/right sub `tree` of the same type. Pretty-printed with `{}`.
317348
318349#### Source
319350
320− ++ tree
321− |*(a=mold $@($~ [n=a l=(tree a) r=(tree a)]))
322−
351+```
352+ ++ tree
353+ |*(a=mold $@($~ [n=a l=(tree a) r=(tree a)]))
354+```
323355
324356#### Examples
325357
358+```
326359 > `(tree [@ tape])`[[1 "hi"] [[2 "bye"] ~ ~] ~]
327360 {[2 "bye"] [1 "hi"]}
361+```
328362
329363
330−
331−***
364+---
332365### `++trel`
333366
334367Mold of three types
@@ -337,20 +370,22 @@ A mold generator. A mold of the tuple of the three types passed in.
337370
338371#### Source
339372
373+```
340374 ++ trel
341375 |*([a=mold b=mold c=mold] [p=a q=b r=c])
342−
376+```
343377
344378#### Examples
345379
380+```
346381 > *(trel @ud @t @s)
347382 [p=0 q='' r=--0]
348383
349384 > *(trel cord bloq tape)
350385 [p='' q=0 r=""]
386+```
351387
352−
353−***
388+---
354389### `++unit`
355390
356391Maybe
@@ -361,22 +396,25 @@ type that was passed in.
361396
362397#### Source
363398
364− ++ unit
399+```
400+ ++ unit
365401 |*(a=mold $@($~ [$~ u=a]))
402+```
366403
367404#### Examples
368405
369−
406+```
370407 > ? *(unit time)
371408 ?({$~ u/@da} $~)
372409 ~
373410
374− > =a |= a=@
411+ > =a |= a=@
375412 ^- (unit @)
376413 ?~ a ~
377414 [~ a]
378415 > (a 2)
379416 [~ u=2]
417+```
380418
381419#### Discussion
382420
@@ -384,4 +422,4 @@ Using a `unit` allows you to specify something that may not be there.
384422
385423See also: [`++bind`](../2b)
386424
387−***
425+---
docs/reference/library/2a.umd+144−148
@@ -1,9 +1,13 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'4'
3+ title/'2a: Unit Logic'
4+ ==
5+
6+;>
47
58
69# 2a: unit logic
10+
711### `++biff`
812
913Unit as argument
@@ -11,38 +15,37 @@ Unit as argument
1115Applies a function `b` that produces a unit to the unwrapped value of ++unit
1216`a` (`u.a`). If `a` is empty, `~` is produced.
1317
14−Accepts
15−-------
18+#### Accepts
1619
1720`a` is a unit.
1821
1922`b` is a function that accepts a noun and produces a unit.
2023
21−Produces
22−--------
24+#### Produces
2325
2426A unit.
2527
26−Source
27−------
28+#### Source
2829
29− ++ biff :: apply
30− |* {a/(unit) b/$-(* (unit))}
30+```
31+ ++ biff
32+ |* [a](unit) b]$-(* (unit))]
3133 ?~ a ~
3234 (b u.a)
35+```
3336
37+#### Examples
3438
35−Examples
36−--------
37−
38− > (biff (some 5) |=(a/@ (some (add a 2))))
39+```
40+ > (biff (some 5) |=(a]@ (some (add a 2))))
3941 [~ u=7]
40− > (biff ~ |=(a/@ (some (add a 2))))
41− ~
4242
43+ > (biff ~ |=(a]@ (some (add a 2))))
44+ ~
45+```
4346
4447
45−***
48+---
4649### `++bind`
4750
4851Non-unit function to unit, producing unit
@@ -51,39 +54,39 @@ Applies a function `b` to the value (`u.a`) of a ++unit `a`, producing
5154a unit. Used when you want a function that does not accept or produce a
5255unit to both accept and produce a unit.
5356
54−Accepts
55−-------
57+#### Accepts
5658
5759`a` is a unit.
5860
5961`b` is a function.
6062
61−Produces
62−--------
63+#### Produces
6364
6465A unit.
6566
66−Source
67−------
67+#### Source
6868
69− ++ bind :: argue
70− |* {a/(unit) b/gate}
69+```
70+ ++ bind
71+ |* [a=(unit) b=gate]
7172 ?~ a ~
7273 [~ u=(b u.a)]
74+```
7375
7476
75−Examples
76−--------
77+#### Examples
7778
79+```
7880 > (bind ((unit @) [~ 97]) ,@t)
79− [~ `a`]
80− > =a |=(a/@ (add a 1))
81− > (bind ((unit @) [~ 2]) a)
82− [~ 3]
81+ [~ u='a']
8382
83+ > =a |=(a]@ (add a 1))
84+ > (bind ((unit @) [~ 2]) a)
85+ [~ u=3]
86+```
8487
8588
86−***
89+---
8790### `++bond`
8891
8992Replace null
@@ -91,41 +94,40 @@ Replace null
9194Replaces an empty ++unit `b` with the product of a called trap
9295`a`. If the unit is not empty, then the original unit is produced.
9396
94−Accepts
95−-------
97+#### Accepts
9698
9799`a` is a trap.
98100
99101`b` is a unit.
100102
101−Produces
102−--------
103+#### Produces
103104
104105Either the product of `a` or the value inside of unit `b`.
105106
106−Source
107−------
107+#### Source
108108
109− ++ bond :: replace
110− |* a/(trap)
111− |* b/(unit)
109+```
110+ ++ bond
111+ |* a=(trap)
112+ |* b=(unit)
112113 ?~ b $:a
113114 u.b
115+```
114116
117+#### Examples
115118
116−Examples
117−--------
118−
119+```
119120 > (bex 10)
120121 1.024
121122 > ((bond |.((bex 10))) ~)
122123 1.024
124+
123125 > ((bond |.((bex 10))) (slaw %ud '123'))
124126 123
127+```
125128
126129
127−
128−***
130+---
129131### `++both`
130132
131133Group unit values into pair
@@ -134,47 +136,45 @@ Produces `~` if either `a` or `b` are empty. Otherwise, produces a
134136++unit whose value is a cell of the values of two input units `a` and
135137`b`.
136138
137−Accepts
138−-------
139+#### Accepts
139140
140141`a` is a unit.
141142
142143`b` is a unit.
143144
144−Produces
145−--------
145+#### Produces
146146
147147A unit of the two initial values.
148148
149−Source
150−------
149+#### Source
151150
152− ++ both :: all the above
153− |* {a/(unit) b/(unit)}
151+```
152+ ++ both
153+ |* [a=(unit) b=(unit)]
154154 ?~ a ~
155155 ?~ b ~
156156 [~ u=[u.a u.b]]
157+```
157158
159+#### Examples
158160
159−Examples
160−--------
161−
161+```
162162 > (both (some 1) (some %b))
163163 [~ u=[1 %b]]
164+
164165 > (both ~ (some %b))
165166 ~
167+```
166168
167−
168−***
169+---
169170### `++clap`
170171
171172Apply function to two units
172173
173−Applies a binary function `c`--which does not usually accept or produce a `++unit`--
174−to the values of two units, `a` and `b`, producing a unit.
174+Applies a binary function `c`--which does not usually accept or produce a
175+`++unit`-- to the values of two units, `a` and `b`, producing a unit.
175176
176−Accepts
177−-------
177+#### Accepts
178178
179179`a` is a unit.
180180
@@ -182,112 +182,109 @@ Accepts
182182
183183`c` is a function that performs a binary operation.
184184
185−Produces
186−--------
185+#### Produces
187186
188187A unit.
189188
190−Source
191−------
189+#### Source
192190
191+```
193192 ++ clap :: combine
194− |* {a/(unit) b/(unit) c/_|=(^ +<-)}
193+ |* [a](unit) b=(unit) c=_|=(^ +<-)]
195194 ?~ a b
196195 ?~ b a
197196 [~ u=(c u.a u.b)]
197+```
198198
199+#### Examples
199200
200−Examples
201−--------
202−
201+```
203202 > =u ((unit @t) [~ 'a'])
204203 > =v ((unit @t) [~ 'b'])
205204 > (clap u v |=([a=@t b=@t] (welp (trip a) (trip b))))
206− [~ u="ab"]
205+ [~ u="ab"]
206+
207207 > =a ((unit @u) [~ 1])
208208 > =b ((unit @u) [~ 2])
209209 > =c |=([a=@ b=@] (add a b))
210+
210211 > (clap a b c)
211212 [~ 3]
212−
213+```
213214
214215
215−***
216+---
216217### `++drop`
217218
218219Unit to list
219220
220221Makes a ++list of the unwrapped value (`u.a`) of a `++unit` `a`.
221222
222−Accepts
223−-------
223+#### Accepts
224224
225225`a` is a unit.
226226
227−Produces
228−--------
227+#### Produces
229228
230229A list.
231230
232−Source
233−------
231+#### Source
234232
233+```
235234 ++ drop :: enlist
236− |* a/(unit)
235+ |* a=(unit)
237236 ?~ a ~
238237 [i=u.a t=~]
238+```
239239
240+#### Examples
240241
241−Examples
242−--------
243−
242+```
244243 > =a ((unit @) [~ 97])
245244 > (drop a)
246− [i=97 t=~]
245+ [i=97 t=~]
246+
247247 > =a ((unit @) [~])
248248 > (drop a)
249249 ~
250+```
250251
251252
252−
253−***
253+---
254254### `++fall`
255255
256256Give unit a default value
257257
258258Produces a default value `b` for a `++unit` `a` in cases where `a` is null.
259259
260−Accepts
261−-------
260+#### Accepts
262261
263262`a` is a unit.
264263
265264`b` is a noun that's used as the default value.
266265
267−Produces
268−--------
266+#### Produces
269267
270268Either a noun `b` or the unwrapped value of unit `a`.
271269
272−Source
273−------
270+#### Source
274271
272+```
275273 ++ fall :: default
276− |* {a/(unit) b/*}
274+ |* [a=(unit) b=*]
277275 ?~(a b u.a)
276+```
278277
278+#### Examples
279279
280−Examples
281−--------
282−
280+```
283281 > (fall ~ `a`)
284282 `a`
285283 > (fall [~ u=0] `a`)
286284 0
285+```
287286
288−
289−
290−***
287+---
291288### `++lift`
292289
293290Curried bind
@@ -296,38 +293,37 @@ Accepts a `++gate` `a` and produces a function that accepts `++unit`
296293`b` to which it applies `a`. Used when you want a function that does not accept
297294or produce a unit to both accept and produce a unit.
298295
299−Accepts
300−-------
296+#### Accepts
301297
302298`a` is a gate.
303299
304300`b` is a unit.
305301
306−Produces
307−--------
302+#### Produces
308303
309304A unit.
310305
311−Source
312−------
306+#### Source
313307
308+```
314309 ++ lift :: lift gate (fmap)
315− |* a/gate :: flipped
316− |* b/(unit) :: curried
310+ |* a=gate :: flipped
311+ |* b=(unit) :: curried
317312 (bind b a) :: bind
313+```
318314
315+#### Examples
319316
320−Examples
321−--------
322−
317+```
323318 > ((lift dec) `(unit @)`~)
324319 ~
320+
325321 > ((lift dec) `(unit @)`[~ 20])
326322 [~ 19]
323+```
327324
328325
329−
330−***
326+---
331327### `++mate`
332328
333329Choose
@@ -338,120 +334,120 @@ If neither are empty, it asserts that both values are the same and
338334produces that value. If the assertion fails, `++mate` crashes with
339335`'mate'` in the stack trace.
340336
341−Accepts
342−-------
337+#### Accepts
343338
344339`a` is a unit.
345340
346341`b` is a unit.
347342
348−Produces
349−--------
343+#### Produces
350344
351345A unit or crash.
352346
353−Source
354−------
347+#### Source
355348
349+```
356350 ++ mate :: choose
357− |* {a/(unit) b/(unit)}
351+ |* [a=(unit) b=(unit)]
358352 ?~ b a
359353 ?~ a b
360354 ?.(=(u.a u.b) ~|('mate' !!) a)
355+```
361356
357+#### Examples
362358
363−Examples
364−--------
365−
359+```
366360 > =a ((unit @) [~ 97])
367361 > =b ((unit @) [~ 97])
368362 > (mate a b)
369363 [~ 97]
364+
370365 > =a ((unit @) [~ 97])
371366 > =b ((unit @) [~])
372367 > (mate a b)
373368 [~ 97]
369+
374370 > =a ((unit @) [~ 97])
375371 > =b ((unit @) [~ 98])
376372 > (mate a b)
377373 ! 'mate'
378374 ! exit
375+```
379376
380377
381−
382−***
378+---
383379### `++need`
384380
385381Unwrap unit
386382
387383Retrieve the value from a `++unit` and crash if the unit is null.
388384
389−Accepts
390−-------
385+#### Accepts
391386
392387`a` is a unit.
393388
394−Produces
395−--------
389+#### Produces
396390
397391Either the unwrapped value of `a` (`u.a`), or crash.
398392
399−Source
400−------
393+#### Source
401394
395+```
402396 ++ need :: demand
403− |* a/(unit)
397+ |* a](unit)
404398 ?~ a ~|(%need !!)
405399 u.a
400+```
406401
402+#### Examples
407403
408−Examples
409−--------
410−
404+```
411405 > =a ((unit [@t @t]) [~ ['a' 'b']])
412406 > (need a)
413407 ['a' 'b']
408+
414409 > =a ((unit @ud) [~ 17])
415410 > (need a)
416411 17
412+
417413 > =a ((unit @) [~])
418414 > (need a)
419415 ! exit
416+```
420417
421418
422−
423−***
419+---
424420### `++some`
425421
426422Wrap value in a unit
427423
428424Takes any atom `a` and produces a [`++unit`]() with the value set to `a`.
429425
430−Accepts
431−-------
426+#### Accepts
432427
433428`a` is a [noun]().
434429
435−Produces
436−--------
430+#### Produces
437431
438432A unit.
439433
440−Source
441−------
434+#### Source
442435
436+```
443437 ++ some :: lift (pure)
444438 |* a=*
445439 [~ u=a]
440+```
446441
447−Examples
448−--------
442+#### Examples
449443
444+```
450445 > (some [`a` `b`])
451446 [~ u=[`a` `b`]]
447+
452448 > (some &)
453449 [~ u=%.y]
450+```
454451
455452
456−
457−***
453+---
docs/reference/library/2b.umd+164−92
@@ -1,9 +1,12 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'5'
3+ title/'2b: List Logic'
4+ ==
45
6+;>
57
68# 2b: list logic
9+
710### `++fand`
811
912All indices in `list`
@@ -23,7 +26,8 @@ A `list`.
2326
2427#### Source
2528
26− ++ fand
29+```
30+ ++ fand
2731 ~/ %fand
2832 |= [nedl=(list) hstk=(list)]
2933 =| i=@ud
@@ -38,10 +42,11 @@ A `list`.
3842 ^$(i +(i), hstk +.hstk, fnd [i fnd])
3943 $(n t.n, h t.h)
4044 ^$(i +(i), hstk +.hstk)
41−
45+```
4246
4347#### Examples
4448
49+```
4550 > (fand ~[3] ~[1 2 3])
4651 ~[2]
4752
@@ -53,10 +58,10 @@ A `list`.
5358
5459 > (fand "ba" "cbabab")
5560 ~[1 3]
61+```
5662
5763
58−
59−***
64+---
6065### `++find`
6166
6267First index in `list`
@@ -76,7 +81,8 @@ The `unit` of an atom.
7681
7782#### Source
7883
79− ++ find
84+```
85+ ++ find
8086 ~/ %find
8187 |= [nedl=(list) hstk=(list)]
8288 =| i=@ud
@@ -90,10 +96,11 @@ The `unit` of an atom.
9096 `i
9197 $(n t.n, h t.h)
9298 ^$(i +(i), hstk +.hstk)
93−
99+```
94100
95101#### Examples
96102
103+```
97104 > (find [3]~ ~[1 2 3])
98105 [~ u=2]
99106
@@ -108,9 +115,9 @@ The `unit` of an atom.
108115
109116 > (find "bab" "cbabab")
110117 [~ u=2]
118+```
111119
112−
113−***
120+---
114121### `++flop`
115122
116123Reverse
@@ -127,7 +134,8 @@ A `list`.
127134
128135#### Source
129136
130− ++ flop
137+```
138+ ++ flop
131139 ~/ %flop
132140 |* a=(list)
133141 => .(a (homo a))
@@ -136,19 +144,21 @@ A `list`.
136144 |-
137145 ?~ a b
138146 $(a t.a, b [i.a b])
139−
147+```
140148
141149
142150#### Examples
143151
152+```
144153 > =a [1 2 3 ~]
145154 > (flop a)
146155 ~[3 2 1]
147156
148157 > (flop (flop a))
149158 ~[1 2 3]
159+```
150160
151−***
161+---
152162### `++gulf`
153163
154164List from range
@@ -168,27 +178,31 @@ a `list`.
168178
169179#### Source
170180
171− ++ gulf
181+```
182+ ++ gulf
172183 |= [a=@ b=@]
173184 ^- (list @)
174185 ?:(=(a +(b)) ~ [a $(a +(a))])
186+```
175187
176188#### Examples
177189
190+```
178191 > (gulf 1 6)
179192 ~[1 2 3 4 5 6]
180193
181194 > `(list @t)`(gulf 99 106)
182195 <|c d e f g h i j|>
196+```
183197
184−***
198+---
185199### `++homo`
186200
187201Homogenize
188202
189203Produces a `list` whose type is a fork of all the contained types in the
190204list `a`. Used when you want to make all the types of the elements of a list the
191− same.
205+same.
192206
193207#### Accepts
194208
@@ -200,16 +214,18 @@ a `list`.
200214
201215#### Source
202216
203− ++ homo
217+```
218+ ++ homo
204219 |* a=(list)
205220 ^+ =< $
206221 |% +- $ ?:(*? ~ [i=(snag 0 a) t=$])
207222 --
208223 a
209−
224+```
210225
211226#### Examples
212227
228+```
213229 > lyst
214230 [i=1 t=[i=97 t=[i=2 t=[i=98 t=[i=[~ u=10] t=~]]]]]
215231
@@ -222,10 +238,10 @@ a `list`.
222238
223239 > (homo a)
224240 ~[1 2 3]
241+```
225242
226243
227−
228−***
244+---
229245### `++lent`
230246
231247List length
@@ -242,7 +258,8 @@ an atom.
242258
243259#### Source
244260
245− ++ lent
261+```
262+ ++ lent
246263 ~/ %lent
247264 |= a=(list)
248265 ^- @
@@ -250,19 +267,20 @@ an atom.
250267 |-
251268 ?~ a b
252269 $(a t.a, b +(b))
253−
270+```
254271
255272#### Examples
256273
274+```
257275 > (lent [1 2 3 4 ~]))
258276 4
259277
260278 > (lent [1 'a' 2 'b' (some 10) ~])
261279 5
280+```
262281
263282
264−
265−***
283+---
266284### `++levy`
267285
268286Logical "and" on list
@@ -281,6 +299,7 @@ A boolean.
281299
282300#### Source
283301
302+```
284303 ++ levy
285304 ~/ %levy :: all of
286305 |* [a=(list) b=$-(* ?)]
@@ -288,10 +307,11 @@ A boolean.
288307 ?~ a &
289308 ?. (b i.a) |
290309 $(a t.a)
291−
310+```
292311
293312#### Examples
294313
314+```
295315 > =a |=(a=@ (lte a 1))
296316 > (levy `(list @)`[0 1 2 1 ~] a)
297317 %.n
@@ -299,10 +319,11 @@ A boolean.
299319 > =a |=(a=@ (lte a 3))
300320 > (levy `(list @)`[0 1 2 1 ~] a)
301321 %.y
322+```
302323
303324
325+---
304326
305−***
306327### `++lien`
307328
308329Logical "or" on list
@@ -318,16 +339,19 @@ every element of `++list` `a`.
318339
319340#### Source
320341
321− ++ lien
342+```
343+ ++ lien
322344 ~/ %lien
323345 |* [a=(list) b=$-(* ?)]
324346 |- ^- ?
325347 ?~ a |
326348 ?: (b i.a) &
327349 $(a t.a)
350+```
328351
329352#### Examples
330353
354+```
331355 > =a |=(a=@ (gte a 1))
332356 > (lien `(list @)`[0 1 2 1 ~] a)
333357 %.y
@@ -335,10 +359,10 @@ every element of `++list` `a`.
335359 > =a |=(a=@ (gte a 3))
336360 > (lien `(list @)`[0 1 2 1 ~]) a)
337361 %.n
362+```
338363
339364
340−
341−***
365+---
342366### `++limo`
343367
344368List Constructor
@@ -355,21 +379,24 @@ A `++list`.
355379
356380#### Source
357381
382+```
358383 ++ limo :: listify
359384 |* a=*
360385 ^+ =< $
361386 |% +- $ ?~(a ~ ?:(_? i=-.a t=$ $(a +.a)))
362387 --
363388 a
389+```
364390
365391#### Examples
366392
393+```
367394 > (limo [1 2 3 ~])
368395 [i=1 t=[i=2 t=[i=3 t=~]]]
396+```
369397
370398
371−
372−***
399+---
373400### `++murn`
374401
375402Maybe transform
@@ -390,6 +417,7 @@ A unit.
390417
391418#### Source
392419
420+```
393421 ++ murn :: maybe transform
394422 ~/ %murn
395423 |* [a=(list) b=$-(* (unit))]
@@ -399,16 +427,18 @@ A unit.
399427 ?~ c
400428 $(a t.a)
401429 [i=u.c t=$(a t.a)]
430+```
402431
403432#### Examples
404433
434+```
405435 > =a |=(a=@ ?.((gte a 2) ~ (some (add a 10))))
406436 > (murn `(list @)`[0 1 2 3 ~] a)
407437 [i=12 t=[i=13 t=~]]
438+```
408439
409440
410−
411−***
441+---
412442### `++oust`
413443
414444Remove
@@ -426,22 +456,25 @@ A `++list`.
426456
427457#### Source
428458
459+```
429460 ++ oust :: remove
430461 ~/ %oust
431462 |* [[a=@ b=@] c=(list)]
432463 (weld (scag a c) (slag (add a b) c))
464+```
433465
434466#### Examples
435467
468+```
436469 > (oust [4 5] "good day, urbit!")
437470 "good urbit!"
438471
439472 > (oust [2 2] `(list @)`[1 2 3 4 ~])
440473 ~[1 2]
474+```
441475
442476
443−
444−***
477+---
445478### `++reap`
446479
447480Replicate
@@ -460,15 +493,18 @@ A list.
460493
461494#### Source
462495
496+```
463497 ++ reap :: replicate
464498 ~/ %reap
465499 |* [a=@ b=*]
466500 |- ^- (list _b)
467501 ?~ a ~
468502 [b $(a (dec a))]
503+```
469504
470505#### Examples
471506
507+```
472508 > (reap 20 %a)
473509 ~[%a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a]
474510
@@ -477,10 +513,10 @@ A list.
477513
478514 > `@dr`(roll (reap 5 ~s1) add)
479515 ~s5
516+```
480517
481518
482−
483−***
519+---
484520### `++reel`
485521
486522Right fold
@@ -504,17 +540,19 @@ The accumulator, which is a noun.
504540
505541#### Source
506542
507− ++ reel :: right fold
543+```
544+ ++ reel
508545 ~/ %reel
509546 |* [a=(list) b=_|=([* *] +<+)]
510547 |- ^+ +<+.b
511548 ?~ a
512549 +<+.b
513550 (b i.a $(a t.a))
514−
551+```
515552
516553#### Examples
517554
555+```
518556 > =sum =|([p=@ q=@] |.((add p q)))
519557 > (reel (limo [1 2 3 4 5 ~]) sum)
520558 15
@@ -526,10 +564,10 @@ The accumulator, which is a noun.
526564 > (reel (limo [3 6 1 ~]) a)
527565 ! subtract-underflow
528566 ! exit
567+```
529568
530569
531−
532−***
570+---
533571### `++roll`
534572
535573Left fold
@@ -553,6 +591,7 @@ The accumulator, which is a noun.
553591
554592#### Source
555593
594+```
556595 ++ roll :: left fold
557596 ~/ %roll
558597 |* [a=(list) b=_|=([* *] +<+)]
@@ -560,22 +599,26 @@ The accumulator, which is a noun.
560599 ?~ a
561600 +<+.b
562601 $(a t.a, b b(+<+ (b i.a +<+.b)))
602+```
563603
564604#### Examples
565605
606+```
566607 > =sum =|([p=@ q=@] |.((add p q)))
567608 > (roll (limo [1 2 3 4 5 ~]) sum)
568609 q=15
610+
569611 > =a =|([p=@ q=@] |.((sub p q)))
570612 > (roll (limo [6 3 1 ~]) a)
571613 ! subtract-underflow
572614 ! exit
615+
573616 > (roll (limo [1 3 6 ~]) a)
574617 q=4
618+```
575619
576620
577−
578−***
621+---
579622### `++scag`
580623
581624Prefix
@@ -595,24 +638,27 @@ A list of the same type as `b`.
595638
596639#### Source
597640
641+```
598642 ++ scag :: prefix
599643 ~/ %scag
600644 |* [a=@ b=(list)]
601645 |- ^+ b
602646 ?: |(?=(~ b) =(0 a)) ~
603647 [i.b $(b t.b, a (dec a))]
648+```
604649
605650#### Examples
606651
652+```
607653 > (scag 2 `(list @)`[1 2 3 4 ~])
608654 [i=0 t=~[1]]
609655
610656 > (scag 10 `(list @)`[1 2 3 4 ~])
611657 [i=1 t=~[2 3 4]]
658+```
612659
613660
614−
615−***
661+---
616662### `++skid`
617663
618664Separate
@@ -635,6 +681,7 @@ A cell of two lists.
635681
636682#### Source
637683
684+```
638685 ++ skid :: separate
639686 ~/ %skid
640687 |* [a=(list) b=$-(* ?)]
@@ -642,18 +689,19 @@ A cell of two lists.
642689 ?~ a [~ ~]
643690 =+ c=$(a t.a)
644691 ?:((b i.a) [[i.a p.c] q.c] [p.c [i.a q.c]])
645−
692+```
646693
647694
648695#### Examples
649696
697+```
650698 > =a |=(a=@ (gth a 1))
651699 > (skid `(list @)`[0 1 2 3 ~]) a)
652700 (skid `(list @)`[0 1 2 3 ~]) a)
701+```
653702
654703
655−
656−***
704+---
657705### `++skim`
658706
659707Suffix
@@ -674,6 +722,7 @@ A flag.
674722
675723#### Source
676724
725+```
677726 ++ skim :: only
678727 ~/ %skim
679728 |* [a=(list) b=$-(* ?)]
@@ -681,17 +730,17 @@ A flag.
681730 ^+ a
682731 ?~ a ~
683732 ?:((b i.a) [i.a $(a t.a)] $(a t.a))
684−
733+```
685734
686735#### Examples
687736
737+```
688738 > =a |=(a=@ (gth a 1))
689739 > (skim `(list @)`[0 1 2 3 ~] a)
690740 [i=2 t=~[3]]
741+```
691742
692−
693−
694−***
743+---
695744### `++skip`
696745
697746Except
@@ -712,6 +761,7 @@ A list of the same type as `a`.
712761
713762#### Source
714763
764+```
715765 ++ skip :: except
716766 ~/ %skip
717767 |* [a=(list) b=$-(* ?)]
@@ -719,17 +769,18 @@ A list of the same type as `a`.
719769 ^+ a
720770 ?~ a ~
721771 ?:((b i.a) $(a t.a) [i.a $(a t.a)])
722−
772+```
723773
724774#### Examples
725775
776+```
726777 > =a |=(a=@ (gth a 1))
727778 > (skip `(l)`[0 1 2 3 ~]) a)
728779 [i=0 t=[i=1 t=~]]
780+```
729781
730782
731−
732−***
783+---
733784### `++slag`
734785
735786Suffix
@@ -747,6 +798,7 @@ A list of the same type as `b`.
747798
748799#### Source
749800
801+```
750802 ++ slag :: suffix
751803 ~/ %slag
752804 |* [a=@ b=(list)]
@@ -754,18 +806,19 @@ A list of the same type as `b`.
754806 ?: =(0 a) b
755807 ?~ b ~
756808 $(b t.b, a (dec a))
757−
809+```
758810
759811#### Examples
760812
813+```
761814 > (slag 2 (limo [1 2 3 4 ~]))
762815 [i=3 t=[i=4 t=~]]
763816 > (slag 1 (limo [1 2 3 4 ~]))
764817 [i=2 t=[i=3 t=[i=4 t=~]]]
818+```
765819
766820
767−
768−***
821+---
769822### `++snag`
770823
771824Index
@@ -783,6 +836,7 @@ Produces an element of `b`, or crashes if no element exists at that index.
783836
784837#### Source
785838
839+```
786840 ++ snag :: index
787841 ~/ %snag
788842 |* [a=@ b=(list)]
@@ -791,18 +845,19 @@ Produces an element of `b`, or crashes if no element exists at that index.
791845 ~|('snag-fail' !!)
792846 ?: =(0 a) i.b
793847 $(b t.b, a (dec a))
794−
848+```
795849
796850#### Examples
797851
852+```
798853 > (snag 2 "asdf")
799854 ~~d
800855 > (snag 0 `(list @ud)`~[1 2 3 4])
801856 1
857+```
802858
803859
804−
805−***
860+---
806861### `++sort`
807862
808863Quicksort
@@ -821,6 +876,7 @@ A list
821876
822877#### Source
823878
879+```
824880 ++ sort !. :: quicksort
825881 ~/ %sort
826882 |* [a=(list) b=$-([* *] ?)]
@@ -831,17 +887,18 @@ A list
831887 $(a (skim t.a |=(c/_i.a (b c i.a))))
832888 ^+ t.a
833889 [i.a $(a (skim t.a |=(c/_i.a !(b c i.a))))]
834−
890+```
835891
836892#### Examples
837893
894+```
838895 > =a =|([p/@ q/@] |.((gth p q)))
839896 > (sort (limo [0 1 2 3 ~]) a)
840897 ~[3 2 1 0]
898+```
841899
842900
843−
844−***
901+---
845902### `++spin`
846903
847904Gate to list, with state
@@ -866,6 +923,7 @@ A list.
866923
867924#### Source
868925
926+```
869927 ++ spin
870928 ~/ %spin
871929 |* [a=(list) b=* c=_|=(^ [** +<+])]
@@ -876,11 +934,11 @@ A list.
876934 [(flop acc) b]
877935 =^ res b (c i.a b)
878936 $(acc [res acc], a t.a)
879−
937+```
880938
881939#### Examples
882940
883−
941+```
884942 > %^ spin (limo ~[4 5 6]) :: trivial example -- does nothing with the state
885943 |=([n=@ a=@] [n a])
886944 0
@@ -895,6 +953,7 @@ A list.
895953 |=([n=@ rng=_og] (rads:rng 10))
896954 ~(. og eny)
897955 ~[5 5 9 4 1 7 9 9 9 6]
956+```
898957
899958#### Discussion
900959
@@ -904,7 +963,7 @@ is the continuation of the RNG.
904963
905964
906965
907−***
966+---
908967### `++spun`
909968
910969Gate to list, with state
@@ -913,7 +972,7 @@ Accepts a `list` `a` and a gate `b`. `c` is internal state, initially
913972derived by *bunting* the tail of the sample of gate `b`, instead of
914973being passed in explicitly as in `++spin`. Produces a list with the
915974gate applied to each element of the original list. `b` is called with a tuple --
916− the head is an element of `a` and the tail is the state `c`, and should
975+the head is an element of `a` and the tail is the state `c`, and should
917976produce a tuple of the transformed element and the (potentially modified)
918977state `c`.
919978
@@ -929,26 +988,28 @@ A list.
929988
930989#### Source
931990
991+```
932992 ++ spun
933993 ~/ %spun
934994 |* [a=(list) b=_|=(^ [** +<+])]
935995 p:(spin a +<+.b b)
936−
996+```
937997
938998#### Examples
939999
1000+```
9401001 > %+ spun (limo ~[4 5 6]) :: `p` as the index and `q` as the list element
9411002 |=([n=@ a=@] [`(pair)`[a n] +(a)])
9421003 ~[[p=0 q=4] [p=1 q=5] [p=2 q=6]]
9431004
944− > =l (limo ~[7 8 9])
1005+ > =l (limo ~[7 8 9])
9451006 > %+ spun (limo ~[4 5 6]) :: joins two lists into a list of pairs
9461007 |=([n=@ a=@] [`(pair)`[(snag a l) n] +(a)])
9471008 ~[[p=7 q=4] [p=8 q=5] [p=9 q=6]]
1009+```
9481010
9491011
950−
951−***
1012+---
9521013### `++swag`
9531014
9541015Infix
@@ -966,22 +1027,24 @@ A list of the same type as `c`.
9661027
9671028#### Source
9681029
969− ++ swag
1030+```
1031+ ++ swag
9701032 |* [[a=@ a=@] c=(list)]
9711033 (scag +<-> (slag +<-< c))
972−
1034+```
9731035
9741036#### Examples
9751037
1038+```
9761039 > (swag [2 5] "roly poly")
9771040 "ly po"
9781041
9791042 > (swag [2 2] (limo [1 2 3 4 ~]))
9801043 [i=3 t=[i=4 t=~]]
1044+```
9811045
9821046
983−
984−***
1047+---
9851048### `++turn`
9861049
9871050Gate to list
@@ -999,28 +1062,31 @@ A list.
9991062
10001063#### Source
10011064
1002− ++ turn
1065+```
1066+ ++ turn
10031067 ~/ %turn
10041068 |* [a=(list) b=gate]
10051069 |-
10061070 ?~ a ~
10071071 [i=(b i.a) t=$(a t.a)]
1008−
1072+```
10091073
10101074#### Examples
10111075
1076+```
10121077 > (turn (limo [104 111 111 110 ~]) @t)
10131078 <|h o o n|>
10141079
10151080 > =a |=(a=@ (add a 4))
10161081 > (turn (limo [1 2 3 4 ~]) a)
10171082 ~[5 6 7 8]
1083+```
10181084
10191085#### Discussion
10201086
10211087`turn` is Hoon's version of 'map' in Haskell.
10221088
1023−***
1089+---
10241090### `++weld`
10251091
10261092Concatenate
@@ -1033,26 +1099,28 @@ Concatenate two `++list`s `a` and `b`.
10331099
10341100#### Source
10351101
1036− ++ weld
1102+```
1103+ ++ weld
10371104 ~/ %weld
10381105 |* [a=(list) b=(list)]
10391106 => .(a ^.(homo a), b ^.(homo b))
10401107 |- ^+ b
10411108 ?~ a b
10421109 [i.a $(a t.a)]
1043−
1110+```
10441111
10451112#### Examples
10461113
1114+```
10471115 > (weld "urb" "it")
10481116 ~[~~u ~~r ~~b ~~i ~~t]
10491117
10501118 > (weld (limo [1 2 ~]) (limo [3 4 ~]))
10511119 ~[1 2 3 4]
1120+```
10521121
10531122
1054−
1055−***
1123+---
10561124### `++welp`
10571125
10581126Perfect weld
@@ -1072,7 +1140,8 @@ A list.
10721140
10731141#### Source
10741142
1075− ++ welp
1143+```
1144+ ++ welp
10761145 =| [* *]
10771146 |%
10781147 +- $
@@ -1080,10 +1149,11 @@ A list.
10801149 +<-(. +<+)
10811150 +<-(+ $(+<- +<->))
10821151 --
1083−
1152+```
10841153
10851154#### Examples
10861155
1156+```
10871157 > (welp "foo" "bar")
10881158 "foobar"
10891159
@@ -1096,10 +1166,10 @@ A list.
10961166
10971167 > (welp [sa+1 so+2 ~] si=3)
10981168 [[%sa 1] [%so 2] si=3]
1169+```
10991170
11001171
1101−
1102−***
1172+---
11031173### `++zing`
11041174
11051175Cons
@@ -1117,7 +1187,8 @@ A list.
11171187
11181188#### Source
11191189
1120− ++ zing
1190+```
1191+ ++ zing
11211192 =| *
11221193 |%
11231194 +- $
@@ -1125,16 +1196,17 @@ A list.
11251196 +<
11261197 (welp +<- $(+< +<+))
11271198 --
1128−
1199+```
11291200
11301201
11311202#### Examples
11321203
1204+```
11331205 > (zing (limo [(limo ['a' 'b' 'c' ~]) (limo ['e' 'f' 'g' ~]) (limo ['h' 'i' 'j' ~]) ~]))
11341206 ~['a' 'b' 'c' 'e' 'f' 'g' 'h' 'i' 'j']
11351207
11361208 > (zing (limo [(limo [1 'a' 2 'b' ~]) (limo [3 'c' 4 'd' ~]) ~]))
11371209 ~[1 97 2 98 3 99 4 100]
1210+```
11381211
1139−
1140−***
1212+---
docs/reference/library/2c.umd+143−68
@@ -1,9 +1,12 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'6'
3+ title/'2c: Bit Arithmetic'
4+ ==
45
6+;>
57
68# 2c: bit arithmetic
9+
710### `++bex`
811
912Binary exponent
@@ -20,15 +23,18 @@ An atom.
2023
2124#### Source
2225
23− ++ bex
26+```
27+ ++ bex
2428 ~/ %bex
2529 |= a=@
2630 ^- @
2731 ?: =(0 a) 1
2832 (mul 2 $(a (dec a)))
33+```
2934
3035#### Examples
3136
37+```
3238 > (bex 4)
3339 16
3440
@@ -37,9 +43,9 @@ An atom.
3743
3844 > (bex 0)
3945 1
46+```
4047
41−***
42−
48+---
4349### `++can`
4450
4551Assemble
@@ -60,22 +66,25 @@ An atom.
6066
6167#### Source
6268
63− ++ can
69+```
70+ ++ can
6471 ~/ %can
6572 |= [a=bloq b=(list [p=@ q=@])]
6673 ^- @
6774 ?~ b 0
6875 (add (end a p.i.b q.i.b) (lsh a p.i.b $(b t.b)))
76+```
6977
7078#### Examples
7179
80+```
7281 > `@ub`21 :: @ub is the binary aura
73− 0b1.0101
82+ 0b1.0101
7483
75− > `@ub`(can 3 ~[[1 21]])
84+ > `@ub`(can 3 ~[[1 21]])
7685 0b1.0101
7786
78− > `@ub`(can 3 ~[[1 1]])
87+ > `@ub`(can 3 ~[[1 1]])
7988 0b1
8089
8190 > `@ub`(can 0 ~[[1 255]])
@@ -92,9 +101,9 @@ An atom.
92101
93102 > `@ux`(can 3 ~[[1 'a'] [2 'bc']])
94103 0x63.6261
104+```
95105
96−
97−***
106+---
98107### `++cat`
99108
100109Concatenate
@@ -116,14 +125,16 @@ An atom.
116125
117126#### Source
118127
119− ++ cat
128+```
129+ ++ cat
120130 ~/ %cat
121131 |= [a=bloq b=@ c=@]
122132 (add (lsh a (met a b) c) b)
123−
133+```
124134
125135#### Examples
126136
137+```
127138 > `@ub`(cat 3 1 0) :: @ub is the binary aura
128139 0b1
129140
@@ -153,9 +164,9 @@ An atom.
153164
154165 > (cat 2 256 255)
155166 1.044.736
167+```
156168
157−
158−***
169+---
159170### `++cut`
160171
161172Slice
@@ -179,13 +190,16 @@ An atom.
179190
180191#### Source
181192
182− ++ cut
193+```
194+ ++ cut
183195 ~/ %cut
184196 |= [a=bloq [b=@u c=@u] d=@]
185197 (end a c (rsh a b d))
198+```
186199
187200#### Examples
188201
202+```
189203 > (cut 0 [1 1] 2)
190204 1
191205
@@ -209,10 +223,10 @@ An atom.
209223
210224 > `@ub`(cut 0 [3 6] 0b1111.0000.1101)
211225 0b10.0001
226+```
212227
213228
214−
215−***
229+---
216230### `++end`
217231
218232Tail
@@ -234,14 +248,16 @@ An atom.
234248
235249#### Source
236250
237− ++ end
251+```
252+ ++ end
238253 ~/ %end
239254 |= [a=bloq b=@u c=@]
240255 (mod c (bex (mul (bex a) b)))
241−
256+```
242257
243258#### Examples
244259
260+```
245261 > (end 2 2 255)
246262 255
247263
@@ -274,10 +290,10 @@ An atom.
274290
275291 > `@t`(end 3 2 'abc') :: @t is the cord aura
276292 'ab'
293+```
277294
278295
279−
280−***
296+---
281297### `++fil`
282298
283299Fill bloqstream
@@ -298,7 +314,8 @@ An atom.
298314
299315#### Source
300316
301− ++ fil
317+```
318+ ++ fil
302319 |= [a=bloq b=@u c=@]
303320 =+ n=0
304321 =+ d=c
@@ -306,10 +323,11 @@ An atom.
306323 ?: =(n b)
307324 (rsh a 1 d)
308325 $(d (add c (lsh a 1 d)), n +(n))
309−
326+```
310327
311328#### Examples
312329
330+```
313331 > `@t`(fil 3 5 %a) :: @t is the cord (string) aura
314332 'aaaaa'
315333
@@ -324,10 +342,10 @@ An atom.
324342
325343 > `@ub`(fil 2 6 1) :: @ub is the binary aura
326344 0b1.0001.0001.0001.0001.0001
345+```
327346
328347
329−
330−***
348+---
331349### `++lsh`
332350
333351Left-shift
@@ -348,14 +366,16 @@ An atom.
348366
349367#### Source
350368
351− ++ lsh
369+```
370+ ++ lsh
352371 ~/ %lsh
353372 |= [a=bloq b=@u c=@]
354373 (mul (bex (mul (bex a) b)) c)
355−
374+```
356375
357376#### Examples
358377
378+```
359379 > `@ub`1 :: @ub is the binary aura
360380 0b1
361381
@@ -373,10 +393,10 @@ An atom.
373393
374394 > (lsh 3 1 255)
375395 65.280
396+```
376397
377398
378−
379−***
399+---
380400### `++met`
381401
382402Measure
@@ -391,7 +411,8 @@ Computes the number of blocks of size `a` in `b`, producing an atom.
391411
392412#### Source
393413
394− ++ met
414+```
415+ ++ met
395416 ~/ %met
396417 |= [a=bloq b=@]
397418 ^- @
@@ -399,9 +420,11 @@ Computes the number of blocks of size `a` in `b`, producing an atom.
399420 |-
400421 ?: =(0 b) c
401422 $(b (rsh a 1 b), c +(c))
423+```
402424
403425#### Examples
404426
427+```
405428 > (met 0 1)
406429 1
407430
@@ -416,10 +439,10 @@ Computes the number of blocks of size `a` in `b`, producing an atom.
416439
417440 > (met 3 'abcde')
418441 5
442+```
419443
420444
421−
422−***
445+---
423446### `++rap`
424447
425448Assemble non-zero
@@ -438,16 +461,19 @@ An atom.
438461
439462#### Source
440463
441− ++ rap
464+```
465+ ++ rap
442466 ~/ %rap
443467 |= [a=bloq b=(list @)]
444468 ^- @
445469 =+ ~
446470 ?~ b 0
447471 (cat a i.b $(b t.b))
472+```
448473
449474#### Examples
450475
476+```
451477 > `@ub`(rap 2 [1 2 3 4 ~]) :: @ub is the binary aura
452478 0b100.0011.0010.0001
453479
@@ -471,12 +497,13 @@ An atom.
471497
472498 > `@ub`11
473499 0b1011
500+```
474501
475502#### Discussion
476503
477504Any element of the value `0` is not included in concatenation.
478505
479−***
506+---
480507### `++rep`
481508
482509Assemble single
@@ -495,7 +522,8 @@ An atom.
495522
496523#### Source
497524
498− ++ rep
525+```
526+ ++ rep
499527 ~/ %rep
500528 |= [a=bloq b=(list @)]
501529 ^- @
@@ -503,9 +531,11 @@ An atom.
503531 |-
504532 ?~ b 0
505533 (add (lsh a c (end a 1 i.b)) $(c +(c), b t.b))
534+```
506535
507536#### Examples
508537
538+```
509539 > `@ub`(rep 2 [1 2 3 4 ~]) :: @ub is the binary aura
510540 0b100.0011.0010.0001
511541
@@ -535,10 +565,10 @@ An atom.
535565
536566 > `@ub`(rep 3 [12 166 8 34 ~])
537567 0b10.0010.0000.1000.1010.0110.0000.1100
568+```
538569
539570
540−
541−***
571+---
542572### `++rip`
543573
544574Disassemble
@@ -557,15 +587,18 @@ A list of atoms.
557587
558588#### Source
559589
560− ++ rip
590+```
591+ ++ rip
561592 ~/ %rip
562593 |= [a=bloq b=@]
563594 ^- (list @)
564595 ?: =(0 b) ~
565596 [(end a 1 b) $(b (rsh a 1 b))]
597+```
566598
567599#### Examples
568600
601+```
569602 > `@ub`155 :: @ub is the binary aura
570603 0b1001.1011
571604
@@ -592,10 +625,10 @@ A list of atoms.
592625
593626 > (rip 3 256)
594627 ~[0 1]
628+```
595629
596630
597−
598−***
631+---
599632### `++rsh`
600633
601634Right-shift
@@ -616,13 +649,16 @@ An atom.
616649
617650#### Source
618651
619− ++ rsh
652+```
653+ ++ rsh
620654 ~/ %rsh
621655 |= [a=bloq b=@u c=@]
622656 (div c (bex (mul (bex a) b)))
657+```
623658
624659#### Examples
625660
661+```
626662 > `@ub`145 :: @ub is the binary aura
627663 0b1001.0001
628664
@@ -655,10 +691,10 @@ An atom.
655691
656692 > `@ux`(rsh 3 1 'abc')
657693 0x6362
694+```
658695
659696
660−
661−***
697+---
662698### `++swp`
663699
664700Reverse block order
@@ -679,10 +715,13 @@ An atom
679715
680716#### Source
681717
682− ++ swp |=([a=bloq b=@] (rep a (flop (rip a b))))
718+```
719+ ++ swp |=([a=bloq b=@] (rep a (flop (rip a b))))
720+```
683721
684722#### Examples
685723
724+```
686725 > `@ub`24 :: @ub is the binary aura
687726 0b1.1000
688727
@@ -697,10 +736,10 @@ An atom
697736
698737 > (swp 0 128)
699738 1
739+```
700740
701741
702−
703−***
742+---
704743### `++xeb`
705744
706745Binary logarithm
@@ -717,14 +756,17 @@ An atom.
717756
718757#### Source
719758
720− ++ xeb
759+```
760+ ++ xeb
721761 ~/ %xeb
722762 |= a=@
723763 ^- @
724764 (met 0 a)
765+```
725766
726767#### Examples
727768
769+```
728770 > (xeb 31)
729771 5
730772
@@ -742,11 +784,11 @@ An atom.
742784
743785 > (xeb 2)
744786 2
787+```
745788
746789
747−
748−***
749−### `++fe`
790+---
791+### `++fe`
750792
751793Modulo bloq
752794
@@ -758,9 +800,11 @@ Core that contains arms for `bloq` and modular integer operations.
758800
759801#### Source
760802
803+```
761804 |_ a=bloq
805+```
762806
763−****
807+---
764808### `++dif`
765809
766810Produces the difference between two atoms in the modular basis
@@ -780,10 +824,13 @@ A `@s`
780824
781825#### Source
782826
827+```
783828 ++ dif |=([b=@ c=@] (sit (sub (add out (sit b)) (sit c))))
829+```
784830
785831#### Examples
786832
833+```
787834 > (~(dif fe 3) 63 64)
788835 255
789836
@@ -807,8 +854,9 @@ A `@s`
807854
808855 > (~(dif fe 2) 63 64)
809856 15
857+```
810858
811−***
859+---
812860### `++inv`
813861
814862Inverse
@@ -825,10 +873,13 @@ An atom.
825873
826874#### Source
827875
828− ++ inv |=(b=@ (sub (dec out) (sit b)))
876+```
877+ ++ inv |=(b=@ (sub (dec out) (sit b)))
878+```
829879
830880#### Examples
831881
882+```
832883 > (~(inv fe 3) 255)
833884 0
834885
@@ -846,8 +897,9 @@ An atom.
846897
847898 > (~(inv fe 3) 55)
848899 200
900+```
849901
850−***
902+---
851903### `++net`
852904
853905Flip endianness
@@ -864,7 +916,8 @@ An atom.
864916
865917#### Source
866918
867− ++ net |= b=@ ^- @
919+```
920+ ++ net |= b=@ ^- @
868921 => .(b (sit b))
869922 ?: (lte a 3)
870923 b
@@ -872,9 +925,11 @@ An atom.
872925 %+ con
873926 (lsh c 1 $(a c, b (cut c [0 1] b)))
874927 $(a c, b (cut c [1 1] b))
928+```
875929
876930#### Examples
877931
932+```
878933 > (~(net fe 3) 64)
879934 64
880935
@@ -931,8 +986,9 @@ An atom.
931986
932987 > (~(net fe 6) 5)
933988 360.287.970.189.639.680
989+```
934990
935−***
991+---
936992### `++out`
937993
938994Max integer value
@@ -949,10 +1005,13 @@ An atom.
9491005
9501006#### Source
9511007
1008+```
9521009 ++ out (bex (bex a))
1010+```
9531011
9541012#### Examples
9551013
1014+```
9561015 > ~(out fe 0)
9571016 2
9581017
@@ -976,8 +1035,9 @@ An atom.
9761035 462.881.473.913.110.540.827.237.163.350.510.684.586.298.239.947.245.938.479
9771036 .716.304.835.356.329.624.224.137.216
9781037 \/ \/
1038+```
9791039
980−***
1040+---
9811041### `++rol`
9821042
9831043Roll left
@@ -1000,14 +1060,17 @@ An atom.
10001060
10011061#### Source
10021062
1003− ++ rol |= [b=bloq c=@ d=@] ^- @
1063+```
1064+ ++ rol |= [b=bloq c=@ d=@] ^- @
10041065 =+ e=(sit d)
10051066 =+ f=(bex (sub a b))
10061067 =+ g=(mod c f)
10071068 (sit (con (lsh b g e) (rsh b (sub f g) e)))
1069+```
10081070
10091071#### Examples
10101072
1073+```
10111074 > `@ux`(~(rol fe 6) 4 3 0xabac.dedf.1213)
10121075 0x1213.0000.abac.dedf
10131076
@@ -1022,8 +1085,9 @@ An atom.
10221085
10231086 > `@t`(~(rol fe 5) 3 0 'dfgh')
10241087 'dfgh'
1088+```
10251089
1026−***
1090+---
10271091### `++ror`
10281092
10291093Roll right
@@ -1046,15 +1110,17 @@ An atom.
10461110
10471111#### Source
10481112
1049− ++ ror |= [b=bloq c=@ d=@] ^- @
1113+```
1114+ ++ ror |= [b=bloq c=@ d=@] ^- @
10501115 =+ e=(sit d)
10511116 =+ f=(bex (sub a b))
10521117 =+ g=(mod c f)
10531118 (sit (con (rsh b g e) (lsh b (sub f g) e)))
1054−
1119+```
10551120
10561121#### Examples
10571122
1123+```
10581124 > `@ux`(~(ror fe 6) 4 1 0xabac.dedf.1213)
10591125 0x1213.0000.abac.dedf
10601126
@@ -1072,8 +1138,9 @@ An atom.
10721138
10731139 > `@t`(~(rol fe 5) 3 2 'hijk')
10741140 'jkhi'
1141+```
10751142
1076−***
1143+---
10771144### `++sit`
10781145
10791146Enforce modulo
@@ -1092,10 +1159,13 @@ An atom.
10921159
10931160#### Source
10941161
1095− ++ sit |=(b=@ (end a 1 b))
1162+```
1163+ ++ sit |=(b=@ (end a 1 b))
1164+```
10961165
10971166#### Examples
10981167
1168+```
10991169 > (~(sit fe 3) 255)
11001170 255
11011171
@@ -1128,8 +1198,9 @@ An atom.
11281198
11291199 > (~(sit fe 0) 1)
11301200 1
1201+```
11311202
1132−***
1203+---
11331204
11341205### `++sum`
11351206
@@ -1151,10 +1222,13 @@ An atom.
11511222
11521223#### Source
11531224
1154− ++ sum |=([b=@ c=@] (sit (add b c)))
1225+```
1226+ ++ sum |=([b=@ c=@] (sit (add b c)))
1227+```
11551228
11561229#### Examples
11571230
1231+```
11581232 > (~(sum fe 3) 10 250)
11591233 4
11601234
@@ -1175,5 +1249,6 @@ An atom.
11751249
11761250 > (~(sum fe 4) 10.000 100.000)
11771251 44.464
1252+```
11781253
1179−***
1254+---
docs/reference/library/2d.umd+51−23
@@ -1,9 +1,12 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'7'
3+ title/'2d: Bit Logic'
4+ ==
45
6+;>
57
68# 2d: bit logic
9+
710### `++con`
811
912Binary OR
@@ -22,7 +25,8 @@ An atom.
2225
2326#### Source
2427
25− ++ con
28+```
29+ ++ con
2630 ~/ %con
2731 |= [a=@ b=@]
2832 =+ [c=0 d=0]
@@ -38,9 +42,11 @@ An atom.
3842 =(0 (end 0 1 b))
3943 ==
4044 ==
45+```
4146
4247#### Examples
4348
49+```
4450 > (con 0b0 0b1)
4551 1
4652
@@ -51,7 +57,7 @@ An atom.
5157 0
5258
5359 > `@ub`(con 0b1111.0000 0b1.0011)
54− 0b1111.0011
60+ 0b1111.0011
5561
5662 > (con 4 4)
5763 4
@@ -70,7 +76,7 @@ An atom.
7076
7177 > (con 534 987)
7278 991
73−
79+```
7480
7581#### Discussion
7682
@@ -80,11 +86,13 @@ sample. If either bit is 1, the corresponding product bit is set
8086to 1. Otherwise, the corresponding product bit is set to 0.
8187
8288Take the example of `(con 8 12)`. It's easy to see how this operation works when
83− its samples and its product are stacked.
89+its samples and its product are stacked.
8490
91+```
8592 0b1000 :: 8 (sample)
8693 0b1100 :: 12 (sample)
8794 0b1100 :: 12 (product)
95+```
8896
8997Note that the names `con` (conjunction) for OR and `dis` (disjunction) for AND
9098are given to opposite operators in Hoon when compared to other computing
@@ -93,7 +101,7 @@ where `0` is false and `1` is true, bitwise OR is the logical disjunction and
93101bitwise AND is the logical conjunction.
94102
95103
96−***
104+---
97105### `++dis`
98106
99107Binary AND
@@ -112,7 +120,8 @@ An atom.
112120
113121#### Source
114122
115− ++ dis
123+```
124+ ++ dis
116125 ~/ %dis
117126 |= [a=@ b=@]
118127 =| [c=@ d=@]
@@ -128,9 +137,11 @@ An atom.
128137 =(0 (end 0 1 b))
129138 ==
130139 ==
140+```
131141
132142#### Examples
133143
144+```
134145 > `@ub`9
135146 0b1001
136147
@@ -154,7 +165,7 @@ An atom.
154165
155166 > (dis 534 987)
156167 530
157−
168+```
158169
159170#### Discussion
160171
@@ -166,9 +177,11 @@ corresponding product bit is set to 0.
166177Take the example of `(dis 8 12)`. It's easy to see how this operation works when
167178its samples and its product are stacked.
168179
169− 0b1000 :: 8 (sample)
170− 0b1100 :: 12 (sample)
171− 0b1000 :: 8 (product)
180+```
181+ 0b1000 :: 8 (sample)
182+ 0b1100 :: 12 (sample)
183+ 0b1000 :: 8 (product)
184+```
172185
173186Note that the names `dis` (disjunction) for AND and `con` (conjuction) for OR
174187are given to opposite operators in Hoon when compared to other computing
@@ -176,7 +189,7 @@ contexts. That's because `0` is true in Hoon and `1` is false. Outside of Hoon,
176189where `0` is false and `1` is true, bitwise OR is the logical disjunction and
177190bitwise AND is the logical conjunction.
178191
179−***
192+---
180193### `++mix`
181194
182195Binary XOR
@@ -195,7 +208,8 @@ An atom.
195208
196209#### Source
197210
198− ++ mix
211+```
212+ ++ mix
199213 ~/ %mix
200214 |= [a=@ b=@]
201215 ^- @
@@ -208,9 +222,11 @@ An atom.
208222 c +(c)
209223 d (add d (lsh 0 c =((end 0 1 a) (end 0 1 b))))
210224 ==
225+```
211226
212227#### Examples
213228
229+```
214230 > `@ub`2
215231 0b10
216232
@@ -240,6 +256,7 @@ An atom.
240256
241257 > (mix 534 987)
242258 461
259+```
243260
244261#### Discussion
245262
@@ -251,11 +268,13 @@ bit is set to 1. Otherwise, the corresponding product bit is set to 0.
251268Take the example of `(mix 8 12)`. It's easy to see how this operation works when
252269its samples and its product are stacked.
253270
254− 0b1000 :: 8 (sample)
255− 0b1100 :: 12 (sample)
256− 0b100 :: 4 (product)
271+```
272+ 0b1000 :: 8 (sample)
273+ 0b1100 :: 12 (sample)
274+ 0b100 :: 4 (product)
275+```
257276
258−***
277+---
259278### `++not`
260279
261280Binary NOT
@@ -277,12 +296,14 @@ An atom.
277296
278297#### Source
279298
280− ++ not |= [a=bloq b=@ c=@]
299+```
300+ ++ not |= [a=bloq b=@ c=@]
281301 (mix c (dec (bex (mul b (bex a)))))
282−
302+```
283303
284304#### Examples
285305
306+```
286307 > `@ub`24
287308 0b1.1000
288309
@@ -300,6 +321,7 @@ An atom.
300321
301322 > (not 1 1 (not 1 1 10))
302323 10
324+```
303325
304326#### Discussion
305327
@@ -312,37 +334,43 @@ their [block size](../1c). Decimal `7`, for example, is `0b111` in binary, and
312334has one implicit zero in the context of a block of size `2`, which has a
313335bitwidth of 4. Let's try `not` on `7` with a single block of size `2`.
314336
337+```
315338 > `@ub`(not 2 1 0b111)
316339 0b1000
317340
318341 > `@u`0b1000
319342 8
343+```
320344
321345This happened because `0b111` is considered as `0b0111` by the `not` operator
322346when dealing with a single block of size `2`. The NOT of `7`, then, is `0b1000`,
323− or `8` in decimal.
347+or `8` in decimal.
324348
325349When we pass `not` a single block of size `3`, there is a bitwidth of 8 to
326350fill with binary information. So the remaining leading digits of `0b111` are,
327351again, treated as `0`.
328352
353+```
329354 > `@ub`(not 3 1 0b111)
330355 0b1111.1000
331356
332357 > `@u`0b1111.1000
333358 248
359+```
334360
335361This works when going to a smaller block size, too.
336362
363+```
337364 > `@ub`(not 1 1 0b1011)
338365 0b100
339366
340367 > `@u`0b100
341368 4
369+```
342370
343371What's happening here may not be readily apparent. But we're only flipping the
344372last block of size `1` (bitwidth 2) of the binary `0b111`. That is, we leave
345373the "0b1" piece just the same and manipulate the "11" that the number ends with.
346374
347375
348−***
376+---
docs/reference/library/2e.umd+34−20
@@ -1,9 +1,12 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'8'
3+ title/'2e: Insecure Hashing'
4+ ==
45
6+;>
57
68# 2e: insecure hashing
9+
710### `++fnv`
811
912FNV scrambler
@@ -22,10 +25,13 @@ An atom.
2225
2326#### Source
2427
25− ++ fnv |=(a=@ (end 5 1 (mul 16.777.619 a)))
28+```
29+ ++ fnv |=(a=@ (end 5 1 (mul 16.777.619 a)))
30+```
2631
2732#### Examples
2833
34+```
2935 > (fnv 10.000)
3036 272.465.456
3137
@@ -34,10 +40,10 @@ An atom.
3440
3541 > (fnv 1)
3642 16.777.619
43+```
3744
3845
39−
40−***
46+---
4147### `++mug`
4248
4349FNV-1a scrambler
@@ -55,7 +61,8 @@ An atom.
5561
5662#### Source
5763
58− ++ mug
64+```
65+ ++ mug
5966 ~/ %mug
6067 |= a=*
6168 ?^ a
@@ -75,10 +82,11 @@ An atom.
7582 ?. =(0 f) f
7683 ^$(b +(b))
7784 $(c (fnv (mix c (cut 3 [d 1] a))), d +(d))
78−
85+```
7986
8087#### Examples
8188
89+```
8290 > (mug 10.000)
8391 178.152.889
8492
@@ -93,10 +101,10 @@ An atom.
93101
94102 > (mug [1 2 3 4 5 ~])
95103 1.067.931.605
104+```
96105
97106
98−
99−***
107+---
100108### `++muk`
101109
102110Standard MurmurHash3
@@ -119,7 +127,9 @@ in [blocks](../2c) of size 3, and `c` as the key, producing an atom.
119127An atom.
120128
121129#### Source
122− ++ muk
130+
131+```
132+ ++ muk
123133 ~% %muk ..muk ~
124134 =+ ~(. fe 5)
125135 |= [syd=@ len=@ key=@]
@@ -133,7 +143,7 @@ An atom.
133143 =/ i nblocks
134144 =. h1 =/ hi h1 |-
135145 ?: =(0 i) hi :: negative array index
136− =/ k1 (snag (sub nblocks i) blocks)
146+ =/ k1 (snag (sub nblocks i) blocks)
137147 =. k1 (sit (mul k1 c1))
138148 =. k1 (rol 0 15 k1)
139149 =. k1 (sit (mul k1 c2))
@@ -176,10 +186,11 @@ An atom.
176186 =. h (mix h (rsh 0 16 h))
177187 h
178188 --
179−
189+```
180190
181191#### Examples
182192
193+```
183194 > (muk 6 1 3)
184195 3.427.677.118
185196
@@ -205,12 +216,12 @@ An atom.
205216 > e
206217 44.228
207218
208− > (muk e 11 10.000)
219+ > (muk e 11 10.000)
209220 246.077.549
221+```
210222
211223
212−
213−***
224+---
214225### `++mum`
215226
21622731-bit MurmurHash3 scrambler
@@ -228,20 +239,23 @@ An atom.
228239
229240#### Source
230241
231− ++ mum
242+```
243+ ++ mum
232244 ~/ %mum
233245 |= a=*
234246 |^ (trim ?@(a a (mix $(a -.a) (mix 0x7fff.ffff $(a +.a)))))
235− ++ trim
247+ ++ trim
236248 |= key=@
237249 =+ syd=0xcafe.babe
238250 |- ^- @
239251 =+ haz=(muk syd (met 3 key) key)
240252 =+ ham=(mix (rsh 0 31 haz) (end 0 31 haz))
241253 ?.(=(0 ham) ham $(syd +(syd)))
254+```
242255
243256#### Examples
244257
258+```
245259 > (mum 10.000)
246260 795.713.195
247261
@@ -259,7 +273,7 @@ An atom.
259273
260274 > (mum [1 2 3 4 5 ~])
261275 1.719.833.228
276+```
262277
263278
264−
265−***
279+---
docs/reference/library/2f.umd+462−26
@@ -1,9 +1,13 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'9'
3+ title/'2f: Noun Ordering'
4+ ==
5+
6+;>
47
58
69# 2f: noun ordering
10+
711### `++aor`
812
913Alphabetical order
@@ -22,7 +26,8 @@ A flag.
2226
2327#### Source
2428
25− ++ aor
29+```
30+ ++ aor
2631 ~/ %aor
2732 |= [a=* b=*]
2833 ^- ?
@@ -38,9 +43,11 @@ A flag.
3843 ?: =(c d)
3944 $(a (rsh 3 1 a), b (rsh 3 1 b))
4045 (lth c d)
46+```
4147
4248#### Examples
4349
50+```
4451 > (aor 'a' 'b')
4552 %.y
4653
@@ -67,10 +74,10 @@ A flag.
6774
6875 > (aor 10 9)
6976 %.n
77+```
7078
7179
72−
73−***
80+---
7481### `++dor`
7582
7683Numeric order
@@ -89,7 +96,8 @@ A flag.
8996
9097#### Source
9198
92− ++ dor
99+```
100+ ++ dor
93101 ~/ %dor
94102 |= [a=* b=*]
95103 ^- ?
@@ -101,10 +109,11 @@ A flag.
101109 $(a -.a, b -.b)
102110 ?. ?=(@ b) &
103111 (lth a b)
104−
112+```
105113
106114#### Examples
107115
116+```
108117 > (dor 1 2)
109118 %.y
110119
@@ -122,6 +131,7 @@ A flag.
122131
123132 > (dor ~[99 101 10.999] `(list @)`~[99 100 10.000])
124133 %.n
134+```
125135
126136#### Discussion
127137
@@ -133,7 +143,7 @@ If one sample is a cell and the other is an atom, the cell sample is treated as
133143"greater."
134144
135145
136−***
146+---
137147### `++gor`
138148
139149Hash order
@@ -156,7 +166,8 @@ A flag.
156166
157167#### Source
158168
159− ++ gor
169+```
170+ ++ gor
160171 ~/ %gor
161172 |= [a=* b=*]
162173 ^- ?
@@ -164,10 +175,11 @@ A flag.
164175 ?: =(c d)
165176 (dor a b)
166177 (lth c d)
167−
178+```
168179
169180#### Examples
170181
182+```
171183 > (gor 'd' 'c')
172184 %.y
173185
@@ -183,7 +195,7 @@ A flag.
183195 > `@ud`'c'
184196 99
185197
186− > (mug 'd')
198+ > (mug 'd')
187199 1.628.185.714
188200
189201 > (mug 'c')
@@ -200,6 +212,7 @@ A flag.
200212
201213 > (gor (some 10) `(list @)`[1 2 3 ~])
202214 %.n
215+```
203216
204217#### Discussion
205218
@@ -207,7 +220,7 @@ A flag.
207220vertical order. `map`s only look at the keys (the head of the key-value pair
208221elements) for ordering.
209222
210−***
223+---
211224### `++hor`
212225
213226Horizontal hash order
@@ -234,7 +247,8 @@ A flag.
234247
235248#### Source
236249
237− ++ hor
250+```
251+ ++ hor
238252 ~/ %hor
239253 |= [a=* b=*]
240254 ^- ?
@@ -245,10 +259,11 @@ A flag.
245259 ?: =(-.a -.b)
246260 (gor +.a +.b)
247261 (gor -.a -.b)
248−
262+```
249263
250264#### Examples
251265
266+```
252267 > (hor . 1)
253268 %.n
254269
@@ -281,7 +296,7 @@ A flag.
281296
282297 > (hor `(list @)`[50 500 5.000 ~] 1)
283298 %.n
284−
299+```
285300
286301#### Discussion
287302
@@ -289,7 +304,7 @@ Sets (+set, +in) use `hor` for their horizontal order and `vor` for their
289304vertical order. See [`apt:in`](../2h) to see how a set verifies its correctness.
290305`vor` is used to verify.
291306
292−***
307+---
293308### `++lor`
294309
295310Leg order
@@ -309,7 +324,8 @@ A flag.
309324
310325#### Source
311326
312− ++ lor
327+```
328+ ++ lor
313329 ~/ %lor
314330 |= [a=* b=*]
315331 ^- ?
@@ -320,17 +336,18 @@ A flag.
320336 ?: =(-.a -.b)
321337 $(a +.a, b +.b)
322338 $(a -.a, b -.b)
323−
339+```
324340
325341#### Examples
326342
343+```
327344 > (lor 1 2)
328345 %.y
329346
330347 > (lor 2 1)
331348 %.n
332349
333− > (lor 9 [1 2])
350+ > (lor 9 [1 2])
334351 %.y
335352
336353 > (lor `(list @)`[1 2 3 ~] `(list @)`[1 2 3 4 ~])
@@ -350,13 +367,13 @@ A flag.
350367
351368 > (lor [1 2 3] [1 2])
352369 !! exit
353−
370+```
354371
355372#### Discussion
356373
357374`lor` is no longer used internally.
358375
359−***
376+---
360377### `++vor`
361378
362379Vertical order
@@ -380,7 +397,8 @@ A flag.
380397
381398#### Source
382399
383− ++ vor
400+```
401+ ++ vor
384402 ~/ %vor
385403 |= [a=* b=*]
386404 ^- ?
@@ -388,10 +406,11 @@ A flag.
388406 ?: =(c d)
389407 (dor a b)
390408 (lth c d)
391−
409+```
392410
393411#### Examples
394412
413+```
395414 > (vor 'f' 'g')
396415 %.y
397416
@@ -406,7 +425,7 @@ A flag.
406425
407426 > (vor 43.326 41.106)
408427 %.n
409−
428+```
410429
411430#### Discussion
412431
@@ -419,4 +438,421 @@ correlation with single-`mug`ged `hor`. Vertical order becomes uncorrelated
419438with horizontal order.
420439
421440
422−***
441+---
442+
443+### `++noun`
444+
445+```
446+ ++ noun ,* :: any noun
447+```
448+
449+Used nowhere XX
450+
451+```
452+ > `noun`~[1 2 3]
453+ [1 2 3 0]
454+```
455+
456+
457+---
458+
459+### `++null`
460+
461+```
462+ ++ null ,~ :: null, nil, etc
463+```
464+
465+Used nowhere XX
466+
467+```
468+ > :type; *null
469+ ~
470+ %~
471+```
472+
473+
474+---
475+
476+### `++port`
477+
478+XX move to `++ut`
479+
480+Type and location of core-shaped thing? XX Compiler Internals
481+
482+#### Source
483+
484+```
485+ ++ port $: p=axis ::
486+ $= q ::
487+ $% [%& p=type] ::
488+ [%| p=axis q=(list ,[p=type q=foot])] ::
489+ == ::
490+ == ::
491+```
492+
493+#### Examples
494+
495+```
496+ > *port
497+ [p=0 q=[%.y p=%void]]
498+```
499+
500+
501+---
502+
503+### `++span`
504+
505+ASCII atom
506+
507+A restricted text atom for canonical atom syntaxes. The prefix is `~.`.
508+There are no escape sequences except `~~`, which means `~`, and `~-`,
509+which means `_`. `-` and `.` encode themselves. No other characters
510+besides numbers and lowercase letters are permitted.
511+
512+#### Source
513+
514+```
515+ ++ span ,@ta :: text-atom (ASCII)
516+```
517+
518+
519+#### Examples
520+
521+```
522+ > *span
523+ ~.
524+
525+ > `@t`~.foo
526+ 'foo'
527+ > `@t`~.foo.bar
528+ 'foo.bar'
529+ > `@t`~.foo~~bar
530+ 'foo~bar'
531+ > `@t`~.foo~-bar
532+ 'foo_bar'
533+ > `@t`~.foo-bar
534+ 'foo-bar'
535+```
536+
537+
538+---
539+
540+### `++tiki`
541+
542+XX move to `++ut`
543+
544+#### Source
545+
546+```
547+ ++ tiki :: test case
548+```
549+
550+#### Examples
551+
552+```
553+A `++wing` or `++hoon`.
554+
555+ > (ream '=+ a=4 ?-(a @ ~)')
556+ [ %tsls
557+ p=[%ktts p=p=%a q=[%dtzy p=%ud q=4]]
558+ q
559+ [ %wthz
560+ p=[%.y p=~ q=~[%a]]
561+ q=~[[p=[%axil p=[%atom p=~.]] q=[%bczp p=%null]]]
562+ ]
563+ ]
564+ > (ream '=+ a=4 ?-(4 @ ~)')
565+ [ %tsls
566+ p=[%ktts p=p=%a q=[%dtzy p=%ud q=4]]
567+ q
568+ [ %wthz
569+ p=[%.n p=~ q=[%dtzy p=%ud q=4]]
570+ q=~[[p=[%axil p=[%atom p=~.]] q=[%bczp p=%null]]]
571+ ]
572+ ]
573+```
574+
575+
576+---
577+
578+### `++toga`
579+
580+Tree of faces
581+
582+A face, or tree of faces. A `++toga` is applied to anything assigned
583+using `^=`.
584+
585+XX move to `++ut` and rune doc (for \^= examples)
586+
587+#### Source
588+
589+```
590+ ++ toga :: face control
591+ [2 p=toga q=toga] :: cell toga
592+ == ::
593+```
594+
595+#### Examples
596+
597+```
598+ > a=1
599+ a=1
600+ > (ream 'a=1')
601+ [%ktts p=p=%a q=[%dtzy p=%ud q=1]]
602+ > [a b]=[1 2 3]
603+ [a=1 b=[2 3]]
604+ > (ream '[a b]=[1 2 3]')
605+ [ %ktts
606+ p=[%2 p=p=%a q=p=%b]
607+ q=[%cltr p=~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]]
608+ ]
609+
610+ > [a ~]=[1 2 3]
611+ [a=1 2 3]
612+ > (ream '[a ~]=[1 2 3]')
613+ [ %ktts
614+ p=[%2 p=p=%a q=[%0 ~]]
615+ q=[%cltr p=~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]]
616+ ]
617+```
618+
619+
620+---
621+
622+### `++tone`
623+
624+Intermediate Nock computation result
625+
626+Similar to `++toon`, but stack trace is not yet rendered.
627+
628+#### Source
629+
630+```
631+ ++ tone $% [%0 p=*] :: success
632+```
633+
634+#### Examples
635+
636+```
637+ > (mink [[20 21] 0 3] ,~)
638+ [%0 p=21]
639+
640+ > (mink [[0] !=(.^(cy//=main/1))] ,~)
641+ [%1 p=~[[31.075 1.685.027.454 1.852.399.981 49 0]]]
642+ > (path [31.075 1.685.027.454 1.852.399.981 49 0])
643+ /cy/~zod/main/1
644+
645+ > (mink [[1 2] !=(~|(%hi +(.)))] ,~)
646+ [%2 p=~[[~.yelp 26.984]]]
647+ > (mink [[1 2] !=(!:(+(.)))] ,~)
648+ [ %2
649+ p
650+ ~[
651+ [ ~.spot
652+ [ [ 1.685.027.454
653+ 7.959.156
654+ \/159.445.990.350.374.058.574.398.238.344.143.957.205.628.479.572.65\/
655+ 8.112.403.878.526
656+ \/ \/
657+ 0
658+ ]
659+ [1 20]
660+ 1
661+ 24
662+ ]
663+ ]
664+ ]
665+ ]
666+```
667+
668+
669+---
670+
671+### `++tuna`
672+
673+XML template tree
674+
675+An XML template tree.
676+
677+#### Source
678+
679+```
680+ ++ tuna :: tagflow
681+ [%d p=hoon] :: dynamic list
682+ [%e p=hoon q=(list tuna)] :: element
683+ [%f p=(list tuna)] :: subflow
684+ == ::
685+```
686+
687+#### Examples
688+
689+Leaf %a contains plain-text, %b an empty tag, %c a static list, %d a
690+dynamic list, %e a full node element containing a hoon and a list of
691+tuna, and %f is a empty node.
692+
693+See also: `++sail`
694+
695+
696+
697+---
698+
699+### `++tusk`
700+
701+List of expressions
702+
703+List of `++hoon`s. In `:*`, for example, your contents is
704+a `++tusk`.
705+
706+#### Source
707+
708+```
709+ ++ tusk (list hoon) ::
710+```
711+
712+#### Examples
713+
714+```
715+ > (ream '[1 2 3]')
716+ [%cltr p=~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]]
717+ > (tusk +:(ream '[1 2 3]'))
718+ ~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]
719+```
720+
721+
722+---
723+
724+### `++hoon`
725+
726+Expression
727+
728+An expression, or AST.
729+
730+See Rune section of Hoon reference
731+
732+
733+
734+---
735+
736+### `++tyke`
737+
738+List of 'maybe' hoons
739+
740+List of `++unit` `++hoon`, or gaps left to be inferred, in `++path`
741+parsing. When you use a path such as `/=main=/pub/src/doc` the path is in fact
742+a `++tyke`, where the `=` are inferred from your current path.
743+
744+
745+#### Source
746+
747+```
748+ ++ tyke (list (unit hoon)) ::
749+```
750+
751+#### Examples
752+
753+```
754+ > (scan "/==as=" porc:vast)
755+ [0 ~[~ ~ [~ [%dtzy p=%tas q=29.537]] ~]]
756+ > `tyke`+:(scan "/==as=" porc:vast)
757+ ~[~ ~ [~ [%dtzy p=%tas q=29.537]] ~]
758+```
759+
760+
761+---
762+
763+### `++typo`
764+
765+Pointer for `++type`
766+
767+Pointer for `++type`. `++typo` preserves the previous `++type` in your
768+context when upating.
769+
770+#### Source
771+
772+```
773+ ++ typo type :: old type
774+```
775+
776+#### Examples
777+
778+See also: `++seem`, `++vise`, `++type`
779+
780+
781+
782+---
783+
784+### `++tyre`
785+
786+List, term hoon
787+
788+Associative list of `++term` `++hoon`, used in jet hint processing.
789+
790+#### Source
791+
792+```
793+ ++ tyre (list ,[p=term q=hoon]) ::
794+```
795+
796+
797+---
798+
799+### `++vase`
800+
801+Typed data. A `++vase` is used wherever typed data is explicitly worked
802+with.
803+
804+#### Source
805+
806+```
807+ ++ vase ,[p=type q=*] :: type-value pair
808+```
809+
810+#### Examples
811+
812+```
813+ > `vase`!>(~)
814+ [p=[%cube p=0 q=[%atom p=%n]] q=0]
815+```
816+
817+
818+---
819+
820+### `++vise`
821+
822+Convert during reboot
823+
824+Used to convert from previously-typed data during reboot.
825+
826+#### Source
827+
828+```
829+ ++ vise ,[p=typo q=*] :: old vase
830+```
831+
832+#### Examples
833+
834+See also: `++typo`, `++seer`
835+
836+
837+
838+---
839+
840+### `++wing`
841+
842+```
843+ ++ wing (list limb) ::
844+```
845+
846+Address in subject. A `++wing` is a path to a value in the subject. A
847+term alone is the trivial case of a `++wing`.
848+
849+See also: `++hoon`
850+
851+```
852+ > (ream 'a.+.c')
853+ [%cnzz p=~[%a [%.y p=3] %c]]
854+ > (wing +:(ream 'a.+.c'))
855+ ~[%a [%.y p=3] %c]
856+```
857+
858+---
docs/reference/library/2g.umd+19−10
@@ -1,9 +1,12 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'10'
3+ title/'2g: Unsigned Powers'
4+ ==
45
6+;>
57
68# 2g: unsigned powers
9+
710### `++pow`
811
912Computes `a` raised to the power of `b`, producing an atom.
@@ -20,7 +23,8 @@ An atom.
2023
2124#### Source
2225
23− ++ pow
26+```
27+ ++ pow
2428 ~/ %pow
2529 |= [a=@ b=@]
2630 ?: =(b 0) 1
@@ -28,9 +32,11 @@ An atom.
2832 =+ c=$(b (div b 2))
2933 =+ d=(mul c c)
3034 ?~ (dis b 1) d (mul d a)
35+```
3136
3237#### Examples
3338
39+```
3440 > (pow 2 6)
3541 64
3642
@@ -45,10 +51,9 @@ An atom.
4551
4652 > `@ux`(pow 0x1b 2)
4753 0x2d9
54+```
4855
49−
50−
51−***
56+---
5257### `++sqt`
5358
5459Computes the square root of `a` and its remainder.
@@ -62,7 +67,9 @@ Computes the square root of `a` and its remainder.
6267A cell of atoms.
6368
6469#### Source
65− ++ sqt
70+
71+```
72+ ++ sqt
6673 ~/ %sqt
6774 |= a=@ ^- [p=@ q=@]
6875 ?~ a [0 0]
@@ -76,9 +83,11 @@ A cell of atoms.
7683 ?: (lte t a)
7784 $(r s, q (dec q))
7885 $(q (dec q))
86+```
7987
8088#### Examples
8189
90+```
8291 > (sqt 4)
8392 [p=2 q=0]
8493
@@ -93,7 +102,7 @@ A cell of atoms.
93102
94103 > `@ux`(sqt 0b1101)
95104 ! exit
105+```
96106
97107
98−
99−***
108+---
docs/reference/library/2h.umd+106−56
@@ -1,7 +1,9 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'11'
3+ title/'2h: Set Logic'
4+ ==
45
6+;>
57
68# 2h: set logic
79
@@ -18,14 +20,18 @@ A `set`.
1820
1921#### Source
2022
21− ++ in
23+```
24+ ++ in
2225 ~/ %in
2326 |_ a=(set)
27+```
2428
2529#### Examples
2630
31+```
2732 > ~(. in (sy "asd"))
2833 <13.evb [nlr(^$1{@tD $1}) <414.fvk 101.jzo 1.ypj %164>]>
34+```
2935
3036### `+-all:in`
3137
@@ -46,16 +52,19 @@ A flag.
4652
4753#### Source
4854
49− +- all
55+```
56+ +- all
5057 ~/ %all
5158 |* b=$-(* ?)
5259 |- ^- ?
5360 ?~ a
5461 &
5562 ?&((b n.a) $(a l.a) $(a r.a))
63+```
5664
5765#### Examples
5866
67+```
5968 > =b (sy `(list [@t *])`[['a' 1] ['b' [2 3]] ~])
6069 > (~(all in b) |=(a=* ?@(+.a & |)))
6170 %.n
@@ -63,8 +72,9 @@ A flag.
6372 > =b (sy `(list @t)`['john' 'bonita' 'daniel' 'madeleine' ~])
6473 > (~(all in b) |=(a=@t (gte a 100)))
6574 %.y
75+```
6676
67−***
77+---
6878### `+-any:in`
6979
7080Logical OR
@@ -84,17 +94,19 @@ A flag.
8494
8595#### Source
8696
87− +- any
97+```
98+ +- any
8899 ~/ %any
89100 |* b=$-(* ?)
90101 |- ^- ?
91102 ?~ a
92103 |
93104 ?|((b n.a) $(a l.a) $(a r.a))
94−
105+```
95106
96107#### Examples
97108
109+```
98110 > =b (sy `(list [@t *])`[['a' 1] ['b' [2 3]] ~])
99111 > (~(any in b) |=(a/* ?@(+.a & |)))
100112 %.y
@@ -102,8 +114,9 @@ A flag.
102114 > =b (sy `(list @t)`['john' 'bonita' 'daniel' 'madeleine' ~])
103115 > (~(any in b) |=(a=@t (lte a 100)))
104116 %.n
117+```
105118
106−***
119+---
107120#### `+-apt:in`
108121
109122Check correctness
@@ -121,7 +134,8 @@ A flag.
121134
122135#### Source
123136
124− +- apt
137+```
138+ +- apt
125139 =| [l=(unit) r=(unit)]
126140 |- ^- ?
127141 ?~ a &
@@ -130,9 +144,11 @@ A flag.
130144 ?~(l.a & ?&((vor n.a n.l.a) $(a l.a, l `n.a)))
131145 ?~(r.a & ?&((vor n.a n.r.a) $(a r.a, r `n.a)))
132146 ==
147+```
133148
134149#### Examples
135150
151+```
136152 > ~(apt in ~)
137153 %.y
138154
@@ -147,13 +163,13 @@ A flag.
147163 [n=7 l={5 4} r={1 3 2}]
148164 > ~(apt in z)
149165 %.n
150−
166+```
151167
152168#### Discussion
153169
154170See section [`2f`](../2f) for more information on noun ordering.
155171
156−***
172+---
157173### `+-bif:in`
158174
159175Bifurcate
@@ -172,7 +188,8 @@ A cell of two sets.
172188
173189#### Source
174190
175− +- bif
191+```
192+ +- bif
176193 ~/ %bif
177194 |* b=*
178195 ^+ [l=a r=a]
@@ -189,10 +206,11 @@ A cell of two sets.
189206 =+ c=$(a r.a)
190207 ?> ?=(^ c)
191208 [n.c [n.a l.a l.c] r.c]
192−
209+```
193210
194211#### Examples
195212
213+```
196214 > =a (sy `(list @)`[1 2 3 4 5 6 ~])
197215 > a
198216 [n=6 l={5 4} r={1 3 2}]
@@ -202,8 +220,9 @@ A cell of two sets.
202220
203221 > (~(bif in a) 100)
204222 [l=[n=6 l=[n=4 l={5} r={}] r=[n=2 l={1 3} r={}]] r=~]
223+```
205224
206−***
225+---
207226### `+-del:in`
208227
209228Remove noun
@@ -222,7 +241,8 @@ A set.
222241
223242#### Source
224243
225− +- del
244+```
245+ +- del
226246 ~/ %del
227247 |* b=*
228248 |- ^+ a
@@ -238,11 +258,12 @@ A set.
238258 ?: (vor n.l.a n.r.a)
239259 [n.l.a l.l.a $(l.a r.l.a)]
240260 [n.r.a $(r.a l.r.a) r.r.a]
241−
261+```
242262
243263
244264#### Examples
245265
266+```
246267 > =b (sy `(list @t)`['a' 'b' 'c' ~])
247268 > (~(del in b) 'a')
248269 [n='b' l=[n='c' l={} r={}] r=~]
@@ -253,9 +274,9 @@ A set.
253274
254275 > (~(del in b) 'susan')
255276 [n='madeleine' l=[n='daniel' l={} r={'bonita'}] r=[n='john' l={} r={}]]
277+```
256278
257−
258−***
279+---
259280### `+-dif:in`
260281
261282Difference
@@ -275,7 +296,8 @@ A set.
275296
276297#### Source
277298
278− +- dif
299+```
300+ +- dif
279301 ~/ %dif
280302 |* b=_a
281303 |- ^+ a
@@ -290,11 +312,11 @@ A set.
290312 ?: (vor n.d n.e)
291313 [n.d l.d $(d r.d)]
292314 [n.e $(e l.e) r.e]
293−
315+```
294316
295317#### Examples
296318
297−
319+```
298320 > =c (sy 1 2 3 ~)
299321 > =d (sy 2 3 4 ~)
300322 > (~(dif in c) d)
@@ -308,8 +330,9 @@ A set.
308330
309331 > `(set @ud)`(~(dif in d) c)
310332 {4}
333+```
311334
312−***
335+---
313336### `+-dig:in`
314337
315338Address b in a
@@ -328,7 +351,8 @@ The `unit` of an atom.
328351
329352#### Source
330353
331− +- dig
354+```
355+ +- dig
332356 |= b=*
333357 =+ c=1
334358 |- ^- (unit @)
@@ -337,11 +361,12 @@ The `unit` of an atom.
337361 ?: (hor b n.a)
338362 $(a l.a, c (peg c 6))
339363 $(a r.a, c (peg c 7))
340−
364+```
341365
342366
343367#### Examples
344368
369+```
345370 > =a (sy `(list @)`[1 2 3 4 5 6 7 ~])
346371 > `(set @)`a
347372 {5 4 7 6 1 3 2}
@@ -357,12 +382,13 @@ The `unit` of an atom.
357382
358383 > (~(dig in a) 6)
359384 [~ u=2]
385+```
360386
361387#### Discussion
362388
363389For more on the tree addressing system, see section [1b](../1b).
364390
365−***
391+---
366392### `+-gas:in`
367393
368394Concatenate
@@ -381,17 +407,19 @@ A `set`.
381407
382408#### Source
383409
384− +- gas
410+```
411+ +- gas
385412 ~/ %gas
386413 |= b=(list _?>(?=(^ a) n.a))
387414 |- ^+ a
388415 ?~ b
389416 a
390417 $(b t.b, a (put i.b))
391−
418+```
392419
393420#### Examples
394421
422+```
395423 > =b `(set @t)`(sy `(list @t)`['bonita' 'madeleine' 'rudolf' 'john' ~])
396424 > b
397425 {'bonita' 'madeleine' 'rudolf' 'john'}
@@ -402,13 +430,14 @@ A `set`.
402430 > =s (sy `(list @t)`['a' 'b' 'c' 'd' 'e' ~])
403431 > (~(gas in s) `(list @t)`['1' '2' '3' ~])
404432 [n='e' l=[n='1' l={} r={'3' '2'}] r=[n='b' l={'d' 'a' 'c'} r={}]]
433+```
405434
406−***
435+---
407436### `+-has:in`
408437
409438b in a?
410439
411−Checks if `b` is an element of `a`, producing a boolean.
440+Checks if `b` is an element of `a`, producing a flag.
412441
413442#### Accepts
414443
@@ -418,11 +447,12 @@ Checks if `b` is an element of `a`, producing a boolean.
418447
419448#### Produces
420449
421−A boolean.
450+A flag.
422451
423452#### Source
424453
425− +- has
454+```
455+ +- has
426456 ~/ %has
427457 |* b=*
428458 |- ^- ?
@@ -433,19 +463,20 @@ A boolean.
433463 ?: (hor b n.a)
434464 $(a l.a)
435465 $(a r.a)
436− ::
437−
466+```
438467
439468#### Examples
440469
470+```
441471 > =a (~(gas in `(set @t)`~) `(list @t)`['a' 'b' 'c' ~])
442472 > (~(has in a) 'a')
443473 %.y
444474
445475 > (~(has in a) 'z')
446476 %.n
477+```
447478
448−***
479+---
449480### `+-int:in`
450481
451482Intersection
@@ -465,7 +496,8 @@ A `set`.
465496
466497#### Source
467498
468− +- int
499+```
500+ +- int
469501 ~/ %int
470502 |* b=_a
471503 |- ^+ a
@@ -480,12 +512,12 @@ A `set`.
480512 ?: (hor n.b n.a)
481513 %- uni(a $(a l.a, b [n.b l.b ~])) $(b r.b)
482514 %- uni(a $(a r.a, b [n.b ~ r.b])) $(b l.b)
483− ::
484−
515+```
485516
486517
487518#### Examples
488519
520+```
489521 > (~(int in `(set @t)`(sy "acmo")) `(set @t)`(sy "ham"))
490522 [n='m' l={'a'} r={}]
491523
@@ -494,8 +526,9 @@ A `set`.
494526
495527 > (~(int in `(set @t)`(sy "ac")) `(set @t)`(sy "ha"))
496528 [n='a' l={} r={}]
529+```
497530
498−***
531+---
499532### `+-put:in`
500533
501534Put b in a
@@ -514,7 +547,8 @@ A `set`.
514547
515548#### Source
516549
517− +- put
550+```
551+ +- put
518552 ~/ %put
519553 |* b=*
520554 |- ^+ a
@@ -533,10 +567,11 @@ A `set`.
533567 ?: (vor n.a n.c)
534568 [n.a l.a c]
535569 [n.c [n.a l.a l.c] r.c]
536−
570+```
537571
538572#### Examples
539573
574+```
540575 > =a (~(gas in `(set @t)`~) `(list @t)`['a' 'b' 'c' ~])
541576 > =b (~(put in a) 'd')
542577 > `(set @t)`b
@@ -544,8 +579,9 @@ A `set`.
544579
545580 > -.l.+.b
546581 n='d'
582+```
547583
548−***
584+---
549585### `+-rep:in`
550586
551587Accumulate
@@ -564,22 +600,26 @@ A noun.
564600
565601#### Source
566602
603+```
567604 +- rep :: replace by product
568605 |* b=_|=([* *] +<+)
569606 |-
570607 ?~ a +<+.b
571608 $(a r.a, +<+.b $(a l.a, +<+.b (b n.a +<+.b)))
609+```
572610
573611#### Examples
574612
613+```
575614 > =a (~(gas in *(set @)) [1 2 3 ~])
576615 > `(set @)`a
577616 {1 3 2}
578617
579618 > (~(rep in a) |=([a=@ b=@] (add a b)))
580619 b=6
620+```
581621
582−***
622+---
583623### `+-run:in`
584624
585625Apply gate to set
@@ -599,7 +639,8 @@ A set.
599639
600640#### Source
601641
602− +- run
642+```
643+ +- run
603644 ~/ %run
604645 |* b=gate
605646 =| c=(set _?>(?=(^ a) (b n.a)))
@@ -607,18 +648,20 @@ A set.
607648 =. c (~(put in c) (b n.a))
608649 =. c $(a l.a, c c)
609650 $(a r.a, c c)
610−
651+```
611652
612653#### Examples
613654
655+```
614656 > =s (sy ~["a" "A" "b" "c"])
615657 > `(set tape)`s
616658 {"A" "a" "c" "b"}
617659
618660 > (~(run in s) cuss)
619661 {"A" "C" "B"}
662+```
620663
621−***
664+---
622665### `+-tap:in`
623666
624667Set to list
@@ -635,26 +678,29 @@ A list.
635678
636679#### Source
637680
638− +- tap
681+```
682+ +- tap
639683 ~/ %tap
640684 |= b=(list _?>(?=(^ a) n.a))
641685 ^+ b
642686 ?~ a
643687 b
644688 $(a r.a b [n.a $(a l.a)])
645−
689+```
646690
647691
648692#### Examples
649693
694+```
650695 > =s (sy `(list @t)`['a' 'b' 'c' 'd' 'e' ~])
651696 > s
652697 [n='e' l={} r={'d' 'a' 'c' 'b'}]
653698
654699 > ~(tap in s)
655700 ~['b' 'c' 'a' 'd' 'e']
701+```
656702
657−***
703+---
658704### `+-uni:in`
659705
660706Union
@@ -674,7 +720,8 @@ A set.
674720
675721#### Source
676722
677− +- uni
723+```
724+ +- uni
678725 ~/ %uni
679726 |* b=_a
680727 ?: =(a b) a
@@ -695,11 +742,12 @@ A set.
695742 $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
696743 $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
697744 ::
698−
745+```
699746
700747
701748#### Examples
702749
750+```
703751 > (~(uni in `(set @t)`(sy "ac")) `(set @)`(sy "ha"))
704752 [n='c' l={'a'} r={'h'}]
705753
@@ -711,8 +759,9 @@ A set.
711759
712760 > (~(uni in `(set @t)`(sy "acmo")) `(set @t)`(sy "lep"))
713761 [n='e' l={} r={'a' 'c' 'm' 'l' 'o' 'p'}]
762+```
714763
715−***
764+---
716765### `+-wyt:in`
717766
718767Set size
@@ -729,15 +778,17 @@ An atom.
729778
730779#### Source
731780
781+```
732782 +- wyt :: size of set
733783 |- ^- @
734784 ?~(a 0 +((add $(a l.a) $(a r.a))))
735785 --
736−
786+```
737787
738788
739789#### Examples
740790
791+```
741792 > =a (~(put in (~(put in (sy)) 'a')) 'b')
742793 > ~(wyt in a)
743794 2
@@ -745,7 +796,6 @@ An atom.
745796 > =b (sy `(list @t)`['john' 'bonita' 'daniel' 'madeleine' ~])
746797 > ~(wyt in b)
747798 4
799+```
748800
749−
750−***
751−
801+---
docs/reference/library/2i.umd+146−62
@@ -1,9 +1,12 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'12'
3+ title/'2i: Map Logic'
4+ ==
45
6+;>
57
68# 2i: map logic
9+
710### `++by`
811
912Map operations
@@ -17,13 +20,16 @@ contained arms inherit its sample map, `a`.
1720
1821#### Source
1922
20− ++ by
23+```
24+ ++ by
2125 ~/ %by
22− =| a=(tree (pair))
26+ =| a=(tree (pair))
2327 =* node ?>(?=(^ a) n.a)
28+```
2429
2530#### Examples
2631
32+```
2733 > ~(. by (my [%a 1] [%b 2] ~))
2834 < 27.zjr
2935 { a
@@ -36,8 +42,9 @@ contained arms inherit its sample map, `a`.
3642 )
3743 <119.wim 31.ohr 1.jmk $143>
3844 }
45+```
3946
40−***
47+---
4148### `+-all:by`
4249
4350Logical AND
@@ -57,16 +64,19 @@ A flag.
5764
5865#### Source
5966
60− +- all
67+```
68+ +- all
6169 ~/ %all
6270 |* b=$-(* ?)
6371 |- ^- ?
6472 ?~ a
6573 &
6674 ?&((b q.n.a) $(a l.a) $(a r.a))
75+```
6776
6877#### Examples
6978
79+```
7080 > =b (my [['a' 1] ['b' [2 3]] ~])
7181 > (~(all by b) |=(a=* ?@(a & |)))
7282 %.n
@@ -77,8 +87,9 @@ A flag.
7787
7888 > (~(all by a) |=(a=@ (lte a 4)))
7989 %.n
90+```
8091
81−***
92+---
8293### `+-any:by`
8394
8495Logical OR
@@ -98,16 +109,19 @@ A flag.
98109
99110#### Source
100111
101− +- any
112+```
113+ +- any
102114 ~/ %any
103115 |* b=$-(* ?)
104116 |- ^- ?
105117 ?~ a
106118 |
107119 ?|((b q.n.a) $(a l.a) $(a r.a))
120+```
108121
109122#### Examples
110123
124+```
111125 > =b (my [['a' 1] ['b' [2 3]] ~])
112126 > (~(any by b) |=(a=* ?@(a & |)))
113127 %.y
@@ -115,8 +129,9 @@ A flag.
115129 > =a (my [['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~])
116130 > (~(any by a) |=(a=@ (lte a 4)))
117131 %.y
132+```
118133
119−***
134+---
120135###`+-apt:by`
121136
122137Check correctness
@@ -134,7 +149,8 @@ A flag.
134149
135150#### Source
136151
137− +- apt
152+```
153+ +- apt
138154 =| [l=(unit) r=(unit)]
139155 |- ^- ?
140156 ?~ a &
@@ -143,9 +159,11 @@ A flag.
143159 ?~(l.a & ?&((vor p.n.a p.n.l.a) $(a l.a, l `p.n.a)))
144160 ?~(r.a & ?&((vor p.n.a p.n.r.a) $(a r.a, r `p.n.a)))
145161 ==
162+```
146163
147164#### Examples
148165
166+```
149167 > =a (my [['a' 1] ['b' [2 3]] ~])
150168 > ~(apt by a)
151169 %.y
@@ -157,6 +175,7 @@ A flag.
157175
158176 > ~(apt by z)
159177 %.n
178+```
160179
161180#### Discussion
162181
@@ -182,7 +201,8 @@ A cell of two maps.
182201
183202#### Source
184203
185− +- bif
204+```
205+ +- bif
186206 ~/ %bif
187207 |* [b=* c=*]
188208 ^+ [l=a r=a]
@@ -201,14 +221,16 @@ A cell of two maps.
201221 =+ d=$(a r.a)
202222 ?> ?=(^ d)
203223 [n.d [n.a l.a l.d] r.d]
224+```
204225
205226#### Examples
206227
228+```
207229 > =a (my [['a' 1] ['b' 2] ['c' 3] ~])
208230
209231 > (~(bif by a) ['b' 2])
210232 [l=[n=[p='c' q=3] l=[n=[p='a' q=1] l={} r={}] r=~] r=~]
211−
233+```
212234
213235###`+-def:by`
214236
@@ -226,15 +248,17 @@ A map.
226248
227249#### Source
228250
229− +- def
251+```
252+ +- def
230253 |* b=_a
231254 ^- (map _p:node (pair (unit _q:node) (unit _q:node)))
232255 !!
256+```
233257
234258#### Examples
235259
236−***
237−###`+-dep`
260+---
261+###`+-dep:by`
238262
239263Difference as patch
240264
@@ -251,7 +275,8 @@ A cell of maps.
251275
252276#### Source
253277
254− +- dep
278+```
279+ +- dep
255280 |* b=_a
256281 ^+ [p=a q=a]
257282 =+ c=~(tap by (def b))
@@ -263,12 +288,13 @@ A cell of maps.
263288 d ?~(q.q.i.c d (~(put by d) p.i.c u.q.q.i.c))
264289 e ?~(p.q.i.c e (~(put by e) p.i.c u.p.q.i.c))
265290 ==
291+```
266292
267293#### Examples
268294
269295
270296
271−***
297+---
272298### `+-del:by`
273299
274300Delete
@@ -287,7 +313,8 @@ A map.
287313
288314#### Source
289315
290− +- del
316+```
317+ +- del
291318 ~/ %del
292319 |* b=*
293320 |- ^+ a
@@ -303,14 +330,17 @@ A map.
303330 ?: (vor p.n.l.a p.n.r.a)
304331 [n.l.a l.l.a $(l.a r.l.a)]
305332 [n.r.a $(r.a l.r.a) r.r.a]
333+```
306334
307335#### Examples
308336
337+```
309338 > =b (my [['a' 1] ['b' [2 3]] ~])
310339 > (~(del by b) 'a')
311340 [n=[p='b' q=[2 3]] l=~ r=~]
341+```
312342
313−***
343+---
314344### `+-dig:by`
315345
316346Address of key
@@ -329,7 +359,8 @@ A unit.
329359
330360#### Source
331361
332− +- dig
362+```
363+ +- dig
333364 |= b=*
334365 =+ c=1
335366 |- ^- (unit @)
@@ -338,15 +369,17 @@ A unit.
338369 ?: (gor b p.n.a)
339370 $(a l.a, c (peg c 6))
340371 $(a r.a, c (peg c 7))
341−
372+```
342373
343374#### Examples
344375
345− > =b (my [['a' 1] ['b' [2 3]] ~])
376+```
377+ > =b (my [['a' 1] ['b' [2 3]] ~])
346378 > (~(dig by b) 'b')
347379 [~ u=2]
380+```
348381
349−***
382+---
350383### `+-gas:by`
351384
352385Concatenate
@@ -365,7 +398,8 @@ A map.
365398
366399#### Source
367400
368− +- gas
401+```
402+ +- gas
369403 ~/ %gas
370404 |* b=(list [p=* q=*])
371405 => .(b `(list _?>(?=(^ a) n.a))`b)
@@ -373,16 +407,19 @@ A map.
373407 ?~ b
374408 a
375409 $(b t.b, a (put p.i.b q.i.b))
410+```
376411
377412#### Examples
378413
414+```
379415 > =a (my [['a' 1] ['b' 2] ~])
380416 > =b [['c' 3] ['d' 4] ~]
381417
382418 > (~(gas by a) b)
383419 [n=[p='b' q=2] l=[n=[p='d' q=4] l={} r={[p='a' q=1] [p='c' q=3]}] r=~]
420+```
384421
385−***
422+---
386423### `+-get:by`
387424
388425Grab unit value
@@ -401,7 +438,8 @@ A unit.
401438
402439#### Source
403440
404− +- get
441+```
442+ +- get
405443 ~/ %get
406444 |= b=*
407445 ^- [$@(~ [~ u=_?>(?=(^ a) q.n.a)])]
@@ -413,10 +451,12 @@ A unit.
413451 ?: (gor b p.n.a)
414452 $(a l.a)
415453 $(a r.a)
454+```
416455
417456#### Examples
418457
419− > =b (my [['a' 1] ['b' [2 3]] ~])
458+```
459+ > =b (my [['a' 1] ['b' [2 3]] ~])
420460 > (~(get by b) 'b')
421461 [~ u=[2 3]]
422462
@@ -424,9 +464,9 @@ A unit.
424464 > =m (my [['a' 1] ['b' 2] ~])
425465 > (~(get by m) 'a')
426466 [~ u=1]
467+```
427468
428−
429−***
469+---
430470### `+-got:by`
431471
432472Assert
@@ -446,12 +486,15 @@ A noun.
446486
447487#### Source
448488
489+```
449490 +- got
450491 |* b=*
451492 (need (get b))
493+```
452494
453495#### Examples
454496
497+```
455498 > =m (my [['a' 1] ['b' 2] ~])
456499 > m
457500 [n=[p='b' q=2] l={[p='a' q=1]} r={}]
@@ -461,9 +504,9 @@ A noun.
461504
462505 > (~(got by m) 'c')
463506 ! exit
507+```
464508
465−
466−***
509+---
467510### `+-has:by`
468511
469512Key existence check
@@ -482,21 +525,25 @@ A flag.
482525
483526#### Source
484527
485− +- has
528+```
529+ +- has
486530 ~/ %has
487531 |* b=*
488532 !=(~ (get b))
533+```
489534
490535#### Examples
491536
537+```
492538 > =b (my [['a' 1] ['b' [2 3]] ~])
493539 > (~(has by b) 'b')
494540 %.y
495541
496542 > (~(has by b) 'c')
497543 %.n
544+```
498545
499−***
546+---
500547### `+-int:by`
501548
502549Intersection
@@ -517,7 +564,8 @@ A map.
517564
518565#### Source
519566
520− +- int
567+```
568+ +- int
521569 ~/ %int
522570 |* b=_a
523571 |- ^+ a
@@ -536,9 +584,11 @@ A map.
536584 ?: (gor p.n.a p.n.b)
537585 %- uni(a $(b l.b, a [n.a l.a ~])) $(a r.a)
538586 %- uni(a $(b r.b, a [n.a ~ r.a])) $(a l.a)
587+```
539588
540589#### Examples
541590
591+```
542592 > =n (my [['a' 1] ['c' 3] ~])
543593 > =m (my [['a' 1] ['b' 2] ~])
544594
@@ -560,9 +610,9 @@ A map.
560610 > =o (my [['c' 3] ['d' 4] ~])
561611 > (~(int by m) o)
562612 ~
613+```
563614
564−
565−***
615+---
566616### `+-mar:by`
567617
568618Assert and add
@@ -586,14 +636,17 @@ A map.
586636
587637#### Assert and Add
588638
589− +- mar
639+```
640+ +- mar
590641 |* [b=_?>(?=(^ a) p.n.a) c=(unit ,_?>(?=(^ a) q.n.a))]
591642 ?~ c
592643 (del b)
593644 (put b u.c)
645+```
594646
595647#### Examples
596648
649+```
597650 > =m (my [['a' 1] ['b' 2] ~])
598651 > (~(mar by m) 'c' (some 3))
599652 [n=[p='b' q=2] l=[n=[p='c' q=3] l=[n=[p='a' q=1] l={} r={}] r=~] r=~]
@@ -603,8 +656,9 @@ A map.
603656
604657 > (~(mar by m) 'b' ~)
605658 [n=[p='a' q=1] l=~ r=~]
659+```
606660
607−***
661+---
608662### `+-put:by`
609663
610664Add key-value pair
@@ -625,7 +679,8 @@ A map.
625679
626680#### Source
627681
628− +- put
682+```
683+ +- put
629684 ~/ %put
630685 |* [b=* c=*]
631686 |- ^+ a
@@ -646,9 +701,11 @@ A map.
646701 ?: (vor p.n.a p.n.d)
647702 [n.a l.a d]
648703 [n.d [n.a l.a l.d] r.d]
704+```
649705
650706#### Examples
651707
708+```
652709 > =m (my [['a' 1] ['b' 2] ~])
653710 > (~(put by ~) 'c' 3)
654711 [n=[p='b' q=2] l=[n=[p='c' q=3] l={[p='a' q=1]} r={}] r=~]
@@ -662,9 +719,9 @@ A map.
662719
663720 > (put:by m 'a' 2)
664721 {[p=[[98 2] [[97 1] 0 0] 0] q=[97 2]]}
722+```
665723
666−
667−***
724+---
668725### `+-rep:by`
669726
670727Replace by product
@@ -683,20 +740,23 @@ A noun.
683740
684741#### Source
685742
686− +- rep
743+```
744+ +- rep
687745 |* b=_|=([* *] +<+)
688746 |-
689747 ?~ a +<+.b
690748 $(a r.a, +<+.b $(a l.a, +<+.b (b n.a +<+.b)))
749+```
691750
692751#### Examples
693752
753+```
694754 > =m (my [['a' 1] ['b' 2] ~])
695755 > (~(rep by m) |=(a=(pair * *) p.a))
696756 q=[97 1]
757+```
697758
698−
699−***
759+---
700760### `+-rib:by`
701761
702762Replace values with accumulator
@@ -715,7 +775,8 @@ A cell of nouns.
715775
716776#### Source
717777
718− +- rib
778+```
779+ +- rib
719780 |* [b=* c=gate]
720781 |- ^+ [b a]
721782 ?~ a [b ~]
@@ -724,15 +785,18 @@ A cell of nouns.
724785 =+ e=$(a l.a, b -.d)
725786 =+ f=$(a r.a, b -.e)
726787 [-.f [n.a +.e +.f]]
788+```
727789
728790#### Examples
729791
792+```
730793 > =m (my [['a' 1] ['b' 2] ~])
731794 > (~(rib by m) [1 2] (con by m))
732795
733796 > (~(rep by m) [1 2] |=(a=(pair * *) p.a))
797+```
734798
735−***
799+---
736800### `+-run:by`
737801
738802Transform values
@@ -751,14 +815,17 @@ A map.
751815
752816#### Source
753817
754− +- run
818+```
819+ +- run
755820 |* b=gate
756821 |-
757822 ?~ a a
758823 [n=[p=p.n.a q=(b q.n.a)] l=$(a l.a) r=$(a r.a)]
824+```
759825
760826#### Examples
761827
828+```
762829 > =m (my [['a' 1] ['b' 2] ~])
763830
764831 > ^+(m (~(run by m) dec))
@@ -766,9 +833,9 @@ A map.
766833
767834 > `(map @tas @t)`(~(run by m) (cury scot %ux))
768835 {[p=%a q='0x1'] [p=%b q='0x2']}
836+```
769837
770−
771−***
838+---
772839### `+-rut:by`
773840
774841Transform nodes
@@ -787,17 +854,21 @@ A map.
787854
788855#### Source
789856
857+```
790858 +- rut
791859 |* b=gate
792860 |-
793861 ?~ a a
794862 [n=[p=p.n.a q=(b p.n.a q.n.a)] l=$(a l.a) r=$(a r.a)]
863+```
795864
796865#### Examples
797866
867+```
798868 > =m (my [['a' 1] ['b' 2] ~])
869+```
799870
800−***
871+---
801872### `+-tap:by`
802873
803874Listify pairs
@@ -817,7 +888,8 @@ A list.
817888
818889#### Source
819890
820− +- tap
891+```
892+ +- tap
821893 =< $
822894 ~/ %tap
823895 =| b=(list _?>(?=(^ a) n.a))
@@ -825,9 +897,11 @@ A list.
825897 ?~ a
826898 b
827899 $(a r.a, b [n.a $(a l.a)])
900+```
828901
829902#### Examples
830903
904+```
831905 > =m (my [['a' 1] ['b' 2] ~])
832906 [n=[p='b' q=2] l={[p='a' q=1]} r={}]
833907 > `*`m
@@ -837,8 +911,9 @@ A list.
837911 ~[[p='b' q=2] [p='a' q=1]]
838912 > `*`~(tap by m)
839913 [[98 2] [97 1] 0]
914+```
840915
841−***
916+---
842917### `+-uni:by`
843918
844919Union
@@ -858,7 +933,8 @@ A map.
858933
859934#### Source
860935
861− +- uni
936+```
937+ +- uni
862938 ~/ %uni
863939 |* b=_a
864940 |- ^+ a
@@ -877,9 +953,11 @@ A map.
877953 ?: (gor p.n.a p.n.b)
878954 $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
879955 $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
956+```
880957
881958#### Examples
882959
960+```
883961 > =m (my [['a' 1] ['b' 2] ~])
884962
885963 > =o (my [['c' 3] ['d' 4] ~])
@@ -894,9 +972,9 @@ A map.
894972 {[p='a' q=1] [p='c' q=3]}
895973 > (~(uni by o) n)
896974 {[p='d' q=4] [p='a' q=1] [p='c' q=3]}
975+```
897976
898−
899−***
977+---
900978### `+-urn:by`
901979
902980Turn (with key)
@@ -916,15 +994,17 @@ A noun.
916994
917995#### Source
918996
919− +- urn
997+```
998+ +- urn
920999 |* b=$-({* *} *)
9211000 |-
9221001 ?~ a ~
9231002 [n=[p=p.n.a q=(b p.n.a q.n.a)] l=$(a l.a) r=$(a r.a)
924−
1003+```
9251004
9261005#### Examples
9271006
1007+```
9281008 > m
9291009 {[p='a' q=1] [p='b' q=2]}
9301010
@@ -936,8 +1016,9 @@ A noun.
9361016
9371017 > (~(urn by m) |=(a=(pair * *) p.a))
9381018 {[p='a' q=97] [p='b' q=98]}
1019+```
9391020
940−***
1021+---
9411022
9421023### `+-wyt:by`
9431024
@@ -955,12 +1036,15 @@ An atom.
9551036
9561037#### Source
9571038
958− +- wyt
1039+```
1040+ +- wyt
9591041 |- ^- @
9601042 ?~(a 0 +((add $(a l.a) $(a r.a))))
1043+```
9611044
9621045#### Examples
9631046
1047+```
9641048 > =m (my [['a' 1] ['b' 2] ~])
9651049
9661050 > =o (my [['c' 3] ['d' 4] ~])
@@ -973,6 +1057,6 @@ An atom.
9731057
9741058 > ~(wyt by (~(uni by m) o))
9751059 4
1060+```
9761061
977−
978−***
1062+---
docs/reference/library/2j.umd+85−34
@@ -1,64 +1,84 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'13'
3+ title/'2j: Jar and Jug Logic'
4+ ==
45
6+;>
57
68# 2j: jar and jug logic
9+
710### `++ja`
811
912Jar engine
1013
11− |_ a/(jar)
14+```
15+ |_ a=(jar)
16+```
1217
1318A container arm for `++jar` operation arms. A `++jar` is a `++map` of
1419`++list`s. The contained arms inherit the sample jar.
1520
1621`a` is a jar.
1722
23+```
1824 > ~(. ja (mo (limo a/"ho" b/"he" ~)))
1925 <2.dgz [nlr([p={%a %b} q=""]) <414.fvk 101.jzo 1.ypj %164>]>
26+```
2027
21−------------------------------------------------------------------------
22−
28+---
2329### `+-get:ja`
2430
2531Grab value by key
2632
33+```
2734 +- get :: gets list by key
28− |* b/*
35+ |* b=*
2936 =+ c=(~(get by a) b)
3037 ?~(c ~ u.c)
31− ::
38+```
3239
33−Produces a list retrieved from jar `a` using the key `b`.
40+#### Accepts
3441
3542`a` is a `++jar`.
3643
3744`b` is a key of the same type as the keys in `a`.
3845
46+#### Produces
47+
48+A list retrieved from jar `a` using the key `b`.
49+
50+Examples
51+
52+```
3953 > =l (mo `(list ,[@t (list ,@)])`[['a' `(list ,@)`[1 2 3 ~]] ['b' `(list ,@)`[4 5 6 ~]] ~])
4054 > l
41− {[p='a' q=~[1 2 3]] [p='b' q=~[4 5 6]]}
55+ [[p='a' q=~[1 2 3]] [p='b' q=~[4 5 6]]}
56+
4257 > (~(get ja l) 'a')
4358 ~[1 2 3]
59+
4460 > (~(get ja l) 'b')
4561 ~[4 5 6]
62+
4663 > (~(get ja l) 'c')
4764 ~
65+```
4866
49−------------------------------------------------------------------------
50−
67+---
5168### `+-add:ja`
5269
5370Prepend to list
5471
72+#### Source
73+
74+```
5575 +- add :: adds key-list pair
56− |* {b/* c/*}
76+ |* [b=* c=*]
5777 =+ d=(get b)
5878 (~(put by a) b [c d])
79+```
5980
60−Produces jar `a` with value `c` prepended to the list located at key
61−`b`.
81+#### Accepts
6282
6383`a` is a jar.
6484
@@ -66,41 +86,57 @@ Produces jar `a` with value `c` prepended to the list located at key
6686
6787`c` is a value of the same type as the values in `a`.
6888
89+#### Examples
90+
91+```
6992 > =l (mo `(list ,[@t (list ,@)])`[['a' `(list ,@)`[1 2 3 ~]] ['b' `(list ,@)`[4 5 6 ~]] ~])
7093 > l
7194 {[p='a' q=~[1 2 3]] [p='b' q=~[4 5 6]]}
95+
7296 > (~(add ja l) 'b' 7)
7397 {[p='a' q=~[1 2 3]] [p='b' q=~[7 4 5 6]]}
98+
7499 > (~(add ja l) 'a' 100)
75100 {[p='a' q=~[100 1 2 3]] [p='b' q=~[4 5 6]]}
101+
76102 > (~(add ja l) 'c' 7)
77103 {[p='a' q=~[1 2 3]] [p='c' q=~[7]] [p='b' q=~[4 5 6]]}
104+
78105 > (~(add ja l) 'c' `(list ,@)`[7 8 9 ~])
79106 ! type-fail
80107 ! exit
108+```
81109
82110**
83111### `++ju`
84112
85113Jug operations
86114
115+```
87116 ++ ju :: jug engine
88− |/ a/(jug)
117+ |/ a=(jug)
118+```
89119
90120Container arm for jug operation arms. A `++jug` is a `++map` of
91121`++sets`. The contained arms inherit its sample jug, `a`.
92122
93123`a` is a jug.
94124
95− > ~(. ju (mo (limo a/(sa "ho") b/(sa "he") ~)))
125+```
126+ > ~(. ju (mo (limo a=(sa "ho") b=(sa "he") ~)))
96127 <2.dgz [nlr([p={%a %b} q={nlr(^$1{@tD $1}) nlr(^$3{@tD $3})}]) <414.fvk 101.jzo 1.ypj %164>]>
128+```
97129
98130### `+-del:ju`
99131
100132Remove
101133
134+
135+#### Source
136+
137+```
102138 +- del :: del key-set pair
103− |* {b/* c/*}
139+ |* [b=* c=*]
104140 ^+ a
105141 =+ d=(get b)
106142 =+ e=(~(del in d) c)
@@ -108,7 +144,7 @@ Remove
108144 (~(del by a) b)
109145 (~(put by a) b e)
110146 ::
111−
147+```
112148
113149Produces jug `a` with value `c` removed from set located at key `b`.
114150
@@ -119,24 +155,30 @@ Produces jug `a` with value `c` removed from set located at key `b`.
119155`c` is the value of the same type of the keys in `a` that is to be
120156removed.
121157
158+```
122159 > s
123− {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
160+ [[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
161+
124162 > (~(del ju s) 'a' 1)
125163 {[p='a' q={3 2}] [p='b' q={5 4 6}]}
164+
126165 > (~(del ju s) 'c' 7)
127− {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
166+ {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
167+```
128168
129−------------------------------------------------------------------------
169+---
130170
131171### `+-get:ju`
132172
133173Retrieve set
134174
175+```
135176 +- get :: gets set by key
136− |* b/*
177+ |* b=*
137178 =+ c=(~(get by a) b)
138179 ?~(c ~ u.c)
139180 ::
181+```
140182
141183Produces a set retrieved from jar `a` using key `b`.
142184
@@ -144,6 +186,7 @@ Produces a set retrieved from jar `a` using key `b`.
144186
145187`b` is a key of the same type as the keys in `a`.
146188
189+```
147190 > s
148191 {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
149192 > (~(get ju s) 'a')
@@ -152,19 +195,20 @@ Produces a set retrieved from jar `a` using key `b`.
152195 {5 4 6}
153196 > (~(get ju s) 'c')
154197 ~
198+```
155199
156−------------------------------------------------------------------------
157−
200+---
158201### `+-has:ju`
159202
160203Check contents
161204
205+```
162206 +- has :: existence check
163− |* {b/* c/*}
207+ |* [b=* c=*]
164208 ^- ?
165209 (~(has in (get b)) c)
166210 ::
167−
211+```
168212
169213Computes whether a value `c` exists within the set located at key `b`
170214with jar `a`. Produces a loobean.
@@ -175,6 +219,7 @@ with jar `a`. Produces a loobean.
175219
176220`c` is a value as a noun.
177221
222+```
178223 > s
179224 {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
180225 > (~(has ju s) 'a' 3)
@@ -189,18 +234,20 @@ with jar `a`. Produces a loobean.
189234 ! exit
190235 > (~(has ju s) 'c' 7)
191236 %.n
192−
193−------------------------------------------------------------------------
237+```
238+---
194239
195240### `+-put:ju`
196241
197242Add key-set pair
198243
199− +- put :: add key-set pair
200− |* {b/* c/*}
244+```
245+ +- put
246+ |* {b=* c=*}
201247 ^+ a
202248 =+ d=(get b)
203249 (~(put by a) b (~(put in d) c))
250+```
204251
205252Produces jar `a` with `c` added to the set value located at key `b`.
206253
@@ -210,15 +257,19 @@ Produces jar `a` with `c` added to the set value located at key `b`.
210257
211258`c` is a value.
212259
260+```
213261 > s
214− {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
262+ [p='a' q=[1 3 2]] [p='b' q=[5 4 6]]]
263+
215264 > (~(put ju s) 'a' 7)
216265 {[p='a' q={7 1 3 2}] [p='b' q={5 4 6}]}
266+
217267 > (~(put ju s) 'a' 1)
218268 {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
269+
219270 > (~(put ju s) 'c' 7)
220271 {[p='a' q={1 3 2}] [p='c' q={7}] [p='b' q={5 4 6}]}
272+```
221273
222274
223−
224−***
275+---
docs/reference/library/2k.umd+200−140
@@ -1,46 +1,57 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'14'
3+ title/'2k: Queue Logic'
4+ ==
5+
6+;>
47
58
69# 2k: queue logic
10+
711### `++to`
812
13+
914Queue operations
1015
11−Container arm for queue operation arms. The contained arms inherit its
12−sample `++qeu` `a`.
16+Container arm for queue operation arms. The contained arms inherit `a`, its
17+sample queue.
1318
14−Accepts
15−-------
19+#### Accepts
1620
17−`a` is a queue, ++qeu.
21+`a` is a tree.
1822
19−Source
20−------
23+#### Source
2124
22− ++ to :: queue engine
23− |/ a/(qeu)
25+```
26+ ++ to
27+ |_ a=(tree)
28+```
2429
30+#### Discussion
31+
32+`tree` is the generic tree-shape mold. Maps, sets, and queues all share that
33+shape, but they put their elements in different places and have different
34+interfaces. `to` is the interface core for `qeu`; it's not generic across all
35+the different containers that use `tree`.
36+
37+---
2538### `+-bal:to`
2639
2740Balance
2841
2942Vertically rebalances queue `a`.
3043
31−Accepts
32−-------
44+#### Accepts
3345
3446`a` is a queue.
3547
36−Produces
37−--------
48+#### Produces
3849
3950A queue.
4051
41−Source
42−------
52+#### Source
4353
54+```
4455 +- bal
4556 |- ^+ a
4657 ?~ a ~
@@ -49,128 +60,128 @@ Source
4960 ?. |(?=($~ r.a) (vor n.a n.r.a))
5061 $(a [n.r.a $(a [n.a l.a l.r.a]) r.r.a])
5162 a
52− ::
53−
63+```
5464
55−Examples
56−--------
65+#### Examples
5766
67+```
5868 > `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~]
5969 {"a" "b" "c" "d" "e" "f" "g"}
70+
6071 > `*`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~]
6172 [[97 0] 0 [98 0] 0 [99 0] 0 [100 0] 0 [101 0] 0 [102 0] 0 [103 0] 0 0]
73+
6274 > ~(bal to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~])
63− {"a" "b" "c" "d" "e" "f" "g"}
75+ [n=[i='d' t=""] l={"a" "b" "c"} r={"e" "f" "g"}]
76+
6477 > `*`~(bal to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~])
6578 [[100 0] [[99 0] [[98 0] [[97 0] 0 0] 0] 0] [101 0] 0 [102 0] 0 [103 0] 0 0]
79+```
6680
67−------------------------------------------------------------------------
68−
81+---
6982### `+-dep:to`
7083
7184Maximum Depth
7285
73−Produces the maximum depth of leaves (r.a and l.a) in queue `a`.
86+Produces the maximum depth of leaves (`r.a` and `l.a`) in queue `a`.
7487
75−Accepts
76−-------
88+#### Accepts
7789
7890`a` is a queue.
7991
80−Produces
81−--------
92+#### Produces
8293
8394An atom.
8495
85−Source
86−------
96+#### Source
8797
88− +- dep :: max depth of queue
98+```
99+ +- dep
89100 |- ^- @
90101 ?~ a 0
91102 +((max $(a l.a) $(a r.a)))
92− ::
103+```
93104
105+#### Examples
94106
95−Examples
96−--------
97−
107+```
98108 > =a (~(gas to `(qeu @)`~) `(list @)`[1 2 3 4 5 6 7 ~])
99109 > ~(dep to a)
100110 4
111+
101112 > =a (~(gas to `(qeu @)`~) `(list @)`[1 2 3 4 ~])
102113 > ~(dep to a)
103114 3
115+
104116 > =a (~(gas to `(qeu @)`~) `(list @)`[1 2 ~])
105117 > ~(dep to a)
106118 2
119+
107120 > ~(dep to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~])
108121 7
122+
109123 > ~(dep to ~(bal to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~]))
110124 4
125+```
111126
112−------------------------------------------------------------------------
113−
114−### `+-gas`
127+---
128+### `+-gas:to`
115129
116130Push list
117131
118−Push all elements of `++list` `b` into the `++queue`.
132+Push all elements of list `b` into the queue `a`.
119133
120−Accepts
121−-------
134+#### Accepts
122135
123136`a` is a queue.
124137
125138`b` is a list.
126139
127−Produces
128−--------
140+#### Produces
129141
130142A queue.
131143
132−Source
133−------
144+#### Source
134145
135− +- gas :: insert list to queue
136− |= b=(list ,_?>(?=(^ a) n.a))
137− |- ^+ a
138− ?~(b a $(b t.b, a (put(+< a) i.b)))
139− ::
146+```
147+ +- gas
148+ |= b=(list _?>(?=(^ a) n.a))
149+ |- ^+ a
150+ ?~(b a $(b t.b, a (put i.b)))
151+```
140152
141−Examples
142−--------
143153
144− > (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 ~])
145− {3 2 1}
146− > =a (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 ~])
147− > =b `(list ,@)`[4 5 6 ~]
148− > (~(gas to a) b)
149− {6 5 4 3 2 1}
154+#### Examples
150155
151−------------------------------------------------------------------------
156+```
157+ > `(qeu)`(~(gas to `(qeu @)`~) [1 2 3 ~])
158+ {3 2 1}
152159
160+ > =a (~(gas to `(qeu @)`~) [1 2 3 ~])
161+ > =b [4 5 6 ~]
162+ > `(qeu)`(~(gas to a) b)
163+ {6 5 4 3 2 1}
164+```
165+---
153166### `+-get:to`
154167
155−Pop
168+Head-tail pair
156169
157−Produces the head and tail `++queue` of `a`.
170+Produces the head and tail queue of `a`.
158171
159−Accepts
160−-------
172+#### Accepts
161173
162174`a` is a queue.
163175
164−Produces
165−--------
176+#### Produces
166177
167−The last element in `a` along with the rest of queue `a`.
178+A cell of the last element in `a` along with the rest of queue `a`.
168179
169−Source
170−------
180+#### Source
171181
172− +- get :: head-tail pair
173− |- ^+ ?>(?=(^ a) [p=n.a q=*(qeu _n.a)])
182+```
183+ +- get
184+ |- ^+ ?>(?=(^ a) [p=n.a q=*(tree _n.a)])
174185 ?~ a
175186 !!
176187 ?~ r.a
@@ -180,164 +191,213 @@ Source
180191 ?: |(?=($~ q.b) (vor n.a n.q.b))
181192 [n.a l.a q.b]
182193 [n.q.b [n.a l.a l.q.b] r.q.b]
183− ::
194+```
184195
185−Examples
186−--------
196+#### Examples
187197
188− > =s (~(gas to *(qeu @)) `(list @)`~[1 2 3])
198+```
199+ > =s (~(gas to *(tree @)) `(list @)`~[1 2 3])
189200 > ~(get to s)
190− [p=1 q={3 2}]
201+ [n=2 l={3} r={1}]
202+
191203 > ~(get to ~)
192204 ! exit
205+```
193206
194−------------------------------------------------------------------------
195−
207+---
196208### `+-nap:to`
197209
198−Remove last element
210+Remove head
199211
200−Removes the head of `++queue` `a`, producing the resulting queue.
212+Removes the head of queue `a`, producing the resulting queue.
201213
202−Accepts
203−-------
214+#### Accepts
204215
205216`a` is a queue.
206217
207−Produces
208−--------
218+#### Produces
209219
210220A queue.
211221
212−Source
213−------
222+#### Source
214223
215− +- nap :: removes head
224+```
225+ +- nap
216226 ?> ?=(^ a)
217− ?: =(~ l.a) r.a
227+ ?~ l.a r.a
218228 =+ b=get(a l.a)
219229 bal(a ^+(a [p.b q.b r.a]))
220− ::
230+```
221231
222−Examples
223−--------
232+#### Examples
224233
234+```
225235 > =a (~(gas to `(qeu @)`~) `(list @)`[1 2 3 4 5 6 ~])
226236 > -.a
227237 n=6
238+
228239 > =b ~(nap to a)
229240 > -.b
230241 n=2
242+
243+ > a
244+ [n=6 l={} r={5 4 3 2 1}]
245+
231246 > b
247+ [n=2 l=[n=4 l={5} r={3}] r=[n=1 l={} r={}]]
248+
249+ > `(qeu)`b
232250 {5 4 3 2 1}
233− > a
251+
252+ > `(qeu)`a
234253 {6 5 4 3 2 1}
254+```
255+
256+---
257+### `+-nip:to`
258+
259+Removes the root of queue `a`, producing the resulting queue.
260+
261+#### Accepts
262+
263+`a` is a queue.
264+
265+#### Produces
266+
267+A queue.
268+
269+#### Source
270+
271+```
272+ +- nip
273+ |- ^+ a
274+ ?~ a ~
275+ ?~ l.a r.a
276+ ?~ r.a l.a
277+ ?: (vor n.l.a n.r.a)
278+ [n.l.a l.l.a $(l.a r.l.a)]
279+ [n.r.a $(r.a l.r.a) r.r.a]
280+```
235281
236−------------------------------------------------------------------------
282+#### Examples
237283
284+```
285+ > =a (~(gas to `(qeu @)`~) `(list @)`[1 2 3 4 5 6 ~])
286+ > a
287+ [n=6 l={} r={5 4 3 2 1}]
288+
289+ > ~(nip to a)
290+ [n=2 l=[n=4 l={5} r={3}] r=[n=1 l={} r={}]]
291+```
292+
293+---
238294### `+-put:to`
239295
240296Insert
241297
242−Accept any noun `b` and adds to `++queue` `a` as the head, producing the
298+Accept any noun `b` and adds to queue `a` as the head, producing the
243299resulting queue.
244300
245−Accepts
246−-------
301+#### Accepts
247302
248303`a` is a queue.
249304
250305`b` is any noun.
251306
252−Produces
253−--------
307+#### Produces
254308
255309A queue.
256310
257−Source
258−------
311+#### Source
259312
260− +- put :: insert new tail
261− |* b/*
313+```
314+ +- put
315+ |* b=*
262316 |- ^+ a
263317 ?~ a
264318 [b ~ ~]
265319 bal(a a(l $(a l.a)))
266− ::
267−
320+```
268321
269−Examples
270−--------
322+#### Examples
271323
272− > (~(gas to `(qeu @)`~) `(list @)`[3 1 2 4 5 6 ~])
273− > (~(put to a) 7)
324+```
325+ > =a (~(gas to `(qeu @)`~) `(list @)`[3 1 2 4 5 6 ~])
326+ > `(qeu)`(~(put to a) 7)
274327 {7 6 5 4 2 1 3}
328+```
275329
276−------------------------------------------------------------------------
277−
330+---
278331### `+-tap:to`
279332
280333Queue to list
281334
282−Produces `++queue` `a` as a `++list` from front to back.
335+Produces queue `a` as a list from front to back.
283336
284−Accepts
285−-------
337+#### Accepts
286338
287339`a` is a queue.
288340
289−Source
290−------
341+#### Produces
342+
343+A list.
291344
292− +- tap :: adds list to end
293− |= b/(list _?>(?=(^ a) n.a))
294− =+ z=0 :: XX breaks jet match
295− ^+ b
345+#### Source
346+
347+```
348+ +- tap
349+ =| b=(list _?>(?=(^ a) n.a))
350+ |- ^+ b
351+ =+ 0 :: hack for jet match
296352 ?~ a
297353 b
298354 $(a r.a, b [n.a $(a l.a)])
299− ::
355+```
300356
301−Examples
302−--------
357+#### Examples
303358
304− > =a (~(gas to `(qeu @)`~) `(list @)`[3 1 2 4 5 6 ~])
359+```
360+ > =a (~(gas to `(qeu @)`~) [3 1 2 4 5 6 ~])
305361 > `*`a
306362 [6 0 2 [4 [5 0 0] 0] 1 0 3 0 0]
307− > (~(tap to a) `(list @)`[99 100 101 ~])
308− ~[3 1 2 4 5 6 99 100 101]
309−
310−------------------------------------------------------------------------
363+ > ~(tap to a)
364+ ~[3 1 2 4 5 6]
365+```
311366
367+---
312368### `+-top:to`
313369
314−Produces the head of `++queue` `a` as a `++unit` (an empty queue has no head).
370+Produce head
315371
316−Accepts
317−-------
372+Produces the head of queue `a` as a `unit`.
373+
374+#### Accepts
318375
319376`a` is a queue.
320377
321−Produces
322−--------
378+#### Produces
323379
324380A unit.
325381
326−Source
327−------
382+#### Source
328383
329− +- top :: produces head
384+```
385+ +- top
330386 |- ^- (unit _?>(?=(^ a) n.a))
331387 ?~ a ~
332388 ?~(r.a [~ n.a] $(a r.a))
389+```
333390
334−Examples
335−--------
391+#### Examples
336392
393+```
337394 > =a (~(gas to `(qeu @)`~) `(list @)`[1 2 3 4 5 6 ~])
338395 > ~(top to a)
339− [~ 1]
396+ [~ u=1]
397+```
340398
399+#### Discussion
341400
401+An empty queue has no head.
342402
343−***
403+---
docs/reference/library/2l.umd+32−14
@@ -1,6 +1,9 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'15'
3+ title/'2l: Container from Container'
4+ ==
5+
6+;>
47
58# 2l: container from container
69
@@ -20,19 +23,26 @@ A map.
2023
2124#### Source
2225
23− ++ malt
24− |* a=(list)
25− (molt `(list [p=_-<.a q=_->.a])`a)
26+```
27+:- :~ navhome/'/docs/'
28+ sort/'14'
29+ title/'2k: Jar and Jug Logic'
30+ ==
31+
32+;>
33+```
2634
2735#### Examples
2836
37+```
2938 > (malt [['ok' 'no'] ['a' 'b'] ['x' 'y'] ~])
3039 [n=[p='x' q='y'] l={[p='a' q='b'] [p='ok' q='no']} r={}]
3140
3241 > (malt ~[[1 2 3] [4 5 6] [7 8 9]])
3342 [n=[p=1 q=[2 3]] l={[p=4 q=[5 6]] [p=7 q=[8 9]]} r={}]
43+```
3444
35−***
45+---
3646### `++molt`
3747
3848Map from pair list
@@ -49,24 +59,28 @@ A map.
4959
5060#### Source
5161
52− ++ molt
53− |* a=(list (pair))
54− (~(gas by `(tree [p=_p.i.-.a q=_q.i.-.a})`~) a)
62+```
63+ ++ molt
64+ |* a=(list (pair))
65+ (~(gas by `(tree [p=_p.i.-.a q=_q.i.-.a})`~) a)
66+```
5567
5668#### Examples
5769
70+```
5871 > =a `(list (pair))`[[1 2] [4 3] [11 0] ~]
5972 > a
6073 > ~[[p=1 q=2] [p=4 q=3] [p=11 q=0]]
6174
6275 > (molt a)
6376 [n=[p=11 q=0] l={[p=4 q=3] [p=1 q=2]} r={}]
77+```
6478
6579#### Discussion
6680
6781Only used internally as a helper to `malt`.
6882
69−***
83+---
7084### `++silt`
7185
7286Set from list
@@ -83,14 +97,18 @@ A set.
8397
8498#### Source
8599
86− ++ silt
87− |* a=(list)
100+```
101+ ++ silt
102+ |* a=(list)
88103 =+ b=*(tree _?>(?=(^ a) i.a))
89104 (~(gas in b) a)
105+```
90106
91107#### Examples
92108
109+```
93110 > (silt `(list @t)`['c' 'hoon' 'javascript' 'python' ~])
94111 [n='javascript' l={} r={'python' 'hoon' 'c'}]
112+```
95113
96−***
114+---
docs/reference/library/2m.umd+59−22
@@ -1,6 +1,10 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'16'
3+ title/'2m: Container from Noun'
4+ ==
5+
6+;>
7+
48
59# 2m: container from noun
610
@@ -20,22 +24,26 @@ A `list`.
2024
2125#### Source
2226
23− ++ ly
27+```
28+ ++ ly
2429 le:nl
30+```
2531
2632#### Examples
2733
34+```
2835 > (ly [1 2 3 ~])
2936 ~[1 2 3]
3037
3138 > (ly "abc")
3239 ~['a' 'b' 'c']
40+```
3341
3442#### Discussion.
3543
3644`ly` is an alias for `le:nl`.
3745
38−***
46+---
3947### `++my`
4048
4149Map from raw noun
@@ -52,19 +60,23 @@ A `map`.
5260
5361#### Source
5462
55− ++ my
63+```
64+ ++ my
5665 my:nl
66+```
5767
5868#### Examples
5969
70+```
6071 > (my [['a' 1] ['b' 2] ~])
6172 [n=[p='b' q=2] l={[p='a' q=1]} r={}]
73+```
6274
6375#### Discussion.
6476
6577`my` is an alias for `my:nl`.
6678
67−***
79+---
6880### `++sy`
6981
7082Set from raw noun
@@ -81,11 +93,14 @@ A `set`.
8193
8294#### Source
8395
84− ++ sy
96+```
97+ ++ sy
8598 si:nl
99+```
86100
87101#### Examples
88102
103+```
89104 > (sy [1 2 3 ~])
90105 [n=2 l={1 3} r={}]
91106
@@ -94,12 +109,13 @@ A `set`.
94109
95110 > (sy "abc")
96111 [n='b' l={'a' 'c'} r={}]
112+```
97113
98114#### Discussion.
99115
100116`sy` is an alias for `si:nl`.
101117
102−***
118+---
103119### `++nl`
104120
105121Noun-to-container operations
@@ -109,10 +125,12 @@ nouns.
109125
110126#### Source
111127
128+```
112129 ++ nl
113130 |%
131+```
114132
115−***
133+---
116134### `++le:nl`
117135
118136Construct list
@@ -129,22 +147,26 @@ A list.
129147
130148#### Source
131149
132− ++ le
150+```
151+ ++ le
133152 |* a=(list)
134153 ^+ =< $
135154 |% +- $ ?:(*? ~ [i=(snag 0 a) t=$])
136155 --
137156 a
157+```
138158
139159#### Examples
140160
161+```
141162 > (le:nl [1 2 3 ~])
142163 ~[1 2 3]
143164
144165 > (le:nl "abc")
145166 ~['a' 'b' 'c']
167+```
146168
147−***
169+---
148170### `++my:nl`
149171
150172Construct map
@@ -162,17 +184,21 @@ A map.
162184
163185#### Source
164186
165− ++ my
187+```
188+ ++ my
166189 |* a=(list (pair))
167190 => .(a ^+((le a) a))
168191 (~(gas by `(map _p.i.-.a _q.i.-.a)`~) a)
192+```
169193
170194#### Examples
171195
196+```
172197 > (my:nl [['a' 1] ['b' 2] ~])
173198 [n=[p='b' q=2] l={[p='a' q=1]} r={}]
199+```
174200
175−***
201+---
176202### `++si:nl`
177203
178204Construct set
@@ -189,23 +215,27 @@ A set.
189215
190216#### Source
191217
192− ++ si
218+```
219+ ++ si
193220 |* a=(list)
194221 => .(a ^+((le a) a))
195222 (~(gas in `(set _i.-.a)`~) a)
223+```
196224
197225#### Examples
198226
227+```
199228 > (si:nl `(list [@t *])`[['a' 1] ['b' [2 3]] ~])
200229 [n=['b' [2 3]] l={['a' 1]} r={}]
230+```
201231
202−***
232+---
203233### `++snag:nl`
204234
205235Index
206236
207237Produces the element at the index `a` of null-terminated noun `b` and failing if
208− the noun is null. Lists are 0-indexed.
238+the noun is null. Lists are 0-indexed.
209239
210240#### Accepts
211241
@@ -219,16 +249,19 @@ A noun.
219249
220250#### Sources
221251
222− ++ snag
252+```
253+ ++ snag
223254 |* [a=@ b=(list)]
224255 ?~ b
225256 ~_ leaf+"snag-fail"
226257 !!
227258 ?: =(0 a) i.b
228259 $(b t.b, a (dec a))
260+```
229261
230262#### Examples
231263
264+```
232265 > =b [[2 3] [1 4] ~]
233266 > (snag:nl 0 b)
234267 [2 3]
@@ -236,8 +269,9 @@ A noun.
236269 > (snag:nl 2 b)
237270 ! snag-fail
238271 ! exit
272+```
239273
240−***
274+---
241275#### `++weld:nl`
242276
243277Concatenate
@@ -256,20 +290,23 @@ A list.
256290
257291#### Source
258292
259− ++ weld
293+```
294+ ++ weld
260295 |* [a=(list) b=(list)]
261296 => .(a ^+((le a) a), b ^+((le b) b))
262297 =+ 42
263298 |-
264299 ?~ a b
265300 [i=i.a t=$(a t.a)]
301+```
266302
267303#### Examples
268304
305+```
269306 > =b [[2 3] [1 4] ~]
270307
271308 > (weld:nl b [8 9 ~])
272309 [i=[2 3] t=[i=[1 4] t=~[8 9]]]
310+```
273311
274−
275−***
312+---
docs/reference/library/2n.umd+84−41
@@ -1,7 +1,9 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'17'
3+ title/'2n: Functional Hacks'
4+ ==
45
6+;>
57
68# 2n: functional hacks
79
@@ -19,10 +21,13 @@ Build `f` such that `(f x) .= (b (a x))`.
1921
2022#### Source
2123
22− ++ cork |*([a=_|=(* **) b=gate] (corl b a))
24+```
25+ ++ cork |*([a=_|=(* **) b=gate] (corl b a))
26+```
2327
2428#### Examples
2529
30+```
2631 > (:(cork dec dec dec) 20)
2732 17
2833
@@ -32,9 +37,9 @@ Build `f` such that `(f x) .= (b (a x))`.
3237
3338 > ((cork ~(got by mal) dec) %b)
3439 22
40+```
3541
36−
37−***
42+---
3843### `++corl`
3944
4045Compose backward
@@ -49,20 +54,22 @@ Build `f` such that
4954
5055#### Source
5156
52− ++ corl
57+```
58+ ++ corl
5359 |* [a=gate b=_|=(* **)]
5460 =< +:|.((a (b))) :: span check
5561 |* c=_+<.b
5662 (a (b c))
57− ::
63+```
5864
5965#### Examples
6066
67+```
6168 > ((corl (lift bex) (slat %ud)) '2')
6269 [~ 4]
70+```
6371
64−
65−***
72+---
6673### `++curr`
6774
6875Right curry
@@ -81,22 +88,25 @@ A gate.
8188
8289#### Source
8390
84− ++ curr
85− |* [a=_|=(^ **) c=*}
91+```
92+ ++ curr
93+ |* [a=_|=(^ **) c=*}
8694 |* b=_+<+.a
8795 (a b c)
96+```
8897
8998#### Examples
9099
100+```
91101 > =tep (cury scan sym)
92102 > `@t`(tep "asd")
93103 'asd'
94104
95105 > `@t`(tep "lek-om")
96106 'lek-om'
107+```
97108
98−
99−***
109+---
100110### `++cury`
101111
102112Curry left
@@ -115,22 +125,25 @@ A gate.
115125
116126#### Source
117127
118− ++ cury
128+```
129+ ++ cury
119130 |* [a=_|=(^ **) b=*}
120131 |* c=_+<+.a
121132 (a b c)
122−
133+```
123134
124135#### Examples
125136
137+```
126138 > =mol (cury add 2)
127139 > (mol 4)
128140 6
129141
130142 > (mol 7)
131143 9
144+```
132145
133−***
146+---
134147### `++hard`
135148
136149Force remold
@@ -140,16 +153,18 @@ not.
140153
141154#### Source
142155
143− ++ hard
156+```
157+ ++ hard
144158 |* han=gate
145159 |= fud=* ^- han
146160 ~_ leaf+"hard"
147161 =+ gol=(han fud)
148162 ?>(=(gol fud) gol)
149− ::
163+```
150164
151165#### Examples
152166
167+```
153168 > ((hard (list)) (limo [1 2 3 ~]))
154169 ~[1 2 3]
155170 > ((hard @) (add 2 2))
@@ -159,10 +174,10 @@ not.
159174 > ((hard tape) (crip "...Tape to cord, bro?..."))
160175 ! hard
161176 ! exit
177+```
162178
163179
164−
165−***
180+---
166181### `++soft`
167182
168183Maybe remold
@@ -172,29 +187,35 @@ is not.
172187
173188#### Source
174189
175− ++ soft
190+```
191+ ++ soft
176192 |* han=gate
177193 |= fud=* ^- (unit han)
178194 =+ gol=(han fud)
179195 ?.(=(gol fud) ~ [~ gol])
180− ::
196+```
181197
182198#### Examples
183199
200+```
184201 > ((soft %4) (add 2 2))
185202 [~ %4]
203+
186204 > ((soft @) (add 2 2))
187205 [~ 4]
206+
188207 > ((soft %5) (add 2 2))
189208 ~
209+
190210 > ((soft @t) (crip "Tape to cord, Woohoo!"))
191211 [~ 'Tape to cord, Woohoo!']
212+
192213 > ((soft @t) (trip 'Cmon man... Tape to cord? Please?!'))
193214 ~
215+```
194216
195217
196−
197−***
218+---
198219### `++head`
199220
200221Get head
@@ -211,10 +232,13 @@ An atom.
211232
212233#### Source
213234
214− ++ head |*(^ ,:+<-)
235+```
236+ ++ head |*(^ ,:+<-)
237+```
215238
216239#### Examples
217240
241+```
218242 > (head [1 2])
219243 1
220244
@@ -223,9 +247,9 @@ An atom.
223247
224248 > (head "hello")
225249 'h'
250+```
226251
227−
228−***
252+---
229253### `++same`
230254
231255Identity
@@ -242,10 +266,13 @@ A noun.
242266
243267#### Source
244268
245− ++ same |*(* +<)
269+```
270+ ++ same |*(* +<)
271+```
246272
247273#### Examples
248274
275+```
249276 > (same [1 2])
250277 [1 2]
251278
@@ -254,8 +281,9 @@ A noun.
254281
255282 > (same "hello")
256283 "hello"
284+```
257285
258−***
286+---
259287### `++slog`
260288
261289Deify printf
@@ -273,15 +301,19 @@ A `tang`.
273301
274302#### Source
275303
276− ++ slog
277− =| pri=@
278− |= a=tang ^+ same
279− ?~(a same ~>(%slog.[pri i.a] $(a t.a)))
304+```
305+ ++ slog
306+ =| pri=@
307+ |= a=tang ^+ same
308+ ?~(a same ~>(%slog.[pri i.a] $(a t.a)))
309+```
280310
281311#### Examples
282312
313+```
283314 > =+ result=((slog [%leaf "error-message"]~) [12 13]) [%product result]
284315 [%product 12 13]
316+```
285317
286318#### Discussion
287319
@@ -289,7 +321,7 @@ A `tang`.
289321calls that string a piece of data through them, so that an error message will be
290322printed if there's one to print.
291323
292−***
324+---
293325### `++mean`
294326
295327Crash and printf
@@ -306,19 +338,23 @@ A crash.
306338
307339#### Source
308340
309− ++ mean
341+```
342+ ++ mean
310343 |= a=tang
311344 ^+ !!
312345 ?~ a !!
313346 ~_(i.a $(a t.a))
347+```
314348
315349#### Examples
316350
351+```
317352 > ~>(%mean.[%leaf "fuse-loop"] !!)
318353 ####
319354 !! crash
355+```
320356
321−***
357+---
322358### `++tail`
323359
324360Get tail
@@ -335,10 +371,13 @@ A noun.
335371
336372#### Source
337373
374+```
338375 ++ tail |*(^ ,:+<+)
376+```
339377
340378#### Examples
341379
380+```
342381 > (tail [1 2])
343382 2
344383
@@ -347,9 +386,9 @@ A noun.
347386
348387 > (tail "hello")
349388 "ello"
389+```
350390
351−
352−***
391+---
353392### `++test`
354393
355394Test for equality
@@ -368,10 +407,13 @@ A flag.
368407
369408#### Source
370409
371− ++ test |=(^ =(+<- +<+))
410+```
411+ ++ test |=(^ =(+<- +<+))
412+```
372413
373414#### Examples
374415
416+```
375417 > (test 1 1)
376418 %.y
377419
@@ -383,5 +425,6 @@ A flag.
383425
384426 > (test "hello" ['h' 'e' 'l' 'l' 'o' ~])
385427 %.y
428+```
386429
387−***
430+---
docs/reference/library/2o.umd+42−25
@@ -1,18 +1,25 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'18'
3+ title/'2o: Normalizing Containers'
4+ ==
5+
6+;>
47
58# 2o: normalizing containers
9+
610### `++jar`
711
812Mold generator. A `jar` is a `map` of `list`.
913
1014#### Source
1115
16+```
1217 ++ jar |*([a=mold b=mold] (map a (list b)))
18+```
1319
1420#### Examples
1521
22+```
1623 > =a (ly [1 2 ~])
1724 > a
1825 ~[1 2]
@@ -30,24 +37,26 @@ Mold generator. A `jar` is a `map` of `list`.
3037
3138 > (~(get ja c) %c)
3239 ~
33−
40+```
3441
3542#### Discussion
3643
3744See also: [`ja`](../2j), [`by`](../2i), [`map`](../2i), [`list`](../2b)
3845
39−***
46+---
4047### `++jug`
4148
4249Mold generator. A `jug` is a `map` of `set`.
4350
4451#### Source
4552
46− ++ jug |*([a=mold b=mold] (map a (set b)))
47−
53+```
54+ ++ jug |*([a=mold b=mold] (map a (set b)))
55+```
4856
4957#### Examples
5058
59+```
5160 > =a (sy [1 2 ~])
5261 > a
5362 [n=2 l={1} r={}]
@@ -68,12 +77,13 @@ Mold generator. A `jug` is a `map` of `set`.
6877 l=[n=[p=%a q=[n=2 l=[n=1 l={} r={}] r=~]] l={} r={}]
6978 r=~
7079 ]
80+```
7181
7282#### Discussion
7383
7484See also: [`ja`](../2j), [`by`](../2i), [`map`](../2i), [`set`](..2h)
7585
76−***
86+---
7787### `++map`
7888
7989Map
@@ -84,26 +94,29 @@ key-value pairs.
8494
8595#### Source
8696
87− ++ map |* [a=mold b=mold]
88− %+ cork (tree (pair a b))
89− |= c=(tree (pair a b)) ^+ c
97+```
98+ ++ map |* [a=mold b=mold]
99+ %+ cork (tree (pair a b))
100+ |= c=(tree (pair a b)) ^+ c
90101 ?.(~(apt by c) ~ c)
102+```
91103
92104#### Examples
93105
94−
106+```
95107 > ? *(map @t @u)
96108 nlr({p/@t q/@u})
97− {}
109+ {}
98110
99111 > (molt `(list (pair * *))`[[a+1 b+2] ~])
100112 [n=[p=[97 1] q=[98 2]] l={} r={}]
113+```
101114
102115#### Discussion
103116
104117See also: [`by`](../2i)
105118
106−***
119+---
107120### `++qeu`
108121
109122Queue
@@ -113,12 +126,14 @@ items.
113126
114127#### Source
115128
116− ++ qeu |*(a=mold (tree a))
117−
129+```
130+ ++ qeu |*(a=mold (tree a))
131+```
118132
119133
120134#### Examples
121135
136+```
122137 > (qeu time)
123138 < 1.huj
124139 { *
@@ -132,13 +147,13 @@ items.
132147
133148 > (~(gas to *(qeu time)) [~2014.1.1 ~2014.1.2 ~])
134149 [n=~2014.1.2 l={} r={~2014.1.1}]
135−
150+```
136151
137152#### Discussion
138153
139154See also: [`qeu`](../2k)
140155
141−***
156+---
142157### `++set`
143158
144159Set
@@ -148,15 +163,16 @@ items.
148163
149164#### Source
150165
151− ++ set |* a=mold
152− %+ cork (tree a)
153− |= b=(tree a) ^+ b
154− ?.(~(apt in b) ~ b)
155−
166+```
167+ ++ set |* a=mold
168+ %+ cork (tree a)
169+ |= b=(tree a) ^+ b
170+ ?.(~(apt in b) ~ b)
171+```
156172
157173#### Examples
158174
159−
175+```
160176 > (sy "abc")
161177 [n='b' l={'a' 'c'} r={}]
162178
@@ -165,9 +181,10 @@ items.
165181
166182 > (~(put in (sy "abc")) %a)
167183 [n='b' l=[n='c' l={'a'} r={}] r=~]
184+```
168185
169186#### Discussion
170187
171188See also: [`in`](../2h)
172189
173−***
190+---
docs/reference/library/2p.umd+33−17
@@ -1,9 +1,13 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'19'
3+ title/'2p: Serialization'
4+ ==
5+
6+;>
47
58
69# 2p: serialization
10+
711### `++cue`
812
913Unpack atom to noun
@@ -12,6 +16,7 @@ Produces a noun unpacked from atom `a`. The inverse of `jam`.
1216
1317#### Accepts
1418
19+An Atom.
1520
1621#### Produces
1722
@@ -19,7 +24,8 @@ A noun.
1924
2025#### Source
2126
22− ++ cue
27+```
28+ ++ cue
2329 ~/ %cue
2430 |= a=@
2531 ^- *
@@ -38,9 +44,11 @@ A noun.
3844 [(add 2 (add p.u p.v)) w (~(put by r.v) b w)]
3945 =+ d=(rub c a)
4046 [(add 2 p.d) (need (~(get by m) q.d)) m]
47+```
4148
4249#### Examples
4350
51+```
4452 > (cue 12)
4553 1
4654
@@ -52,9 +60,9 @@ A noun.
5260
5361 > (cue 39.689)
5462 [0 19]
63+```
5564
56−
57−***
65+---
5866### `++jam`
5967
6068Pack noun to atom
@@ -71,7 +79,8 @@ An atom.
7179
7280#### Source
7381
74− ++ jam
82+```
83+ ++ jam
7584 ~/ %jam
7685 |= a=*
7786 ^- @
@@ -94,10 +103,11 @@ An atom.
94103 [(add 1 p.d) (lsh 0 1 q.d) m]
95104 =+ d=(mat u.c)
96105 [(add 2 p.d) (mix 3 (lsh 0 2 q.d)) m]
97−
106+```
98107
99108#### Examples
100109
110+```
101111 > (jam 1)
102112 12
103113
@@ -109,12 +119,13 @@ An atom.
109119
110120 > (jam [~ u=19])
111121 39.689
122+```
112123
113124#### Discussion
114125
115126`mat` is only used internally as a helper to `jam`.
116127
117−***
128+---
118129### `++mat`
119130
120131Length-encode
@@ -133,7 +144,8 @@ A cell of two atoms.
133144
134145#### Source
135146
136− ++ mat
147+```
148+ ++ mat
137149 ~/ %mat
138150 |= a=@
139151 ^- [p=@ q=@]
@@ -143,9 +155,11 @@ A cell of two atoms.
143155 =+ c=(met 0 b)
144156 :- (add (add c c) b)
145157 (cat 0 (bex c) (mix (end 0 (dec c) b) (lsh 0 (dec c) a)))
158+```
146159
147160#### Examples
148161
162+```
149163 > (mat 0xaaa)
150164 [p=20 q=699.024]
151165
@@ -167,12 +181,12 @@ A cell of two atoms.
167181 > =c =-(~&(- -) (xeb b))
168182 4
169183
170− > [`@ub`a `@ub`(end 0 (dec c) b) `@ub`(bex c)]
184+ > [`@ub`a `@ub`(end 0 (dec c) b) `@ub`(bex c)]
171185 [0b1010.1010.1010 0b100 0b1.0000]
186+```
172187
173188
174−
175−***
189+---
176190### `++rub`
177191
178192Length-decode
@@ -194,7 +208,8 @@ A cell of two atoms.
194208
195209#### Source
196210
197− ++ rub
211+```
212+ ++ rub
198213 ~/ %rub
199214 |= [a=@ b=@]
200215 ^- [p=@ q=@]
@@ -209,10 +224,11 @@ A cell of two atoms.
209224 =+ d=(add a +(c))
210225 =+ e=(add (bex (dec c)) (cut 0 [d (dec c)] b))
211226 [(add (add c c) e) (cut 0 [(add d (dec c)) e] b)]
212−
227+```
213228
214229#### Examples
215230
231+```
216232 > `@ub`(jam 0xaaa)
217233 0b1.0101.0101.0101.0010.0000
218234
@@ -221,10 +237,10 @@ A cell of two atoms.
221237
222238 > `@ux`q:(rub 1 0b1.0101.0101.0101.0010.0000)
223239 0xaaa
224−
240+```
225241
226242#### Discussion
227243
228244`rub` is only used internally as a helper to `cue`.
229245
230−***
246+---
docs/reference/library/2q.umd+94−61
@@ -1,9 +1,13 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'20'
3+ title/'2q: Molds and Mold-Builders'
4+ ==
5+
6+;>
47
58
69# 2q: molds and mold builders
10+
711### `++char`
812
913Character
@@ -14,19 +18,21 @@ consume `tape`s, which are lists of `char`.
1418
1519#### Source
1620
17− ++ char @tD
21+```
22+ ++ char @tD
23+```
1824
1925#### Examples
2026
27+```
2128 > *char
2229 ''
23−
30+
2431 > `@tD`97
2532 'a'
33+```
2634
27−
28−
29−***
35+---
3036### `++cord`
3137
3238UTF-8 text
@@ -36,14 +42,16 @@ atom of UTF-8 text.
3642
3743#### Source
3844
39− ++ cord @t
45+```
46+ ++ cord @t
47+```
4048
4149#### Examples
4250
43−
51+```
4452 > *cord
4553 ''
46−
54+
4755 > `@ux`'foobar'
4856 0x7261.626f.6f66
4957
@@ -55,7 +63,7 @@ atom of UTF-8 text.
5563
5664 > `@t`499.984.265.845
5765 'urbit'
58−
66+```
5967
6068#### Discussion
6169
@@ -67,7 +75,7 @@ from `tape` to `cord`.
6775
6876
6977
70−***
78+---
7179### `++date`
7280
7381Point in time
@@ -77,11 +85,13 @@ which is a day atom and a time.
7785
7886#### Source
7987
80− ++ date [[a=? y=@ud] m=@ud t=tarp]
81−
88+```
89+ ++ date [[a=? y=@ud] m=@ud t=tarp]
90+```
8291
8392#### Examples
8493
94+```
8595 > *date
8696 [[a=%.y y=0] m=0 t=[d=0 h=0 m=0 s=0 f=~]]
8797
@@ -90,14 +100,14 @@ which is a day atom and a time.
90100
91101 > now
92102 ~2018.5.25..17.55.15..9ad8
93−
103+```
94104
95105
96106#### Discussion
97107
98108See also: [`year`](../3c), [`yore`](../3c) [`stud`](../2q), [`dust`](../2q)
99109
100−***
110+---
101111### `++knot`
102112
103113ASCII
@@ -106,18 +116,22 @@ An atom type that only permits ASCII characters.
106116
107117#### Source
108118
109−++ knot @ta
119+```
120+
121+ ++ knot @ta
122+```
110123
111124#### Examples
112125
126+```
113127 > *knot
114128 ~.
115−
129+
116130 > `@ta`105
117131 ~.i
132+```
118133
119−
120−***
134+---
121135### `++tang`
122136
123137Generic print structure
@@ -127,10 +141,13 @@ traces.
127141
128142#### Source
129143
130−++ tang (list tank)
144+```
145+ ++ tang (list tank)
146+```
131147
132148#### Examples
133149
150+```
134151 > *tang
135152 ~
136153
@@ -145,34 +162,38 @@ traces.
145162
146163 > (~(win re [%rose ["1" "2" "3"] [%leaf "foobar"] [%leaf "bazbud"] ~]) 0 10)
147164 <<"2 foobar" " bazbud" "3">>
165+```
148166
149−
150−***
167+---
151168### `++tank`
152169
153170Pretty-printing structure
154171
155172A `tank` is one of three cases: a `%leaf` is simply a string (a printed line);
156− a `%palm` is list of `tank` delimited by the strings in `p`, with back-steps at
173+a `%palm` is list of `tank` delimited by the strings in `p`, with back-steps at
157174new lines; and a `%rose` is a list of `tank` delimited by the strings in `p`
158175without back-steps at new lines.
159176
160177
161178#### Source
162179
163− ++ tank $% [$leaf p=tape]
164− $: $palm
165− p=[p=tape q=tape r=tape s=tape]
166− q=(list tank)
167− ==
168− $: $rose
169− p=[p=tape q=tape r=tape]
170− q=(list tank)
171− ==
172− ==
180+```
181+ ++ tank $% [$leaf p=tape]
182+ $: $palm
183+ p=[p=tape q=tape r=tape s=tape]
184+ q=(list tank)
185+ ==
186+ $: $rose
187+ p=[p=tape q=tape r=tape]
188+ q=(list tank)
189+ ==
190+ ==
191+```
173192
174193#### Examples
175194
195+
196+```
176197 > *tank
177198 [%rose p=[p="" q="" r=""] q=~]
178199
@@ -187,7 +208,7 @@ without back-steps at new lines.
187208 2.854.495.385.411.919.762.116.571.938.898.990.272.765.493.248
188209 ]
189210
190− > (wash [0 40] >(bex 150) (bex 151)<)
211+ > (wash [0 40] >(bex 150) (bex 151)<)
191212 <<
192213 "[ \\/1.427.247.692.705.959.881.058.285.\\/"
193214 " 969.449.495.136.382.746.624"
@@ -196,11 +217,11 @@ without back-steps at new lines.
196217 " 938.898.990.272.765.493.248"
197218 " \\/ \\/"
198219 "]"
199− >>
200−
220+ >>
221+```
201222
202223
203−***
224+---
204225### `++tape`
205226
206227List of characters
@@ -210,13 +231,16 @@ One of Hoon's two string types, the other being `++cord`. A tape is a list of
210231
211232#### Source
212233
213− ++ tape (list @tD)
234+```
235+ ++ tape (list @tD)
236+```
214237
215238#### Examples
216239
240+```
217241 > *tape
218242 ""
219−
243+
220244 > `tape`"foobar"
221245 "foobar"
222246
@@ -228,24 +252,25 @@ One of Hoon's two string types, the other being `++cord`. A tape is a list of
228252
229253 > `(list @)`"foobar"
230254 ~[102 111 111 98 97 114]
255+```
231256
232−
233−***
257+---
234258### `++tarp`
235259
236260Parsed time
237261
238262The time component of a `date`: day, hour, minute, second and a list of `@ux`
239− for precision.
263+for precision.
240264
241265#### Source
242266
243− ++ tarp [d=@ud h=@ud m=@ud s=@ud f=(list @ux)]
244−
267+```
268+ ++ tarp [d=@ud h=@ud m=@ud s=@ud f=(list @ux)]
269+```
245270
246271#### Examples
247272
248−
273+```
249274 > *tarp
250275 [d=0 h=0 m=0 s=0 f=~]
251276
@@ -257,10 +282,10 @@ The time component of a `date`: day, hour, minute, second and a list of `@ux`
257282
258283 > (yell ~d20)
259284 [d=20 h=0 m=0 s=0 f=~]
285+```
260286
261287
262−
263−***
288+---
264289### `++term`
265290
266291Hoon constant
@@ -274,10 +299,13 @@ special syntax, `$`.
274299
275300#### Source
276301
277− ++ term @tas
302+```
303+ ++ term @tas
304+```
278305
279306#### Examples
280307
308+```
281309 > *term
282310 %$
283311
@@ -289,31 +317,34 @@ special syntax, `$`.
289317
290318 > -:!>(%dead-fish9)
291319 #t/$dead-fish9
320+```
292321
293322
294−
295−***
323+---
296324### `++wain`
297325
298−List of strings
326+List of strings
299327
300328A list of `cord`s. A `wain` is used instead of a single `cord` with `\n`.
301329
302330
303331#### Source
304332
305− ++ wain (list cord)
333+```
334+ ++ wain (list cord)
335+```
306336
307337#### Examples
308338
339+```
309340 > *wain
310341 <||>
311342
312343 > `wain`/som/del/rok
313344 <|som del rok|>
345+```
314346
315−
316−***
347+---
317348### `++wall`
318349
319350List of list of characters
@@ -322,13 +353,15 @@ A list of `tape`s. `wall` is used instead of a single `tape` with `\n`.
322353
323354#### Source
324355
325− ++ wall (list tape)
326−
356+```
357+ ++ wall (list tape)
358+```
327359#### Examples
328360
361+```
329362 > *wall
330363 <<>>
331−
364+
332365 > `wall`(wash [0 20] leaf+<(bex 256)>)
333366 <<
334367 "\\/115.792.089.237.\\/"
@@ -340,7 +373,7 @@ A list of `tape`s. `wall` is used instead of a single `tape` with `\n`.
340373 " 639.936"
341374 "\\/ \\/"
342375 >>
376+```
343377
344378
345−
346−***
379+---
docs/reference/library/3a.umd+129−46
@@ -1,6 +1,9 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'21'
3+ title/'3a: Modular and Signed Ints'
4+ ==
5+
6+;>
47
58# 3a: modular and signed ints
69
@@ -10,7 +13,7 @@ Extended Euclidean algorithm
1013
1114Produces `d`, the
1215[greatest common divisor](https://en.wikipedia.org/wiki/Greatest_common_divisor)
13−of `a` and `b`. Also produces `u` and `v` such that `au + bv = GCD(a, b)`.
16+of `a` and `b`. Also produces `u` and `v` such that `au + bv = GCD(a, b)`.
1417
1518#### Accepts
1619
@@ -28,7 +31,8 @@ of `a` and `b`. Also produces `u` and `v` such that `au + bv = GCD(a, b)`.
2831
2932#### Source
3033
31− ++ egcd
34+```
35+ ++ egcd
3236 |= [a=@ b=@]
3337 =+ si
3438 =+ [c=(sun a) d=(sun b)]
@@ -40,17 +44,19 @@ of `a` and `b`. Also produces `u` and `v` such that `au + bv = GCD(a, b)`.
4044 %= $
4145 c (dif d (pro q c))
4246 d c
43− u [(dif d.u (pro q c.u)) c.u]
47+ u [(dif d.u (pro q c.u)) c.u]
4448 v [(dif d.v (pro q c.v)) c.v]
4549 ==
46−
50+```
4751
4852#### Examples
4953
54+```
5055 > (egcd 11 2)
5156 [d=1 u=--1 v=-5]
57+```
5258
53−***
59+---
5460### `++fo`
5561
5662Modulo prime
@@ -59,10 +65,11 @@ Container core for modular arithmetic functions.
5965
6066#### Source
6167
62− ++ fo
68+```
69+ ++ fo
6370 ^?
6471 |_ a=@
65−
72+```
6673
6774#### `++dif`
6875
@@ -84,17 +91,21 @@ An atom.
8491
8592#### Source
8693
94+```
8795 ++ dif
8896 |= [b=@ c=@]
8997 (sit (sub (add a b) (sit c)))
98+```
9099
91100#### Examples
92101
102+```
93103 > (~(dif fo 6) 1 2)
94104 5
95105
96106 > (~(dif fo 21) 11 45)
97107 8
108+```
98109
99110#### `++exp`
100111
@@ -116,6 +127,7 @@ An atom.
116127
117128#### Source
118129
130+```
119131 ++ exp
120132 |= [b=@ c=@]
121133 ?: =(0 b)
@@ -123,9 +135,11 @@ An atom.
123135 =+ d=$(b (rsh 0 1 b))
124136 =+ e=(pro d d)
125137 ?:(=(0 (end 0 1 b)) e (pro c e))
138+```
126139
127140#### Examples
128141
142+```
129143 > (~(exp fo 5) 8 2)
130144 1
131145
@@ -137,8 +151,9 @@ An atom.
137151
138152 > (~(exp fo 995) 8 2)
139153 256
154+```
140155
141−***
156+---
142157### `++fra`
143158
144159Divide
@@ -165,12 +180,15 @@ An atom.
165180
166181#### Source
167182
183+```
168184 ++ fra
169185 |= [b=@ c=@]
170186 (pro b (inv c))
187+```
171188
172189#### Examples
173190
191+```
174192 > (~(fra fo 2) 8 2)
175193 0
176194
@@ -182,8 +200,9 @@ An atom.
182200
183201 > (~(fra fo 5) 8 2)
184202 4
203+```
185204
186−***
205+---
187206### `++inv`
188207
189208Inverse
@@ -203,13 +222,16 @@ An atom.
203222
204223#### Source
205224
225+```
206226 ++ inv
207227 |= b=@
208228 =+ c=(dul:si u:(egcd b a) a)
209229 c
230+```
210231
211232#### Examples
212233
234+```
213235 > (~(inv fo 11) 2)
214236 6
215237
@@ -224,8 +246,9 @@ An atom.
224246
225247 > (~(inv fo 70) 255)
226248 67
249+```
227250
228−***
251+---
229252### `++pro`
230253
231254Multiplication
@@ -246,19 +269,23 @@ An atom.
246269
247270#### Source
248271
272+```
249273 ++ pro
250274 |= [b=@ c=@]
251275 (sit (mul b c))
276+```
252277
253278#### Examples
254279
280+```
255281 > (~(pro fo 3) 11 4)
256282 2
257283
258284 > (mod 44 3)
259285 2
286+```
260287
261−***
288+---
262289### `++sit`
263290
264291Modulus
@@ -277,16 +304,20 @@ An atom.
277304
278305#### Source
279306
307+```
280308 ++ sit
281309 |= b=@
282310 (mod b a)
311+```
283312
284313#### Examples
285314
315+```
286316 > (~(sit fo 3) 14)
287317 2
318+```
288319
289−***
320+---
290321### `++sum`
291322
292323Modular sum
@@ -307,20 +338,24 @@ An atom.
307338
308339#### Source
309340
341+```
310342 ++ sum
311343 |= [b=@ c=@]
312344 (sit (add b c))
313345 --
346+```
314347
315348#### Examples
316349
350+```
317351 > (~(sum fo 3) 14 3)
318352 2
319353
320354 > (mod 17 3)
321355 2
356+```
322357
323−***
358+---
324359### `++si`
325360
326361Signed integer
@@ -329,9 +364,11 @@ Container core for signed integer functions.
329364
330365#### Source
331366
332− ++ si
367+```
368+ ++ si
333369 ^?
334370 |%
371+```
335372
336373#### Discussion
337374
@@ -343,6 +380,7 @@ Positive signed integers correspond to odd atoms of twice their absolute value,
343380and negative signed integers correspond to atoms of twice their absolute value
344381minus one. For example:
345382
383+```
346384 > `@`--4
347385 8
348386 > `@s`8
@@ -352,8 +390,9 @@ minus one. For example:
352390 7
353391 > `@s`7
354392 -4
393+```
355394
356−***
395+---
357396### `++abs:si`
358397
359398Absolute value
@@ -370,17 +409,21 @@ An atom.
370409
371410### Source
372411
412+```
373413 ++ abs |=(a=@s (add (end 0 1 a) (rsh 0 1 a)))
414+```
374415
375416#### Examples
376417
418+```
377419 > (abs:si -11)
378420 11
379421
380422 > (abs:si --520)
381423 520
424+```
382425
383−***
426+---
384427### `++dif:si`
385428
386429Subtraction
@@ -399,18 +442,22 @@ A signed integer.
399442
400443#### Source
401444
402− ++ dif |= [a=@s b=@s]
445+```
446+ ++ dif |= [a=@s b=@s]
403447 (sum a (new !(syn b) (abs b)))
448+```
404449
405450#### Examples
406451
452+```
407453 > (dif:si --3 -2)
408454 --5
409455
410456 > (dif:si -3 --2)
411457 -5
458+```
412459
413−***
460+---
414461### `++dul:si`
415462
416463Modulus
@@ -429,11 +476,14 @@ An atom.
429476
430477#### Source
431478
432− ++ dul |= [a=@s b=@]
479+```
480+ ++ dul |= [a=@s b=@]
433481 =+(c=(old a) ?:(-.c (mod +.c b) (sub b +.c)))
482+```
434483
435484#### Examples
436485
486+```
437487 > `@s`(dul:si -1 --5)
438488 -5
439489
@@ -444,9 +494,9 @@ An atom.
444494
445495 > `@s`(dul:si -11 -61)
446496 --55
497+```
447498
448−
449−***
499+---
450500#### `++fra:si`
451501
452502Divide
@@ -465,11 +515,14 @@ A signed atom.
465515
466516#### Source
467517
468− ++ fra |= [a=@s b=@s]
518+```
519+ ++ fra |= [a=@s b=@s]
469520 (new =(0 (mix (syn a) (syn b))) (div (abs a) (abs b)))
521+```
470522
471523#### Examples
472524
525+```
473526 > (fra:si -1 -1)
474527 --1
475528
@@ -478,9 +531,9 @@ A signed atom.
478531
479532 > (fra:si -0 -1)
480533 --0
534+```
481535
482−
483−***
536+---
484537### `++new`
485538
486539Atom to @s
@@ -501,11 +554,14 @@ A signed integer.
501554
502555#### Source
503556
504− ++ new |= [a=? b=@]
557+```
558+ ++ new |= [a=? b=@]
505559 `@s`?:(a (mul 2 b) ?:(=(0 b) 0 +((mul 2 (dec b)))))
560+```
506561
507562#### Examples
508563
564+```
509565 > (new:si | 2)
510566 -2
511567
@@ -517,8 +573,9 @@ A signed integer.
517573
518574 > (new:si & --2)
519575 --4
576+```
520577
521−***
578+---
522579### `++old:si`
523580
524581Sign and absolute value
@@ -536,17 +593,21 @@ A cell composed of a `term` and an atom.
536593
537594#### Source
538595
539− ++ old |=(a=@s [(syn a) (abs a)])
596+```
597+ ++ old |=(a=@s [(syn a) (abs a)])
598+```
540599
541600#### Examples
542601
602+```
543603 > (old:si -2)
544604 [%.n 2]
545605
546606 > (old:si --2)
547607 [%.y 2]
608+```
548609
549−***
610+---
550611### `++pro`
551612
552613Multiplication
@@ -561,18 +622,22 @@ Produces a signed integer by multiplying `a` and `b`.
561622
562623#### Source
563624
564− ++ pro |= [a=@s b=@s]
625+```
626+ ++ pro |= [a=@s b=@s]
565627 (new =(0 (mix (syn a) (syn b))) (mul (abs a) (abs b)))
628+```
566629
567630#### Examples
568631
632+```
569633 > (pro:si -3 -3)
570634 --9
571635
572636 > (pro:si -3 --3)
573637 -9
638+```
574639
575−***
640+---
576641### `++rem:si`
577642
578643Remainder
@@ -591,10 +656,13 @@ A signed integer.
591656
592657#### Source
593658
594− ++ rem |=([a=@s b=@s] (dif a (pro b (fra a b))))
659+```
660+ ++ rem |=([a=@s b=@s] (dif a (pro b (fra a b))))
661+```
595662
596663#### Examples
597664
665+```
598666 > (rem:si -17 -3)
599667 -2
600668
@@ -606,10 +674,10 @@ A signed integer.
606674
607675 > (rem:si --17 --3)
608676 --2
677+```
609678
610679
611−
612−***
680+---
613681### `++sum:si`
614682
615683Addition
@@ -628,7 +696,8 @@ A signed integer.
628696
629697#### Source
630698
631− ++ sum |= [a=@s b=@s]
699+```
700+ ++ sum |= [a=@s b=@s]
632701 =+ [c=(old a) d=(old b)]
633702 ?: -.c
634703 ?: -.d
@@ -641,16 +710,19 @@ A signed integer.
641710 (new | (sub +.c +.d))
642711 (new & (sub +.d +.c))
643712 (new | (add +.c +.d))
713+```
644714
645715#### Examples
646716
717+```
647718 > (sum:si -11 --2)
648719 -9
649720
650721 > (sum:si --2 --2)
651722 --4
723+```
652724
653−***
725+---
654726#### `++sun:si`
655727
656728@u to @s
@@ -667,10 +739,13 @@ An atom.
667739
668740#### Source
669741
670− ++ sun |=(a=@u (mul 2 a))
742+```
743+ ++ sun |=(a=@u (mul 2 a))
744+```
671745
672746#### Examples
673747
748+```
674749 > (mul 2 90)
675750 180
676751
@@ -688,8 +763,9 @@ An atom.
688763 354
689764 > `@u`-89
690765 177
766+```
691767
692−***
768+---
693769### `++syn:si`
694770
695771Sign test
@@ -707,18 +783,21 @@ An `term`.
707783
708784#### Source
709785
710− ++ syn |=(a=@s =(0 (end 0 1 a)))
786+```
787+ ++ syn |=(a=@s =(0 (end 0 1 a)))
788+```
711789
712790#### Examples
713791
792+```
714793 > (syn:si -2)
715794 %.n
716795
717796 > (syn:si --2)
718797 %.y
798+```
719799
720−
721−***
800+---
722801### `++cmp:si`
723802
724803Compare
@@ -737,9 +816,10 @@ equal, `--0` is produced.
737816
738817A signed integer.
739818
740−#### Source
819+#### Source
741820
742− ++ cmp |= [a=@s b=@s]
821+```
822+ ++ cmp |= [a=@s b=@s]
743823 ^- @s
744824 ?: =(a b)
745825 --0
@@ -755,9 +835,11 @@ A signed integer.
755835 -1
756836 --1
757837 --
838+```
758839
759840#### Examples
760841
842+```
761843 > (cmp:si -2 --1)
762844 -1
763845
@@ -772,5 +854,6 @@ A signed integer.
772854
773855 > (cmp:si --2 --5)
774856 -1
857+```
775858
776−***
859+---
docs/reference/library/3b.umd+5828−2
@@ -1,6 +1,5832 @@
1+:- :~ navhome/'/docs/'
2+ sort/'22'
3+ title/'3b: Floating Point'
4+ ==
5+
6+;>
7+
8+# 3b: floating point
9+
10+### `++fn`
11+
12+Float
13+
14+A mold for the floating-point arithmetic using the base of two, the formula is
15+`(-1)^s * a * 2^e`.
16+
17+Produces either a float (`$f`), an infinity of other sign (`$i`),
18+or not-a-number (`$n`). `s` refers to sign, the `flag`s `&` or `|`; `e` to
19+exponent, a signed decimal; and `a` to the significand, an unsigned integer.
20+
21+#### Source
22+
23+```
24+ ++ fn
25+ $% [$f s=? e=@s a=@u]
26+ [$i s=?]
27+ [$n ~]
28+ ==
29+```
30+
31+### Examples
32+
33+```
34+ > *fn
35+ [%n ~]
36+
37+ > (add:fl [%f & --33 2] [%f | --23 2])
38+ [%f s=%.y e=-79 a=10.374.452.512.267.829.421.849.019.032.797.184]
39+
40+ > (add:fl [%i &] [%i &])
41+ [%i s=%.y]
42+
43+ > (add:fl [%n ~] [%i |])
44+ [%n ~]
45+
46+ > (sun:fl 961.193.554.848.514.048.973.893.027.381.506.219.443)
47+ [%f s=%.y e=--17 a=7.333.324.850.834.000.007.430.214.137.126.970]
48+```
49+
50+
51+---
52+### `++dn`
53+
54+Decimal float
55+
56+A mold for the floating-point arithmetic using the base of 10; the formula is
57+`(-1)^s * a *10^e`.
58+
59+Valid values are a float (`$d`), an infinity (`$i`), or a not-a-number (`$n`).
60+`s` refers to sign, the `flag`s `&` or `|`; `e` to exponent, a signed decimal;
61+and `a` to the significand, an unsigned integer.
62+
63+```
64+ ++ dn
65+ $% [$d s=? e=@s a=@u]
66+ [$i s=?]
67+ [$n ~]
68+ ==
69+```
70+
71+#### Examples
72+
73+```
74+ > `dn`[%d & --0 17.163.091.968]
75+ [%d s=%.y e=--0 a=17.163.091.968]
76+
77+ > `dn`[%i s=%.y]
78+ [%i s=%.y]
79+
80+ > `dn`[%n ~]
81+ [%n ~]
82+```
83+
84+---
85+### `++rn`
86+
87+Parsed decimal float
88+
89+A mold for the floating-point arithmetic using the base of 10; the formula is
90+`(-1)^s * a *10^e`.
91+
92+Produces either a parsed float (`$d`), infinity of either sign (`$i`), or
93+not-a-number (`$n`).
94+
95+#### Source
96+
97+```
98+ $% [$d a=? b=[c=@ [d=@ e=@] f=? i=@]]
99+ [$i a=?]
100+ [$n ~]
101+ ==
102+```
103+
104+#### Examples
105+
106+```
107+ > `rn`[%d | [2 [3 4] | 17.163]]
108+ [%d a=%.n b=[c=2 [d=3 e=4] f=%.n i=17.163]]
109+```
110+
111+---
112+### `++fl`
113+
114+Arbitrary-precision floating-point
115+
116+Container arm for floating-point arithmetic functions.
117+
118+- Precision (`p`): number of bits in the significand; must be at least 2.
119+ Default is 113.
120+- Minimum exponent (`v`): minimum value of e. Default is -16.494.
121+- Width (`w`): Max value of `e` minus min value of `e`. 0 is for fixed-point.
122+ Default is 32.988.
123+- Rounding mode (`r`): Possible modes are nearest (`$n`), up (`$u`),
124+ down (`$d`), to zero (`$z`), and away from zero (`$a`). Default value is `%n`.
125+- Behavior (`d`): return denormals (`$d`), flush denormals to zero (`$z`),
126+ infinite exponent range (`$i`). Default value is `%d`.
127+
128+#### Source
129+
130+```
131+ ++ fl
132+ =+ ^- [[p=@u v=@s w=@u] r=$?($n $u $d $z $a) d=$?($d $f $i)]
133+ [[113 -16.494 32.765] %n %d]
134+ =>
135+ ~% %cofl +> ~
136+ |%
137+```
138+
139+---
140+### `++rou:fl`
141+
142+Round
143+
144+Rounds `a` to a the nearest float that can be represented with a 113-bit
145+significand. There is no term to sign the significand, meaning that a positive
146+sign will always be produced.
147+
148+#### Accepts
149+
150+`a` is a cell of a signed integer and an unsigned integer.
151+
152+#### Produces
153+
154+An `fn`.
155+
156+#### Source
157+
158+```
159+ ++ rou
160+ |= [a=[e=@s a=@u]] ^- fn (rau a &)
161+```
162+
163+#### Examples
164+
165+```
166+ > =a 10.161.487.211.429.486.882.397.572.894.294.017.777
167+ > (^rou:fl [--12 a])
168+ [%f s=%.y e=--22 a=9.923.327.354.911.608.283.591.379.779.584.002]
169+
170+ > (^rou:fl [--12 (add a 1)])
171+ [%f s=%.y e=--22 a=9.923.327.354.911.608.283.591.379.779.584.002]
172+
173+ > (^rou:fl [--12 (add a 300)])
174+ [%f s=%.y e=--22 a=9.923.327.354.911.608.283.591.379.779.584.002]
175+
176+ > (^rou:fl [--12 (add a 1.000)])
177+ [%f s=%.y e=--22 a=9.923.327.354.911.608.283.591.379.779.584.003]
178+```
179+
180+---
181+### `++rau:fl`
182+
183+Various roundings
184+
185+Rounds `a` based on what the state of of `r` in the core contained in `fl`. `t`
186+is a sticky bit that represents a value less than ULP(a) = 2^(e.a) when passed
187+to `lug:fl`.
188+
189+#### Accepts
190+
191+`a` is a cell of a signed integer and an unsigned integer.
192+
193+`t` is a `flag`.
194+
195+#### Produces
196+
197+An `fn`.
198+
199+#### Source
200+
201+```
202+ ++ rau
203+ |= [a=[e=@s a=@u] t=?] ^- fn
204+ ?- r
205+ $z (lug %fl a t) $d (lug %fl a t)
206+ $a (lug %ce a t) $u (lug %ce a t)
207+ $n (lug %ne a t)
208+ ==
209+```
210+
211+#### Examples
212+
213+```
214+ > (rau:fl [-18 342.602.577] &)
215+ [%f s=%.y e=-102 a=6.626.897.619.228.945.634.459.505.846.648.832]
216+```
217+
218+
219+#### Discussion
220+
221+See `lug:fl` for possible rounding operations.
222+
223+---
224+### `++add:fl`
225+
226+Add
227+
228+Produces the sum of `a` and `b`. `e` is used to choose between an exact result
229+(any-sized significand) or a rounded result (113-bit significand).
230+
231+There is no term to sign the significands, so a positive sign will always be
232+produced.
233+
234+#### Accepts
235+
236+`a` is an `fn`.
237+
238+`b` is an `fn`
239+
240+`e` is a `flag`.
241+
242+#### Produces
243+
244+An `fn`.
245+
246+#### Source
247+
248+```
249+ ++ add
250+ |= [a=[e=@s a=@u] b=[e=@s a=@u] e=?] ^- fn
251+ =+ q=(dif:si e.a e.b)
252+ |- ?. (syn:si q) $(b a, a b, q +(q)) :: a has larger exp
253+ ?: e
254+ [%f & e.b (^add (lsh 0 (abs:si q) a.a) a.b)]
255+ =+ [ma=(met 0 a.a) mb=(met 0 a.b)]
256+ =+ ^= w %+ dif:si e.a %- sun:si :: expanded exp of a
257+ ?: (gth prc ma) (^sub prc ma) 0
258+ =+ ^= x %+ sum:si e.b (sun:si mb) :: highest exp for b
259+ ?: =((cmp:si w x) --1) :: don't need to add
260+ ?- r
261+ $z (lug %fl a &) $d (lug %fl a &)
262+ $a (lug %lg a &) $u (lug %lg a &)
263+ $n (lug %na a &)
264+ ==
265+ (rou [e.b (^add (lsh 0 (abs:si q) a.a) a.b)])
266+```
267+
268+#### Examples
269+
270+```
271+ > (^add:fl [--33 2.718] [--23 11] %.y)
272+ [%f s=%.y e=--23 a=2.783.243]
273+
274+ > (^add:fl [--33 2.718] [--23 11] %.n)
275+ [%f s=%.y e=-68 a=6.890.975.897.521.519.304.902.126.405.156.864]
276+```
277+
278+---
279+### `++sub:fl`
280+
281+Subtract
282+
283+Produces the difference of `a` minus `b.` `e` is used to choose between an exact
284+result (any-sized significand) or a rounded result (113-bit significand).
285+
286+#### Accepts
287+
288+`a` is a cell of a signed integer and an unsigned integer.
289+
290+`b` is a cell of a signed integer and an unsigned integer.
291+
292+`e` is a `flag`.
293+
294+#### Produces
295+
296+An `fn`.
297+
298+#### Source
299+
300+```
301+ ++ sub
302+ |= [a=[e=@s a=@u] b=[e=@s a=@u] e=?] ^- fn
303+ =+ q=(dif:si e.a e.b)
304+ |- ?. (syn:si q)
305+ (fli $(b a, a b, q +(q), r swr))
306+ =+ [ma=(met 0 a.a) mb=(met 0 a.b)]
307+ =+ ^= w %+ dif:si e.a %- sun:si
308+ ?: (gth prc ma) (^sub prc ma) 0
309+ =+ ^= x %+ sum:si e.b (sun:si +(mb))
310+ ?: &(!e =((cmp:si w x) --1))
311+ ?- r
312+ $z (lug %sm a &) $d (lug %sm a &)
313+ $a (lug %ce a &) $u (lug %ce a &)
314+ $n (lug %nt a &)
315+ ==
316+ =+ j=(lsh 0 (abs:si q) a.a)
317+ |- ?. (gte j a.b)
318+ (fli $(a.b j, j a.b, r swr))
319+ =+ i=(^sub j a.b)
320+ ?~ i [%f & zer]
321+ ?: e [%f & e.b i] (rou [e.b i])
322+```
323+
324+#### Examples
325+
326+```
327+ > (^sub:fl [--33 2.718] [--23 11] %.y)
328+ [%f s=%.y e=--23 a=2.783.221]
329+
330+ > (^sub:fl [--33 2.718] [--63 11] %.y)
331+ [%f s=%.n e=--33 a=11.811.157.346]
332+```
333+
334+---
335+### `++mul:fl`
336+
337+Multiply
338+
339+Produces the product of `a` multiplied by `b`. There is no term to sign the
340+significands, so a positive sign will always be produced.
341+
342+#### Accepts
343+
344+`a` is a cell of a signed integer and an unsigned integer.
345+
346+`b` is a cell of a signed integer and an unsigned integer.
347+
348+#### Produces
349+
350+An `fn`.
351+
352+#### Source
353+
354+```
355+ ++ mul
356+ |= [a=[e=@s a=@u] b=[e=@s a=@u]] ^- fn
357+ (rou (sum:si e.a e.b) (^mul a.a a.b))
358+```
359+
360+#### Examples
361+
362+```
363+ > (^mul:fl [--3 2.718] [--23 11])
364+ [%f s=%.y e=-72 a=9.475.054.411.405.900.661.487.108.108.582.912]
365+```
366+
367+---
368+### `++div:fl`
369+
370+Divide
371+
372+Produces the quotient of `a` divided by `b`. There is no term to sign the
373+significands, so a positive sign will always be produced.
374+
375+#### Accepts
376+
377+`a` is a cell of a signed integer and an unsigned integer.
378+
379+`b` is a cell of a signed integer and an unsigned integer.
380+
381+#### Produces
382+
383+An `fn`.
384+
385+#### Source
386+
387+```
388+ ++ div
389+ |= [a=[e=@s a=@u] b=[e=@s a=@u]] ^- fn
390+ =+ [ma=(met 0 a.a) mb=(met 0 a.b)]
391+ =+ v=(dif:si (sun:si ma) (sun:si +((^add mb prc))))
392+ =. a ?: (syn:si v) a
393+ a(e (sum:si v e.a), a (lsh 0 (abs:si v) a.a))
394+ =+ [j=(dif:si e.a e.b) q=(dvr a.a a.b)]
395+ (rau [j p.q] =(q.q 0))
396+```
397+
398+#### Examples
399+
400+```
401+ > (^div:fl [--13 2.718] [--23 11])
402+ [%f s=%.y e=-115 a=10.023.198.055.040.952.765.870.659.817.343.907]
403+```
404+
405+---
406+### `++sqt:fl`
407+
408+Square root
409+
410+Produces the square root of `a`.
411+
412+#### Accepts
413+
414+`a` is a cell of a signed integer and an unsigned integer.
415+
416+#### Produces
417+
418+An `fn`.
419+
420+#### Source
421+
422+```
423+ ++ sqt
424+ |= [a=[e=@s a=@u]] ^- fn
425+ =. a
426+ =+ [w=(met 0 a.a) x=(^mul +(prc) 2)]
427+ =+ ?:((^lth w x) (^sub x w) 0)
428+ =+ ?: =((dis - 1) (dis (abs:si e.a) 1)) -
429+ (^add - 1)
430+ a(e (dif:si e.a (sun:si -)), a (lsh 0 - a.a))
431+ =+ [y=(^sqt a.a) z=(fra:si e.a --2)]
432+ (rau [z p.y] =(q.y 0))
433+```
434+
435+#### Examples
436+
437+```
438+ > (^sqt:fl [-18 342.602.577])
439+ [%f s=%.y e=-107 a=5.865.903.143.604.945.574.132.671.852.050.553]
440+```
441+
442+---
443+### `++lth:fl`
444+
445+Less than
446+
447+Tests if `a` is less than `b`.
448+
449+#### Accepts
450+
451+`a` is a cell of a signed integer and an unsigned integer.
452+
453+`b` is a cell of a signed integer and an unsigned integer.
454+
455+#### Produces
456+
457+An `flag`.
458+
459+#### Source
460+
461+```
462+ ++ lth
463+ |= [a=[e=@s a=@u] b=[e=@s a=@u]] ^- ?
464+ ?: =(e.a e.b) (^lth a.a a.b)
465+ =+ c=(cmp:si (ibl a) (ibl b))
466+ ?: =(c -1) & ?: =(c --1) |
467+ ?: =((cmp:si e.a e.b) -1)
468+ (^lth (rsh 0 (abs:si (dif:si e.a e.b)) a.a) a.b)
469+ (^lth (lsh 0 (abs:si (dif:si e.a e.b)) a.a) a.b)
470+```
471+
472+#### Examples
473+
474+```
475+ > (^lth:fl [-4 684] [--0 35])
476+ %.n
477+
478+ > (^lth:fl [-4 684] [--0 90])
479+ %.y
480+```
481+
482+---
483+### `++equ:fl`
484+
485+Equals
486+
487+Tests if `a` is equal to `b`.
488+
489+#### Accepts
490+
491+`a` is a cell of a signed integer and an unsigned integer.
492+
493+`b` is a cell of a signed integer and an unsigned integer.
494+
495+#### Produces
496+
497+A `flag`.
498+
499+#### Source
500+
501+```
502+ ++ equ
503+ |= [a=[e=@s a=@u] b=[e=@s a=@u]] ^- ?
504+ ?. =((ibl a) (ibl b)) |
505+ ?: =((cmp:si e.a e.b) -1)
506+ =((lsh 0 (abs:si (dif:si e.a e.b)) a.b) a.a)
507+ =((lsh 0 (abs:si (dif:si e.a e.b)) a.a) a.b)
508+```
509+
510+#### Examples
511+
512+```
513+ > (^equ:fl [-4 480] [-0 50])
514+ %.n
515+
516+ > (^equ:fl [-4 480] [-0 30])
517+ %.y
518+```
519+
520+---
521+### `++ibl:fl`
522+
523+Integer binary logarithm
524+
525+Produces the lowest power to which the number 2 must be raised to obtain `a` or
526+greater.
527+
528+#### Accepts
529+
530+`a` is a cell of a signed integer and an unsigned integer.
531+
532+#### Produces
533+
534+A signed integer.
535+
536+#### Source
537+
538+```
539+ ++ ibl
540+ |= [a=[e=@s a=@u]] ^- @s
541+ (sum:si (sun:si (dec (met 0 a.a))) e.a)
542+```
543+
544+#### Examples
545+
546+```
547+ > (ibl:fl [-18 342.602.577])
548+ --10
549+```
550+
551+---
552+### `++uni:fl`
553+
554+Change representation to odd
555+
556+Produces another representation of the floating point `a` where the significand
557+is odd. Every floating-point number has a unique representation of this kind. If
558+the significand of `a` is already odd, nothing changes.
559+
560+#### Accepts
561+
562+`a` is a cell of a signed integer and an unsigned integer.
563+
564+#### Produces
565+
566+A cell of a signed integer and an unsigned integer.
567+
568+#### Source
569+
570+```
571+ ++ uni
572+ |= [a=[e=@s a=@u]]
573+ |- ?: =((end 0 1 a.a) 1) a
574+ $(a.a (rsh 0 1 a.a), e.a (sum:si e.a --1))
575+```
576+
577+#### Examples
578+
579+```
580+ > (uni:fl [-8 342.602.578])
581+ [e=-7 a=171.301.289]
582+
583+ > (uni:fl [-8 342.602.577])
584+ [e=-8 a=342.602.577]
585+```
586+
587+---
588+### `++xpd:fl`
589+
590+Expand
591+
592+Produces the fully precise form of `a`, or the denormalized form of `a`.
593+
594+#### Accepts
595+
596+`a` is a cell of a signed integer and an unsigned integer.
597+
598+#### Produces
599+
600+A cell of a signed integer and an unsigned integer.
601+
602+#### Sources
603+
604+```
605+ ++ xpd
606+ |= [a=[e=@s a=@u]]
607+ =+ ma=(met 0 a.a)
608+ ?: (gte ma prc) a
609+ =+ ?: =(den %i) (^sub prc ma)
610+ =+ ^= q
611+ =+ w=(dif:si e.a emn)
612+ ?: (syn:si w) (abs:si w) 0
613+ (min q (^sub prc ma))
614+ a(e (dif:si e.a (sun:si -)), a (lsh 0 - a.a))
615+```
616+
617+#### Examples
618+
619+```
620+ > (xpd:fl [--3 12])
621+ [e=-106 a=7.788.445.287.802.241.442.795.744.493.830.144]
622+
623+ > (xpd:fl [-8 342.602.577])
624+ [e=-92 a=6.626.897.619.228.945.634.459.505.846.648.832]
625+
626+ > (xpd:fl [-92 6.626.897.619.228.945.634.459.505.846.648.832])
627+ [e=-92 a=6.626.897.619.228.945.634.459.505.846.648.832]
628+```
629+
630+---
631+### `++lug:fl`
632+
633+Central rounding mechanism
634+
635+Performs various rounding operations on `a`. An operation is chosen based on the
636+value selected for `t`. `s` is a sticky bit that represents a value less than
637+ULP(a) = 2^(e.a)
638+
639+Possible rounding operations:
640+- Floor (`$fl`)
641+- Ceiling (`$ce`)
642+- Smaller (`$sm`)
643+- Larger (`$lg`)
644+- Nearest (`$ne`) -- Rounds ties away from 0 if the number is even, rounds
645+ toward 0 if the number is odd.
646+
647+#### Accepts
648+
649+`t` is one of the following: `$fl`, `$ce`, `$sm`, `$lg`, `$ne`, `$na`, or `$nt`.
650+
651+`a` is a cell of a signed integer and an unsigned integer.
652+
653+`s` is a flag.
654+
655+#### Produces
656+
657+An `fn`.
658+
659+#### Source
660+
661+```
662+ ::
663+ :: central rounding mechanism
664+ :: can perform: floor, ceiling, smaller, larger,
665+ :: nearest (round ties to: even, away from 0, toward 0)
666+ :: s is sticky bit: represents a value less than ulp(a) = 2^(e.a)
667+ ::
668+ ++ lug
669+ ~/ %lug
670+ |= [t=$?($fl $ce $sm $lg $ne $na $nt) a=[e=@s a=@u] s=?] ^- fn
671+ ?< =(a.a 0)
672+ =-
673+ ?. =(den %f) - :: flush denormals
674+ ?. ?=([$f *] -) -
675+ ?: =((met 0 ->+>) prc) - [%f & zer]
676+ ::
677+ =+ m=(met 0 a.a)
678+ ?> |(s (gth m prc)) :: require precision
679+ =+ ^= q %+ max
680+ ?: (gth m prc) (^sub m prc) 0 :: reduce precision
681+ %- abs:si ?: =(den %i) --0 :: enforce min. exp
682+ ?: =((cmp:si e.a emn) -1) (dif:si emn e.a) --0
683+ =^ b a :- (end 0 q a.a)
684+ a(e (sum:si e.a (sun:si q)), a (rsh 0 q a.a))
685+ ::
686+ ?~ a.a
687+ ?< =(den %i)
688+ ?- t
689+ $fl [%f & zer]
690+ $sm [%f & zer]
691+ $ce [%f & spd]
692+ $lg [%f & spd]
693+ $ne ?: s [%f & ?:((lte b (bex (dec q))) zer spd)]
694+ [%f & ?:((^lth b (bex (dec q))) zer spd)]
695+ $nt ?: s [%f & ?:((lte b (bex (dec q))) zer spd)]
696+ [%f & ?:((^lth b (bex (dec q))) zer spd)]
697+ $na [%f & ?:((^lth b (bex (dec q))) zer spd)]
698+ ==
699+ ::
700+ =. a (xpd a)
701+ ::
702+ =. a
703+ ?- t
704+ $fl a
705+ $lg a(a +(a.a))
706+ $sm ?. &(=(b 0) s) a
707+ ?: &(=(e.a emn) !=(den %i)) a(a (dec a.a))
708+ =+ y=(dec (^mul a.a 2))
709+ ?. (lte (met 0 y) prc) a(a (dec a.a))
710+ [(dif:si e.a --1) y]
711+ $ce ?: &(=(b 0) s) a a(a +(a.a))
712+ $ne ?~ b a
713+ =+ y=(bex (dec q))
714+ ?: &(=(b y) s) :: round halfs to even
715+ ?~ (dis a.a 1) a a(a +(a.a))
716+ ?: (^lth b y) a a(a +(a.a))
717+ $na ?~ b a
718+ =+ y=(bex (dec q))
719+ ?: (^lth b y) a a(a +(a.a))
720+ $nt ?~ b a
721+ =+ y=(bex (dec q))
722+ ?: =(b y) ?: s a a(a +(a.a))
723+ ?: (^lth b y) a a(a +(a.a))
724+ ==
725+ ::
726+ =. a ?. =((met 0 a.a) +(prc)) a
727+ a(a (rsh 0 1 a.a), e (sum:si e.a --1))
728+ ?~ a.a [%f & zer]
729+ ::
730+ ?: =(den %i) [%f & a]
731+ ?: =((cmp:si emx e.a) -1) [%i &] [%f & a] :: enforce max. exp
732+ ::
733+```
734+
735+---
736+### `++drg:fl`
737+
738+Get printable decimal
739+
740+Produces the decimal form of `a` using the Dragon4 algorithm. Guarantees
741+accurate results for rounded floats.
742+
743+#### Accepts
744+
745+`a` is a cell of a signed integer and an unsigned integer.
746+
747+#### Produces
748+
749+A cell of a signed integer and an unsigned integer.
750+
751+#### Source
752+
753+```
754+ ++ drg
755+ ~/ %drg
756+ |= [a=[e=@s a=@u]] ^- [@s @u]
757+ ?< =(a.a 0)
758+ =. a (xpd a)
759+ =+ r=(lsh 0 ?:((syn:si e.a) (abs:si e.a) 0) a.a)
760+ =+ s=(lsh 0 ?.((syn:si e.a) (abs:si e.a) 0) 1)
761+ =+ mn=(lsh 0 ?:((syn:si e.a) (abs:si e.a) 0) 1)
762+ =+ mp=mn
763+ => ?.
764+ ?& =(a.a (bex (dec prc))) :: if next smallest
765+ |(!=(e.a emn) =(den %i)) :: float is half ULP,
766+ == :: tighten lower bound
767+ .
768+ %= .
769+ mp (lsh 0 1 mp)
770+ r (lsh 0 1 r)
771+ s (lsh 0 1 s)
772+ ==
773+ =+ [k=--0 q=(^div (^add s 9) 10)]
774+ |- ?: (^lth r q)
775+ %= $
776+ k (dif:si k --1)
777+ r (^mul r 10)
778+ mn (^mul mn 10)
779+ mp (^mul mp 10)
780+ ==
781+ |- ?: (gte (^add (^mul r 2) mp) (^mul s 2))
782+ $(s (^mul s 10), k (sum:si k --1))
783+ =+ [u=0 o=0]
784+ |- :: r/s+o = a*10^-k
785+ =+ v=(dvr (^mul r 10) s)
786+ => %= .
787+ k (dif:si k --1)
788+ u p.v
789+ r q.v
790+ mn (^mul mn 10)
791+ mp (^mul mp 10)
792+ ==
793+ =+ l=(^lth (^mul r 2) mn) :: in lower bound
794+ =+ ^= h :: in upper bound
795+ ?| (^lth (^mul s 2) mp)
796+ (gth (^mul r 2) (^sub (^mul s 2) mp))
797+ ==
798+ ?: &(!l !h)
799+ $(o (^add (^mul o 10) u))
800+ =+ q=&(h |(!l (gth (^mul r 2) s)))
801+ =. o (^add (^mul o 10) ?:(q +(u) u))
802+ [k o]
803+```
804+
805+#### Examples
806+
807+```
808+ > (sun:fl 218.116)
809+ [%f s=%.y e=-95 a=8.640.464.947.480.640.129.276.716.135.743.488]
810+ > (^drg:fl [e=-95 a=8.640.464.947.480.640.129.276.716.135.743.488])
811+ [--0 218.116]
812+
813+ > (sun:fl 102.057.673.128.349)
814+ [%f s=%.y e=-66 a=7.530.527.107.827.833.883.675.587.233.447.936]
815+ > (^drg:fl [e=-66 a=7.530.527.107.827.833.883.675.587.233.447.936])
816+ [--0 102.057.673.128.349]
817+```
818+
819+---
820+### `++toj:fl`
821+
822+Round to integer
823+
824+Rounds float `a` to the nearest decimal float with an exponent of 0.
825+
826+#### Accepts
827+
828+`a` is a cell of a signed integer and an unsigned integer.
829+
830+#### Produces
831+
832+An `fn`.
833+
834+#### Source
835+
836+```
837+ ++ toj
838+ |= [a=[e=@s a=@u]] ^- fn
839+ ?. =((cmp:si e.a --0) -1) [%f & a]
840+ =+ x=(abs:si e.a)
841+ =+ y=(rsh 0 x a.a)
842+ ?: |(=(r %d) =(r %z)) [%f & --0 y]
843+ =+ z=(end 0 x a.a)
844+ ?: |(=(r %u) =(r %a)) [%f & --0 ?~(z y +(y))]
845+ =+ i=(bex (dec x))
846+ ?: &(=(z i) =((dis y 1) 0)) [%f & --0 y]
847+ ?: (^lth z i) [%f & --0 y] [%f & --0 +(y)]
848+```
849+
850+#### Examples
851+
852+```
853+ > (^toj:fl [-11 7.530.107.827.833.587])
854+ [%f s=%.y e=--0 a=3.676.810.462.809]
855+
856+ > (^toj:fl [-11 7.530.107.827.833.589])
857+ [%f s=%.y e=--0 a=3.676.810.462.809]
858+```
859+
860+---
861+### `++ned:fl`
862+
863+Require float
864+
865+Produces `a` if `a` is a is of floating-point representation. If `a` is another
866+case of `fn`, such as infinity or not-a-number, a crash is produced.
867+
868+#### Accepts
869+
870+`a` is an `fn`.
871+
872+#### Produces
873+
874+A cell of a signed integer and an unsigned integer.
875+
876+#### Source
877+
878+```
879+ ++ ned
880+ |= [a=fn] ^- [$f s=? e=@s a=@u]
881+ ?: ?=([$f *] a) a
882+ ~_ leaf+"need-float"
883+ !!
884+```
885+
886+#### Examples
887+
888+
889+```
890+ > (ned:fl [%f s=%.y e=-11 a=7.530.107.827.833.587])
891+ [%f s=%.y e=-11 a=7.530.107.827.833.587]
892+
893+ > (ned:fl [%n ~])
894+ ! need-float
895+ ! exit
896+
897+ > (ned:fl [%i |])
898+ ! need-float
899+ ! exit
900+```
901+
902+---
903+### `++shf:fl`
904+
905+Shift power
906+
907+Multiplies `a` by 2 to the `b` power without rounding. This results in shifting
908+the exponent term by `b`.
909+
910+#### Accepts
911+
912+`a` is an `fn`.
913+
914+`b` is a signed integer.
915+
916+#### Produces
917+
918+An `fn`.
919+
920+#### Source
921+
922+```
923+ ++ shf
924+ |= [a=fn b=@s]
925+ ?: |(?=([$n *] a) ?=([$i *] a)) a
926+ a(e (sum:si e.a b))
927+```
928+
929+#### Examples
930+
931+```
932+ > (shf:fl [[%f & -2 7] --2])
933+ [%f s=%.y e=--0 a=7]
934+
935+ > (shf:fl [[%f & -2 7] -2])
936+ [%f s=%.y e=-4 a=7]
937+
938+ > (shf:fl [%f & -11 7.530.107.827.833.587] --5)
939+ [%f s=%.y e=-6 a=7.530.107.827.833.587]
940+```
941+
942+---
943+### `++fli:fl`
944+
945+Flip sign
946+
947+Produces `a` with its signed changed from positive to negative, or vice versa.
948+
949+#### Accepts
950+
951+`a` is an `fn`.
952+
953+#### Produces
954+
955+An `fn`.
956+
957+#### Source
958+
959+```
960+ ++ fli
961+ |= [a=fn] ^- fn
962+ ?-(-.a $f a(s !s.a), $i a(s !s.a), $n a)
963+```
964+
965+#### Examples
966+
967+```
968+ > (fli:fl [%f %.y -2 7])
969+ [%f s=%.n e=-2 a=7]
970+
971+ > (fli:fl [%f %.n --2 30.617])
972+ [%f s=%.y e=--2 a=30.617]
973+
974+ > (fli:fl [%f | --2 30.617])
975+ [%f s=%.y e=--2 a=30.617]
976+```
977+
978+---
979+### `++swr:fl`
980+
981+Switch rounding
982+
983+Switches the rounding mode of `r:fl`.
984+
985+#### Source
986+
987+```
988+ ++ swr ?+(r r $d %u, $u %d)
989+```
990+
991+#### Examples
992+
993+```
994+ > r:fl
995+ %n
996+ > swr:fl
997+ %n
998+
999+ > =new-fl fl :: new fl core with changed state
1000+ > =new-fl new-fl(r %u)
1001+ > swr:new-fl
1002+ %d
1003+```
1004+
1005+---
1006+### `++prc:fl`
1007+
1008+Force precision of 2 or greater
1009+
1010+Produces `p`, the core's precision, if `p` is greater than or equal to 2.
1011+Otherwise, a crash is produced.
1012+
1013+#### Source
1014+
1015+```
1016+ ++ prc ?>((gth p 1) p)
1017+```
1018+
1019+#### Examples
1020+
1021+```
1022+ > prc:fl
1023+ 113
1024+
1025+ > =new-fl fl
1026+ > =new-fl new-fl(p 1)
1027+ > prc:new-fl
1028+ ! exit
1029+
1030+ > =new-fl new-fl(p 2)
1031+ > prc:new-fl
1032+ 2
1033+```
1034+
1035+---
1036+### `++den:fl`
1037+
1038+Behavior
1039+
1040+Produces `d:fl`. Denormalizes if `d:fl` is `%d`. Flushes denormals to zero if
1041+`d:fl` is `%f`.
1042+
1043+- Denormalizes if `d:fl` is `%d`.
1044+- Flushes denormals to zero if `d:fl` is `%f`.
1045+- Infinite exponent range if `$d` is `$i`.
1046+
1047+The default value of `d` is `%d`.
1048+
1049+#### Source
1050+
1051+```
1052+ ++ den d
1053+```
1054+
1055+#### Examples
1056+
1057+```
1058+ > den:fl
1059+ %d
1060+
1061+ > =new-fl fl
1062+ > =new-fl new-fl(d %f)
1063+ > den:new-fl
1064+ %f
1065+```
1066+
1067+---
1068+### `++emn:si`
1069+
1070+Minimum exponent
1071+
1072+Produces `v:fl`, the minimum exponent. The default minimum exponent is -16.494.
1073+
1074+#### Source
1075+
1076+```
1077+ ++ emn v
1078+```
1079+
1080+#### Examples
1081+
1082+```
1083+ > emn:fl
1084+ -16.494
1085+```
1086+
1087+---
1088+### `++emx:fl`
1089+
1090+Maximum exponent
1091+
1092+Returns the maximum exponent of `fl`. The default maximum exponent is --16.494.
1093+
1094+#### Source
1095+
1096+```
1097+ ++ emx (sum:si emn (sun:si w))
1098+```
1099+
1100+#### Examples
1101+
1102+```
1103+ > `@u`emx:fl
1104+ 32.542
1105+```
1106+
1107+---
1108+### `++spd:fl`
1109+
1110+Smallest denormal
1111+
1112+Produces the smallest possible denormalized float.
1113+
1114+#### Source
1115+
1116+```
1117+ ++ spd [e=emn a=1]
1118+```
1119+
1120+#### Examples
1121+
1122+```
1123+ > spd:fl
1124+ [e=-16.494 a=1]
1125+```
1126+
1127+---
1128+### `++spn:fl`
1129+
1130+Smallest normal
1131+
1132+Produces the smallest representable normal float.
1133+
1134+#### Source
1135+
1136+```
1137+ ++ spn [e=emn a=(bex (dec prc))]
1138+```
1139+
1140+#### Examples
1141+
1142+```
1143+ > spn:fl
1144+ [e=-16.494 a=5.192.296.858.534.827.628.530.496.329.220.096]
1145+```
1146+
1147+---
1148+### `++lfn:fl`
1149+
1150+Largest normal
1151+
1152+Produces the largest representable normal float.
1153+
1154+#### Source
1155+
1156+```
1157+ ++ lfn [e=emx a=(fil 0 prc 1)]
1158+```
1159+
1160+#### Examples
1161+
1162+```
1163+ > lfn:fl
1164+ [e=--16.271 a=10.384.593.717.069.655.257.060.992.658.440.191]
1165+```
1166+
1167+---
1168+### `++lfe:fl`
1169+
1170+Maximum
1171+
1172+Produces the sum of `emx:fl` plus `prc:fl`.
1173+
1174+#### Source
1175+
1176+```
1177+ ++ lfe (sum:si emx (sun:si prc)) :: 2^lfe is > than all
1178+```
1179+
1180+#### Examples
1181+
1182+```
1183+ > lfe:fl
1184+ --16.384
1185+```
1186+
1187+---
1188+### `++zer:fl`
1189+
1190+Zero
1191+
1192+Produces zero represented as a float.
1193+
1194+#### Source
1195+
1196+```
1197+ ++ zer [e=--0 a=0]
1198+ --
1199+ |%
1200+```
1201+
1202+#### Examples
1203+
1204+```
1205+ > zer:fl
1206+ [e=--0 a=0]
1207+```
1208+
1209+---
1210+### `++rou:fl`
1211+
1212+Round
1213+
1214+Rounds `a`. The way in which `a` is rounded depends on the value of `r:fl`.
1215+
1216+#### Accepts
1217+
1218+`a` is an `fn`.
1219+
1220+#### Produes
1221+
1222+An `fn`.
1223+
1224+#### Source
1225+
1226+```
1227+ ++ rou
1228+ |= [a=fn] ^- fn
1229+ ?. ?=([$f *] a) a
1230+ ?~ a.a [%f s.a zer]
1231+ ?: s.a (^rou +>.a)
1232+ =.(r swr (fli (^rou +>.a)))
1233+```
1234+
1235+#### Examples
1236+
1237+```
1238+ > =a 10.161.487.211.429.486.882.397.572.894.294.017.777
1239+ > (rou:fl [%f & --12 a])
1240+ [%f s=%.y e=--22 a=9.923.327.354.911.608.283.591.379.779.584.002]
1241+
1242+ > (rou:fl [%f & --12 (add a 1)])
1243+ [%f s=%.y e=--22 a=9.923.327.354.911.608.283.591.379.779.584.002]
1244+
1245+ > (rou:fl [%f & --12 (add a 300)])
1246+ [%f s=%.y e=--22 a=9.923.327.354.911.608.283.591.379.779.584.002]
1247+
1248+ > (rou:fl [%f & --12 (add a 1.000)])
1249+ [%f s=%.y e=--22 a=9.923.327.354.911.608.283.591.379.779.584.003]
1250+```
1251+
1252+---
1253+### `++syn:fl`
1254+
1255+Get sign
1256+
1257+Produces the sign of `a`.
1258+
1259+#### Accepts
1260+
1261+`a` is an `fn`.
1262+
1263+#### Produes
1264+
1265+An `fn`.
1266+
1267+#### Source
1268+
1269+```
1270+ ++ syn
1271+ |= [a=fn] ^- ?
1272+ ?-(-.a $f s.a, $i s.a, $n &)
1273+```
1274+
1275+#### Examples
1276+
1277+```
1278+ > (syn:fl (sun:fl 106))
1279+ %.y
1280+
1281+ > (syn:fl [%f | --0 106])
1282+ %.n
1283+```
1284+
1285+---
1286+### `++abs:fl`
1287+
1288+Absolute value
1289+
1290+Produces the absolute value of `a`.
1291+
1292+#### Accepts
1293+
1294+`a` is an `fn`.
1295+
1296+#### Produes
1297+
1298+An `fn`.
1299+
1300+#### Sources
1301+
1302+```
1303+ ++ abs
1304+ |= [a=fn] ^- fn
1305+ ?: ?=([$f *] a) [%f & e.a a.a]
1306+ ?: ?=([$i *] a) [%i &] [%n ~]
1307+```
1308+
1309+#### Examples
1310+
1311+```
1312+ > (abs:fl [%f | --0 106])
1313+ [%f s=%.y e=--0 a=106]
1314+
1315+ > (abs:fl [%f & --0 106])
1316+ [%f s=%.y e=--0 a=106]
1317+```
1318+
1319+---
1320+### `++add:fl`
1321+
1322+Add
1323+
1324+Produces the sum of `a` plus `b`.
1325+
1326+#### Accepts
1327+
1328+`a` is an `fn`.
1329+
1330+`b` is an `fn`.
1331+
1332+#### Produces
1333+
1334+An `fn`.
1335+
1336+#### Source
1337+
1338+```
1339+ ++ add
1340+ |= [a=fn b=fn] ^- fn
1341+ ?: |(?=([$n *] a) ?=([$n *] b)) [%n ~]
1342+ ?: |(?=([$i *] a) ?=([$i *] b))
1343+ ?: &(?=([$i *] a) ?=([$i *] b))
1344+ ?: =(a b) a [%n ~]
1345+ ?: ?=([$i *] a) a b
1346+ ?: |(=(a.a 0) =(a.b 0))
1347+ ?. &(=(a.a 0) =(a.b 0)) %- rou ?~(a.a b a)
1348+ [%f ?:(=(r %d) &(s.a s.b) |(s.a s.b)) zer]
1349+ %- |= [a=fn]
1350+ ?. ?=([$f *] a) a
1351+ ?. =(a.a 0) a
1352+ [%f !=(r %d) zer]
1353+ ?: =(s.a s.b)
1354+ ?: s.a (^add +>.a +>.b |)
1355+ =.(r swr (fli (^add +>.a +>.b |)))
1356+ ?: s.a (^sub +>.a +>.b |)
1357+ (^sub +>.b +>.a |)
1358+```
1359+
1360+#### Examples
1361+
1362+```
1363+ > (add:fl [%f & --0 106] [%f | --3 55])
1364+ [%f s=%.n e=-104 a=6.774.324.807.619.657.921.598.381.929.529.344]
1365+```
1366+
1367+---
1368+### `++ead:fl`
1369+
1370+Exact add
1371+
1372+Produces the exact sum of `a` plus `b`.
1373+
1374+#### Accepts
1375+
1376+`a` is an `fn`.
1377+
1378+`b` is an `fn`.
1379+
1380+#### Produces
1381+
1382+An `fn`.
1383+
1384+#### Source
1385+
1386+```
1387+ ++ ead
1388+ |= [a=fn b=fn] ^- fn
1389+ ?: |(?=([$n *] a) ?=([$n *] b)) [%n ~]
1390+ ?: |(?=([$i *] a) ?=([$i *] b))
1391+ ?: &(?=([$i *] a) ?=([$i *] b))
1392+ ?: =(a b) a [%n ~]
1393+ ?: ?=([$i *] a) a b
1394+ ?: |(=(a.a 0) =(a.b 0))
1395+ ?. &(=(a.a 0) =(a.b 0)) ?~(a.a b a)
1396+ [%f ?:(=(r %d) &(s.a s.b) |(s.a s.b)) zer]
1397+ %- |= [a=fn]
1398+ ?. ?=([$f *] a) a
1399+ ?. =(a.a 0) a
1400+ [%f !=(r %d) zer]
1401+ ?: =(s.a s.b)
1402+ ?: s.a (^add +>.a +>.b &)
1403+ (fli (^add +>.a +>.b &))
1404+ ?: s.a (^sub +>.a +>.b &)
1405+ (^sub +>.b +>.a &)
1406+ ::
1407+```
1408+
1409+#### Examples
1410+
1411+```
1412+ > (ead:fl [%f & --0 106] [%f | --3 55])
1413+ [%f s=%.n e=--0 a=334]
1414+```
1415+
1416+---
1417+### `++sub:fl`
1418+
1419+Subtract
1420+
1421+Produces the difference of `a` minus `b`.
1422+
1423+#### Accepts
1424+
1425+`a` is an `fn`.
1426+
1427+`b` is an `fn`.
1428+
1429+#### Produces
1430+
1431+An `fn`.
1432+
1433+#### Source
1434+
1435+```
1436+ ++ sub
1437+ |= [a=fn b=fn] ^- fn (add a (fli b))
1438+```
1439+
1440+#### Examples
1441+
1442+```
1443+ > (sub:fl [%f & --13 2.718] [%f & --23 11])
1444+ [%f s=%.n e=-86 a=5.416.671.014.775.224.232.595.412.796.571.648]
1445+```
1446+
1447+---
1448+### `++mul:fl`
1449+
1450+Multiply
1451+
1452+Produces the product of `a` multiplied by `b`.
1453+
1454+#### Accepts
1455+
1456+`a` is an `fn`.
1457+
1458+`b` is an `fn`.
1459+
1460+#### Produces
1461+
1462+An `fn`.
1463+
1464+#### Source
1465+
1466+```
1467+ ++ mul
1468+ |= [a=fn b=fn] ^- fn
1469+ ?: |(?=([$n *] a) ?=([$n *] b)) [%n ~]
1470+ ?: ?=([$i *] a)
1471+ ?: ?=([$i *] b)
1472+ [%i =(s.a s.b)]
1473+ ?: =(a.b 0) [%n ~] [%i =(s.a s.b)]
1474+ ?: ?=([$i *] b)
1475+ ?: =(a.a 0) [%n ~] [%i =(s.a s.b)]
1476+ ?: |(=(a.a 0) =(a.b 0)) [%f =(s.a s.b) zer]
1477+ ?: =(s.a s.b) (^mul +>.a +>.b)
1478+ =.(r swr (fli (^mul +>.a +>.b)))
1479+```
1480+
1481+---
1482+### `++emu:fl`
1483+
1484+Exact multiply
1485+
1486+Produces the exact product of `a` multiplied by `b`.
1487+
1488+#### Accepts
1489+
1490+`a` is an `fn`.
1491+
1492+`b` is an `fn`.
1493+
1494+#### Produces
1495+
1496+An `fn`.
1497+
1498+#### Examples
1499+
1500+```
1501+ ++ emu
1502+ |= [a=fn b=fn] ^- fn
1503+ ?: |(?=([$n *] a) ?=([$n *] b)) [%n ~]
1504+ ?: ?=([$i *] a)
1505+ ?: ?=([$i *] b)
1506+ [%i =(s.a s.b)]
1507+ ?: =(a.b 0) [%n ~] [%i =(s.a s.b)]
1508+ ?: ?=([$i *] b)
1509+ ?: =(a.a 0) [%n ~] [%i =(s.a s.b)]
1510+ ?: |(=(a.a 0) =(a.b 0)) [%f =(s.a s.b) zer]
1511+ [%f =(s.a s.b) (sum:si e.a e.b) (^^mul a.a a.b)]
1512+```
1513+
1514+---
1515+### `++div:fl`
1516+
1517+Divide
1518+
1519+Produces the quotient of `a` divided by `b`.
1520+
1521+#### Accepts
1522+
1523+`a` is an `fn`.
1524+
1525+`b` is an `fn`.
1526+
1527+#### Produces
1528+
1529+An `fn`.
1530+
1531+#### Divide
1532+
1533+```
1534+ ++ div
1535+ |= [a=fn b=fn] ^- fn
1536+ ?: |(?=([$n *] a) ?=([$n *] b)) [%n ~]
1537+ ?: ?=([$i *] a)
1538+ ?: ?=([$i *] b) [%n ~] [%i =(s.a s.b)]
1539+ ?: ?=([$i *] b) [%f =(s.a s.b) zer]
1540+ ?: =(a.a 0) ?: =(a.b 0) [%n ~] [%f =(s.a s.b) zer]
1541+ ?: =(a.b 0) [%i =(s.a s.b)]
1542+ ?: =(s.a s.b) (^div +>.a +>.b)
1543+ =.(r swr (fli (^div +>.a +>.b)))
1544+```
1545+
1546+---
1547+### `++fma:fl`
1548+
1549+Fused multiply-add
1550+
1551+Produces the sum of `c` plus the product of `a` multiplied by `b`;
1552+`(a * b) + c`.
1553+
1554+#### Accepts
1555+
1556+`a` is an `fn`.
1557+
1558+`b` is an `fn`.
1559+
1560+`c` is an `fn`.
1561+
1562+#### Produces
1563+
1564+An `fn`.
1565+
1566+#### Source
1567+
1568+```
1569+ ++ fma
1570+ |= [a=fn b=fn c=fn] ^- fn
1571+ (add (emu a b) c)
1572+```
1573+
1574+#### Examples
1575+
1576+```
1577+ > (fma:fl [%f & --13 2.718] [%f & --23 11] [%f & --13 2.718])
1578+ [%f s=%.y e=-62 a=9.475.054.514.089.037.465.004.673.635.188.736]=
1579+```
1580+
1581+---
1582+### `++sqt:fl`
1583+
1584+Square root
1585+
1586+Produces the square root of `a`.
1587+
1588+#### Accepts
1589+
1590+`a` is an `fn`.
1591+
1592+#### Produces
1593+
1594+An `fn`.
1595+
1596+#### Source
1597+
1598+```
1599+ ++ sqt
1600+ |= [a=fn] ^- fn
1601+ ?: ?=([$n *] a) [%n ~]
1602+ ?: ?=([$i *] a) ?:(s.a a [%n ~])
1603+ ?~ a.a [%f s.a zer]
1604+ ?: s.a (^sqt +>.a) [%n ~]
1605+```
1606+
1607+#### Examples
1608+
1609+```
1610+ > (sqt:fl [%f s=%.y e=-18 a=342.602.577])
1611+ [%f s=%.y e=-107 a=5.865.903.143.604.945.574.132.671.852.050.553]
1612+```
1613+
1614+---
1615+### `++inv:fl`
1616+
1617+Inverse
1618+
1619+Produces the inverse of `a` by dividing `1` by `a`.
1620+
1621+#### Accepts
1622+
1623+`a` is an `fn`.
1624+
1625+#### Produces
1626+
1627+An `fn`.
1628+
1629+#### Source
1630+
1631+```
1632+ ++ inv
1633+ |= [a=fn] ^- fn
1634+ (div [%f & --0 1] a)
1635+```
1636+
1637+#### Examples
1638+
1639+```
1640+ > (inv:fl [%f s=%.y e=--0 a=10])
1641+ [%f s=%.y e=-116 a=8.307.674.973.655.724.205.648.794.126.752.154]
1642+ > (drg:fl [%f s=%.y e=-116 a=8.307.674.973.655.724.205.648.794.126.752.154])
1643+ [%d s=%.y e=-1 a=1]
1644+
1645+ > (inv:fl [%f s=%.y e=--1 a=10])
1646+ [%f s=%.y e=-117 a=8.307.674.973.655.724.205.648.794.126.752.154]
1647+ > (drg:fl [%f s=%.y e=-117 a=8.307.674.973.655.724.205.648.794.126.752.154])
1648+ [%d s=%.y e=-2 a=5]
1649+
1650+ > (inv:fl [%f s=%.y e=--2 a=10])
1651+ [%f s=%.y e=-118 a=8.307.674.973.655.724.205.648.794.126.752.154]
1652+ > (drg:fl [%f s=%.y e=-118 a=8.307.674.973.655.724.205.648.794.126.752.154])
1653+ [%d s=%.y e=-3 a=25]
1654+```
1655+
1656+---
1657+### `++sun:fl`
1658+
1659+Signed integer to float
1660+
1661+Produces `a` in floating-point representation.
1662+
1663+#### Accepts
1664+
1665+`a` is an unsigned integer.
1666+
1667+#### Produces
1668+
1669+An `fn`.
1670+
1671+#### Source
1672+
1673+```
1674+ ++ sun
1675+ |= [a=@u] ^- fn
1676+ (rou [%f & --0 a])
1677+```
1678+
1679+#### Examples
1680+
1681+```
1682+ > (sun:fl 0)
1683+ [%f s=%.y e=--0 a=0]
1684+
1685+ > (sun:fl 5.048.729)
1686+ [%f s=%.y e=-90 a=6.250.023.776.601.238.669.911.180.544.311.296]
1687+
1688+ > (sun:fl -100)
1689+ ! exit
1690+```
1691+
1692+---
1693+### `++san:fl`
1694+
1695+Signed integer to float
1696+
1697+Produces the floating-point representation of `a`, an unsigned integer.
1698+
1699+#### Accepts
1700+
1701+`a` is an unsigned integer.
1702+
1703+#### Produces
1704+
1705+An `fn`.
1706+
1707+#### Source
1708+
1709+```
1710+ ++ san
1711+ |= [a=@s] ^- fn
1712+ =+ b=(old:si a)
1713+ (rou [%f -.b --0 +.b])
1714+```
1715+
1716+#### Examples
1717+
1718+```
1719+ > (san:fl --100)
1720+ [%f s=%.y e=-106 a=8.112.963.841.460.668.169.578.900.514.406.400]
1721+
1722+ > (san:fl -100)
1723+ [%f s=%.n e=-106 a=8.112.963.841.460.668.169.578.900.514.406.400]
1724+```
1725+
1726+---
1727+### `++lth:fl`
1728+
1729+Less than
1730+
1731+Tests if `a` is less than `b`. Returns `~` in the event of `a` or `b` being a
1732+NaN (`[%n ~]`).
1733+
1734+#### Accepts
1735+
1736+`a` is an `fn`.
1737+
1738+`b` is an `fn`.
1739+
1740+#### Produces
1741+
1742+A `unit` of `flag`.
1743+
1744+#### Source
1745+
1746+```
1747+ ++ lth
1748+ |= [a=fn b=fn] ^- (unit ?)
1749+ ?: |(?=([$n *] a) ?=([$n *] b)) ~ :- ~
1750+ ?: =(a b) |
1751+ ?: ?=([$i *] a) !s.a ?: ?=([$i *] b) s.b
1752+ ?: |(=(a.a 0) =(a.b 0))
1753+ ?: &(=(a.a 0) =(a.b 0)) |
1754+ ?: =(a.a 0) s.b !s.a
1755+ ?: !=(s.a s.b) s.b
1756+ ?: s.a (^lth +>.a +>.b) (^lth +>.b +>.a)
1757+```
1758+
1759+#### Examples
1760+
1761+```
1762+ > (lth:fl (sun:fl 116) (sun:fl 4.820))
1763+ [~ u=%.y]
1764+
1765+ > (lth:fl (sun:fl 218.116) (sun:fl 4.820))
1766+ [~ u=%.n]
1767+
1768+ > (lth:fl (sun:fl 218.116) [%n ~])
1769+ ~
1770+```
1771+
1772+---
1773+### `++lte:fl`
1774+
1775+Less than or equal
1776+
1777+Tests whether `a` is less than or equal to `b`. Returns `~` in the event of `a`
1778+or `b` being a NaN (`[%n ~]`).
1779+
1780+#### Accepts
1781+
1782+`a` is an `fn`.
1783+
1784+`b` is an `fn`.
1785+
1786+#### Produces
1787+
1788+A `unit` of `flag`.
1789+
1790+#### Source
1791+
1792+```
1793+ ++ lte
1794+ |= [a=fn b=fn] ^- (unit ?)
1795+ %+ bind (lth b a) |= a=? !a
1796+```
1797+
1798+#### Examples
1799+
1800+```
1801+ > (lte:fl (sun:fl 102) [%f %.y -5 973.655.724])
1802+ [~ u=%.y]
1803+
1804+ > (lte:fl (sun:fl 102) [%f %.y -24 973.655.724])
1805+ [~ u=%.n]
1806+
1807+ > (lte:fl [%f %.y --2 25] (sun:fl 100))
1808+ [~ u=%.y]
1809+
1810+ > (lte:fl [%f %.y --2 25] [%f %.y --3 2])
1811+ [~ u=%.n]
1812+
1813+ > (lte:fl [%f %.y --2 25] [%n ~])
1814+ ~
1815+```
1816+
1817+---
1818+### `++equ:fl`
1819+
1820+Equals
1821+
1822+Tests if `a` is equal to `b`. Returns `~` in the event of `a` or `b` being a NaN
1823+(`[%n ~]`).
1824+
1825+#### Accepts
1826+
1827+`a` is an `fn`.
1828+
1829+`b` is an `fn`.
1830+
1831+#### Produces
1832+
1833+An `unit` of `flag`.
1834+
1835+#### Source
1836+
1837+```
1838+ ++ equ
1839+ |= [a=fn b=fn] ^- (unit ?)
1840+ ?: |(?=([$n *] a) ?=([$n *] b)) ~ :- ~
1841+ ?: =(a b) &
1842+ ?: |(?=([$i *] a) ?=([$i *] b)) |
1843+ ?: |(=(a.a 0) =(a.b 0))
1844+ ?: &(=(a.a 0) =(a.b 0)) & |
1845+ ?: |(=(e.a e.b) !=(s.a s.b)) |
1846+ (^equ +>.a +>.b)
1847+```
1848+
1849+#### Examples
1850+
1851+```
1852+ > (equ:fl [%f %.y --2 25] (sun:fl 100))
1853+ [~ u=%.y]
1854+
1855+ > (equ:fl [%f %.y --2 25] (sun:fl 101))
1856+ [~ u=%.n]
1857+```
1858+
1859+---
1860+### `++gte:fl`
1861+
1862+Greater or equal than
1863+
1864+Tests whether `a` is greater than or equal to `b`. Returns `~` in the event of
1865+`a` or `b` being a NaN (`[%n ~]`).
1866+
1867+#### Accepts
1868+
1869+`a` is an `fn`.
1870+
1871+`b` is an `fn`.
1872+
1873+#### Produces
1874+
1875+An `unit` of `flag`.
1876+
1877+#### Source
1878+
1879+```
1880+ ++ gte
1881+ |= [a=fn b=fn] ^- (unit ?) (lte b a)
1882+```
1883+
1884+#### Examples
1885+
1886+```
1887+ > (gte:fl [%f %.y --2 25] (sun:fl 100))
1888+ [~ u=%.y]
1889+
1890+ > (gth:fl [%f %.y --6 73.989] [%f %.y --5 919.599])
1891+ [~ u=%.n]
1892+
1893+ > (gth:fl [%f %.y --6 73.989] [%n ~])
1894+ ~
1895+```
1896+
1897+---
1898+### `++gth:fl`
1899+
1900+Greater than
1901+
1902+Tests whether `a` is greater than `b`. Returns `~` in the event of `a` or `b`
1903+being a NaN (`[%n ~]`).
1904+
1905+#### Accepts
1906+
1907+`a` is an `fn`.
1908+
1909+`b` is an `fn`.
1910+
1911+#### Produces
1912+
1913+An `unit` of `flag`.
1914+
1915+#### Source
1916+
1917+```
1918+ ++ gth
1919+ |= [a=fn b=fn] ^- (unit ?) (lth b a)
1920+```
1921+
1922+#### Examples
1923+
1924+```
1925+ > (gth:fl [%f %.y --2 25] (sun:fl 100))
1926+ [~ u=%.n]
1927+
1928+ > (gth:fl [%f %.y --6 73.989] [%f %.y --5 119.599])
1929+ [~ u=%.y]
1930+```
1931+
1932+---
1933+### `++drg:fl`
1934+
1935+Float to decimal
1936+
1937+Produces the decimal form of `a` using the Dragon4 algorithm. Guarantees
1938+accurate results for rounded floats.
1939+
1940+#### Accepts
1941+
1942+`a` is an `fn`.
1943+
1944+#### Produces
1945+
1946+A `dn`.
1947+
1948+#### Source
1949+
1950+```
1951+ ++ drg
1952+ |= [a=fn] ^- dn
1953+ ?: ?=([$n *] a) [%n ~]
1954+ ?: ?=([$i *] a) [%i s.a]
1955+ ?~ a.a [%d s.a --0 0]
1956+ [%d s.a (^drg +>.a)]
1957+```
1958+
1959+#### Examples
1960+
1961+```
1962+ > (drg:fl [%f | --6 73.989])
1963+ [%d s=%.n e=--0 a=4.735.296]
1964+```
1965+
1966+---
1967+### `++grd:fl`
1968+
1969+Decimal to float
1970+
1971+Converts decimal `a` to `fn`.
1972+
1973+#### Accepts
1974+
1975+`a` is a `dn`.
1976+
1977+#### Produces
1978+
1979+An `fn`.
1980+
1981+#### Source
1982+
1983+```
1984+ ++ grd
1985+ |= [a=dn] ^- fn
1986+ ?: ?=([$n *] a) [%n ~]
1987+ ?: ?=([$i *] a) [%i s.a]
1988+ => .(r %n)
1989+ =+ q=(abs:si e.a)
1990+ ?: (syn:si e.a)
1991+ (mul [%f s.a --0 a.a] [%f & e.a (pow 5 q)])
1992+ (div [%f s.a --0 a.a] [%f & (sun:si q) (pow 5 q)])
1993+```
1994+
1995+#### Examples
1996+
1997+```
1998+ > (grd:fl [%d s=%.n e=--0 a=73.989])
1999+ [%f s=%.n e=-96 a=5.862.012.516.267.904.074.208.723.341.410.304]
2000+
2001+ > (grd:fl [%d s=%.n e=--0 a=100])
2002+ [%f s=%.n e=-106 a=8.112.963.841.460.668.169.578.900.514.406.400]
2003+```
2004+
2005+---
2006+### `++toi:fl`
2007+
2008+Round to signed integer
2009+
2010+Rounds `a` to the nearest signed integer.
2011+
2012+#### Accepts
2013+
2014+`a` is an `fn`.
2015+
2016+#### Produces
2017+
2018+A `unit` of @s.
2019+
2020+#### Source
2021+
2022+```
2023+ ++ toi
2024+ |= [a=fn] ^- (unit @s)
2025+ =+ b=(toj a)
2026+ ?. ?=([$f *] b) ~ :- ~
2027+ =+ c=(^^mul (bex (abs:si e.b)) a.b)
2028+ (new:si s.b c)
2029+```
2030+
2031+#### Examples
2032+
2033+```
2034+ > (toi:fl [%f s=%.y e=-78 a=8.112.963.841.460.668.169.578.900.514.406.400])
2035+ [~ u=--26.843.545.600]
2036+```
2037+
2038+---
2039+### `++toj:fl`
2040+
2041+Round to integer fn
2042+
2043+Rounds `a` to the nearest decimal integer.
2044+
2045+#### Accepts
2046+
2047+`a` is an `fn`.
2048+
2049+#### Produces
2050+
2051+A `unit` of @s.
2052+
2053+#### Source
2054+
2055+```
2056+ ++ toj
2057+ |= [a=fn] ^- fn
2058+ ?. ?=([$f *] a) a
2059+ ?~ a.a [%f s.a zer]
2060+ ?: s.a (^toj +>.a)
2061+ =.(r swr (fli (^toj +>.a)))
2062+ --
2063+```
2064+
2065+#### Examples
2066+
2067+```
2068+ > (toj:fl [%f s=%.y e=-78 a=8.112.963.841.460.668.169.578.900.514.406.400])
2069+ [%f s=%.y e=--0 a=26.843.545.600]
2070+
2071+ > (toj:fl [%f s=%.y e=-78 a=8.112.963.841.460.668.169.578.900.514])
2072+ [%f s=%.y e=--0 a=26.844]
2073+
2074+ > (toj:fl [%f s=%.y e=-78 a=8.112.963.841.460])
2075+ [%f s=%.y e=--0 a=0]
2076+
2077+ > (toj:fl [%f s=%.y e=-9 a=9.002])
2078+ [%f s=%.y e=--0 a=16]
2079+```
2080+
2081+---
2082+### `+ff`
2083+
2084+IEEE-754 Formatting
2085+
2086+Container core for IEEE-754 formatting operations.
2087+
2088+- `w` is width: The number of bits in the exponent field.
2089+- `p` is precision: The number of bits in the significand field.
2090+- `w` is bias: Added to exponent when storing.
2091+- `r` is rounding mode: Possible modes are nearest (`$n`), up (`$u`),
2092+ down (`$d`), to zero (`$z`), and away from zero (`$a`). Default value is `%a`.
2093+
2094+#### Source
2095+
2096+```
2097+ ++ ff
2098+ |_ [[w=@u p=@u b=@s] r=$?($n $u $d $z $a)]
2099+```
2100+
2101+#### Examples
2102+
2103+```
2104+ > =ffcore ~(. ff [8 8 0] %n)
2105+ > ffcore
2106+ <24.ltg {{{@ud @ud @ud} r/$n} <54.tyv 119.wim 31.ohr 1.jmk $143>}>
2107+ >
2108+```
2109+
2110+---
2111+#### Discussion
2112+
2113+`+ff` has no use outside of the functionality provided to other cores: `++rd`,
2114+`++rs`, `++rq`, and `++rh`. It's not intended to be used directly; it's just
2115+meant to power those cores.
2116+
2117+---
2118+### `++sb:ff`
2119+
2120+Sign bit
2121+
2122+Produces the sign bit of `++ff`.
2123+
2124+#### Source
2125+
2126+```
2127+ ++ sb (bex (^add w p))
2128+```
2129+
2130+#### Examples
2131+
2132+```
2133+ > sb:ff
2134+ 1
2135+```
2136+
2137+---
2138+### `++me:ff`
2139+
2140+Minimum exponent
2141+
2142+Produces the minimum possible exponent of `ff`.
2143+
2144+#### Source
2145+
2146+```
2147+ ++ me (dif:si (dif:si --1 b) (sun:si p))
2148+```
2149+
2150+#### Examples
2151+
2152+```
2153+ > me:ff
2154+ --1
2155+```
2156+
2157+---
2158+### `++pa:ff`
2159+
2160+Initialize `fl`
2161+
2162+Instantiates the core `fl`, giving values to its samples based on the
2163+configuration of the `ff` core.
2164+
2165+#### Source
2166+
2167+```
2168+ ++ pa
2169+ %*(. fl p +(p), v me, w (^sub (bex w) 3), d %d, r r)
2170+```
2171+
2172+#### Examples
2173+
2174+```
2175+ > ~(pa ff [11 52 --1.023] %n)
2176+ < 23.qzd
2177+ 28.btz
2178+ { {{p/@ v/@s w/@} r/?($n $u $a $d $z) d/$d}
2179+ <54.tyv 119.wim 31.ohr 1.jmk $143>
2180+ }
2181+ >
2182+```
2183+
2184+#### Discussion
2185+
2186+`++pa` exists exclusively for internal use of `++ff`, and `++ff` exists for
2187+internal use in other cores.
2188+
2189+---
2190+### `++sea`
2191+
2192+`@r` to `fn`
2193+
2194+Converts `a` from `@r` to `fn`.
2195+
2196+#### Accepts
2197+
2198+`a` is a `@r`, an IEEE float.
2199+
2200+#### Produces
2201+
2202+A `unit` of @s.
2203+
2204+#### Source
2205+
2206+```
2207+ ++ sea
2208+ |= [a=@r] ^- fn
2209+ =+ [f=(cut 0 [0 p] a) e=(cut 0 [p w] a)]
2210+ =+ s=(sig a)
2211+ ?: =(e 0)
2212+ ?: =(f 0) [%f s --0 0] [%f s me f]
2213+ ?: =(e (fil 0 w 1))
2214+ ?: =(f 0) [%i s] [%n ~]
2215+ =+ q=:(sum:si (sun:si e) me -1)
2216+ =+ r=(^add f (bex p))
2217+ [%f s q r]
2218+```
2219+
2220+#### Examples
2221+
2222+```
2223+ > (sea:ff `@r`0x8)
2224+ [%f s=%.y e=--0 a=0]
2225+```
2226+
2227+---
2228+### `++bit:ff`
2229+
2230+`fn` to `@r`, rounding
2231+
2232+Converts `a` from `fn` to `@r` and applies rounding.
2233+
2234+#### Accepts
2235+
2236+`a` is an `fn`.
2237+
2238+#### Produces
2239+
2240+A `@r`.
2241+
2242+#### Source
2243+
2244+```
2245+ ++ bit |= [a=fn] (bif (rou:pa a))
2246+```
2247+
2248+#### Examples
2249+
2250+```
2251+ > (bit:ma:rd [%f | -6 202])
2252+ 0xc009400000000000
2253+```
2254+
2255+---
2256+### `++bif:ff`
2257+
2258+`fn` to `@r`, no rounding
2259+
2260+Converts `a` from `fn` to `@r`. No rounding is applied.
2261+
2262+#### Accepts
2263+
2264+`a` is a `@r`, an IEEE float.
2265+
2266+#### Produces
2267+
2268+A `flag`.
2269+
2270+#### Source
2271+
2272+```
2273+ ++ bif
2274+ |= [a=fn] ^- @r
2275+ ?: ?=([$i *] a)
2276+ =+ q=(lsh 0 p (fil 0 w 1))
2277+ ?: s.a q (^add q sb)
2278+ ?: ?=([$n *] a) (lsh 0 (dec p) (fil 0 +(w) 1))
2279+ ?~ a.a ?: s.a `@r`0 sb
2280+ =+ ma=(met 0 a.a)
2281+ ?. =(ma +(p))
2282+ ?> =(e.a me)
2283+ ?> (^lth ma +(p))
2284+ ?: s.a `@r`a.a (^add a.a sb)
2285+ =+ q=(sum:si (dif:si e.a me) --1)
2286+ =+ r=(^add (lsh 0 p (abs:si q)) (end 0 p a.a))
2287+ ?: s.a r (^add r sb)
2288+```
2289+
2290+#### Examples
2291+
2292+```
2293+ > (bif:ma:rd *fn)
2294+ 0x7ff8000000000000
2295+```
2296+
2297+---
2298+### `++sig:ff`
2299+
2300+Get sign
2301+
2302+Produces the sign of `a`.
2303+
2304+#### Accepts
2305+
2306+`a` is a `@r`, an IEEE float.
2307+
2308+#### Produces
2309+
2310+A `flag`.
2311+
2312+#### Source
2313+
2314+```
2315+ ++ sig
2316+ |= [a=@r] ^- ?
2317+ =(0 (cut 0 [(^add p w) 1] a))
2318+```
2319+
2320+#### Examples
2321+
2322+```
2323+ > (sig:ff `@r`5)
2324+ %.n
2325+```
2326+
2327+---
2328+### `++exp`
2329+
2330+Get exponent
2331+
2332+Produces the exponent of `a`.
2333+
2334+#### Accepts
2335+
2336+`a` is a `@r`, an IEEE float.
2337+
2338+#### Produces
2339+
2340+A signed integer.
2341+
2342+#### Source
2343+
2344+```
2345+ ++ exp
2346+ |= [a=@r] ^- @s
2347+ (dif:si (sun:si (cut 0 [p w] a)) b)
2348+```
2349+
2350+#### Examples
2351+
2352+```
2353+ > (exp:ff `@r`5)
2354+ --0
2355+```
2356+
2357+---
2358+### `++add`
2359+
2360+Add
2361+
2362+Produces the sum of `a` plus `b`.
2363+
2364+#### Accepts
2365+
2366+`a` is a `@r`, an IEEE float.
2367+
2368+`b` is a `@r`, an IEEE float.
2369+
2370+#### Produces
2371+
2372+A `@r`, an IEEE float.
2373+
2374+#### Source
2375+
2376+```
2377+ ++ add
2378+ |= [a=@r b=@r]
2379+ (bif (add:pa (sea a) (sea b)))
2380+```
2381+
2382+#### Examples
2383+
2384+```
2385+ > (add:ma:rd `@r`5 `@r`11)
2386+ 0x10
2387+```
2388+
2389+---
2390+### `++sub:ff`
2391+
2392+Sub
2393+
2394+Produces the sum of `a` plus `b`.
2395+
2396+#### Accepts
2397+
2398+`a` is a `@r`, an IEEE float.
2399+
2400+`b` is a `@r`, an IEEE float.
2401+
2402+#### Produces
2403+
2404+A `@r`, an IEEE float.
2405+
2406+#### Source
2407+
2408+```
2409+ ++ sub
2410+ |= [a=@r b=@r]
2411+ (bif (sub:pa (sea a) (sea b)))
2412+```
2413+
2414+#### Examples
2415+
2416+```
2417+ > (sub:ma:rd `@r`5 `@r`11)
2418+ 0x8000000000000006
2419+```
2420+
2421+---
2422+### `mul:ff`
2423+
2424+Multiply
2425+
2426+Produces the product of `a` multiplied by `b`.
2427+
2428+#### Accepts
2429+
2430+`a` is a `@r`, an IEEE float.
2431+
2432+`b` is a `@r`, an IEEE float.
2433+
2434+#### Produces
2435+
2436+A `@r`, an IEEE float.
2437+
2438+#### Multiply
2439+
2440+```
2441+ ++ mul
2442+ |= [a=@r b=@r]
2443+ (bif (mul:pa (sea a) (sea b)))
2444+```
2445+
2446+#### Examples
2447+
2448+```
2449+ > (mul:ma:rd `@r`11 `@r`2)
2450+ 0x0
2451+```
2452+
2453+---
2454+### `++div:ff`
2455+
2456+Divide
2457+
2458+Produces the quotient of `a` divided by `b`.
2459+
2460+#### Accepts
2461+
2462+`a` is a `@r`, an IEEE float.
2463+
2464+`b` is a `@r`, an IEEE float.
2465+
2466+#### Produces
2467+
2468+A `@r`, an IEEE float.
2469+
2470+#### Source
2471+
2472+```
2473+ ++ div
2474+ |= [a=@r b=@r]
2475+ (bif (div:pa (sea a) (sea b)))
2476+```
2477+
2478+#### Examples
2479+
2480+```
2481+ > (div:ma:rd `@r`175 `@r`26)
2482+ 0x401aec4ec4ec4ec4
2483+```
2484+
2485+---
2486+### `++fma:ff`
2487+
2488+Fused multiply-add
2489+
2490+Produces the sum of `c` plus the product of `a` multiplied by `b`;
2491+`(a * b) + c`.
2492+
2493+#### Accepts
2494+
2495+`a` is a `@r`, an IEEE float.
2496+
2497+`b` is a `@r`, an IEEE float.
2498+
2499+`c` is a `@r`, an IEEE float.
2500+
2501+#### Produces
2502+
2503+A `@r`, an IEEE float.
2504+
2505+#### Source
2506+
2507+```
2508+ ++ fma
2509+ |= [a=@r b=@r c=@r]
2510+ (bif (fma:pa (sea a) (sea b) (sea c)))
2511+```
2512+
2513+#### Examples
2514+
2515+```
2516+ > (fma:ma:rd `@r`175 `@r`26 `@r`100)
2517+ 0x64
2518+```
2519+
2520+---
2521+### `++sqt:ff`
2522+
2523+Square root
2524+
2525+Produces the square root of `a`.
2526+
2527+#### Accepts
2528+
2529+`a` is a `@r`, an IEEE float.
2530+
2531+#### Produces
2532+
2533+A `@r`, an IEEE float.
2534+
2535+#### Source
2536+
2537+```
2538+ ++ sqt
2539+ |= [a=@r]
2540+ (bif (sqt:pa (sea a)))
2541+```
2542+
2543+#### Examples
2544+
2545+```
2546+ > (sqt:ma:rd `@r`175)
2547+ 0x1e9a751f9447b724
2548+```
2549+
2550+---
2551+### `++lth:ff`
2552+
2553+Less than
2554+
2555+Tests whether `a` is less than `b`.
2556+
2557+#### Accepts
2558+
2559+`a` is a `@r`, an IEEE float.
2560+
2561+`b` is a `@r`, an IEEE float.
2562+
2563+#### Produces
2564+
2565+A `flag`.
2566+
2567+#### Source
2568+
2569+```
2570+ ++ lth
2571+ |= [a=@r b=@r] (fall (lth:pa (sea a) (sea b)) |)
2572+```
2573+
2574+#### Examples
2575+
2576+```
2577+ > (lth:ma:rd `@rd`1 `@rd`2)
2578+ %.y
2579+
2580+ > (lth:ma:rd `@rd`10 `@rd`2)
2581+ %.n
2582+```
2583+
2584+---
2585+### `++lte:ff`
2586+
2587+Less than or equal to
2588+
2589+Tests whether `a` is less than or equal to `b`.
2590+
2591+#### Accepts
2592+
2593+`a` is a `@r`, an IEEE float.
2594+
2595+`b` is a `@r`, an IEEE float.
2596+
2597+#### Produces
2598+
2599+A `flag`.
2600+
2601+#### Source
2602+
2603+```
2604+ ++ lte
2605+ |= [a=@r b=@r] (fall (lte:pa (sea a) (sea b)) |)
2606+```
2607+
2608+#### Examples
2609+
2610+```
2611+ > (lte:ma:rd `@rd`10 `@rd`2)
2612+ %.n
2613+
2614+ > (lte:ma:rd `@rd`10 `@rd`10)
2615+ %.y
2616+```
2617+
2618+---
2619+### `equ:ff`
2620+
2621+Equals
2622+
2623+Tests whether `a` is equal to `b`.
2624+
2625+#### Accepts
2626+
2627+`a` is a `@r`, an IEEE float.
2628+
2629+`b` is a `@r`, an IEEE float.
2630+
2631+#### Produces
2632+
2633+A `flag`.
2634+
2635+#### Source
2636+
2637+```
2638+ ++ equ
2639+ |= [a=@r b=@r] (fall (equ:pa (sea a) (sea b)) |)
2640+```
2641+
2642+#### Examples
2643+
2644+```
2645+ > (equ:ma:rd `@rd`10 `@rd`2)
2646+ %.n
2647+
2648+ > (equ:ma:rd `@rd`10 `@rd`10)
2649+ %.y
2650+```
2651+
2652+---
2653+### `++gte:ff`
2654+
2655+Greater or equal than
2656+
2657+Tests whether `a` is greater than or equal to `b`.
2658+
2659+#### Accepts
2660+
2661+`a` is a `@r`, an IEEE float.
2662+
2663+`b` is a `@r`, an IEEE float.
2664+
2665+#### Produces
2666+
2667+A `flag`.
2668+
2669+#### Source
2670+
2671+```
2672+ ++ gte
2673+ |= [a=@r b=@r] (fall (gte:pa (sea a) (sea b)) |)
2674+```
2675+
2676+#### Examples
2677+
2678+```
2679+ > (gte:ma:rd `@rd`10 `@rd`10)
2680+ %.y
2681+
2682+ > (gte:ma:rd `@rd`10 `@rd`11)
2683+ %.n
2684+```
2685+
2686+---
2687+### `++gth:ff`
2688+
2689+Greater than
2690+
2691+Tests whether `a` is greater than or equal to `b`.
2692+
2693+#### Accepts
2694+
2695+`a` is a `@r`, an IEEE float.
2696+
2697+`b` is a `@r`, an IEEE float.
2698+
2699+#### Produces
2700+
2701+A `flag`.
2702+
2703+#### Source
2704+
2705+```
2706+ ++ gth
2707+ |= [a=@r b=@r] (fall (gth:pa (sea a) (sea b)) |)
2708+```
2709+
2710+#### Examples
2711+
2712+```
2713+ > (gth:ma:rd `@rd`10 `@rd`10)
2714+ %.n
2715+
2716+ > (gth:ma:rd `@rd`10 `@rd`9)
2717+ %.y
2718+```
2719+
2720+---
2721+### `++sun:ff`
2722+
2723+Unsigned integer to `@r`
2724+
2725+Converts `a` from an unsigned integer (`@u`) to `@r`.
2726+
2727+#### Accepts
2728+
2729+`a` is `@u`, unsigned integer.
2730+
2731+#### Produces
2732+
2733+A `@r`, an IEEE float.
2734+
2735+#### Source
2736+
2737+```
2738+ ++ sun
2739+ |= [a=@u] (bit [%f & --0 a])
2740+```
2741+
2742+#### Examples
2743+
2744+```
2745+ > (sun:ma:rd 658.149.282)
2746+ 0x41c39d47d1000000
2747+```
2748+
2749+---
2750+### `++san:ff`
2751+
2752+Signed integer to `@r`
2753+
2754+Converts `a` from a signed integer to `@r`.
2755+
2756+#### Accepts
2757+
2758+`a` is `@s`, an unsigned integer
2759+
2760+#### Produces
2761+
2762+A `@r`, an IEEE float.
2763+
2764+#### Source
2765+
2766+```
2767+ ++ san
2768+ |= [a=@s] (bit [%f (syn:si a) --0 (abs:si a)])
2769+```
2770+
2771+#### Examples
2772+
2773+```
2774+ > (san:ma:rd --10)
2775+ 0x4024000000000000
2776+```
2777+
2778+---
2779+### `++toi:ff`
2780+
2781+Round to integer
2782+
2783+Rounds `a` to the nearest signed integer.
2784+
2785+#### Accepts
2786+
2787+`a` is a `@r`, an IEEE float.
2788+
2789+#### Produces
2790+
2791+A `flag` of `@s`.
2792+
2793+#### Source
2794+
2795+```
2796+ ++ toi
2797+ |= [a=@r] (toi:pa (sea a))
2798+```
2799+
2800+#### Examples
2801+
2802+```
2803+ > (toi:ma:rd `@r`0x4af)
2804+ [~ u=--0]
2805+```
2806+
2807+---
2808+### `++drg:ff`
2809+
2810+`@r` to decimal float
2811+
2812+Converts `a` from `@r` to `dn` using the Dragon4 algorithm.
2813+
2814+#### Accepts
2815+
2816+`a` is a `@r`, an IEEE float.
2817+
2818+#### Produces
2819+
2820+A `dn`.
2821+
2822+#### Source
2823+
2824+```
2825+ ++ drg
2826+ |= [a=@r] (drg:pa (sea a))
2827+```
2828+
2829+#### Examples
2830+
2831+```
2832+ > (drg:ma:rd `@r`0x41c0)
2833+ [%d s=%.y e=-323 a=8.316]
2834+
2835+ > (drg:ma:rd (sun:ma:rd 658.149.282))
2836+ [%d s=%.y e=--0 a=658.149.282]
2837+```
2838+
2839+---
2840+### `++grd:ff`
2841+
2842+Decimal float to `@r`
2843+
2844+Converts `a` from `dn` to `@r`.
2845+
2846+#### Accepts
2847+
2848+`a` is a `dn`.
2849+
2850+#### Produces
2851+
2852+A `@r`, an IEEE float.
2853+
2854+#### Source
2855+
2856+```
2857+ ++ grd
2858+ |= [a=dn] (bif (grd:pa a))
2859+ --
2860+```
2861+
2862+#### Examples
2863+
2864+```
2865+ > (grd:ma:rd [%d s=%.y e=--0 a=658.149.282])
2866+ 0x41c39d47d1000000
2867+```
2868+
2869+---
2870+### `rlyd`
2871+
2872+Prep `@rd` for print
2873+
2874+Converts `a` from a double-precision binary float to decimal64.
2875+
2876+#### Accepts
2877+
2878+`a` is a `@rd`, a double-precision float.
2879+
2880+#### Produces
2881+
2882+A `dn`.
2883+
2884+#### Source
2885+
2886+```
2887+ ++ rlyd |= a=@rd ^- dn (drg:rd a)
2888+```
2889+
2890+#### Examples
2891+
2892+```
2893+ > (rlyd .~2.4703e-320)
2894+ [%d s=%.y e=-324 a=24.703]
2895+```
2896+
2897+---
2898+### `++rlys`
2899+
2900+Prep @rs for print
2901+
2902+Converts `a` from a single-precision binary float to decimal32.
2903+
2904+#### Accepts
2905+
2906+`a` is a `@rs`, a single-precision float.
2907+
2908+#### Produces
2909+
2910+A `dn`.
2911+
2912+#### Source
2913+
2914+```
2915+ ++ rlys |= a=@rs ^- dn (drg:rs a)
2916+```
2917+
2918+#### Examples
2919+
2920+```
2921+ > (rlys .1.681557e-39)
2922+ [%d s=%.y e=-45 a=1.681.557]
2923+```
2924+
2925+---
2926+### `++rlyh`
2927+
2928+Prep `@rh` for print
2929+
2930+Converts `a` from a half-precision binary float to decimal16.
2931+
2932+#### Accepts
2933+
2934+`a` is a `@rh`, a half-precision float.
2935+
2936+#### Produces
2937+
2938+A `dn`.
2939+
2940+#### Source
2941+
2942+```
2943+ ++ rlyh |= a=@rh ^- dn (drg:rh a)
2944+```
2945+
2946+#### Examples
2947+
2948+```
2949+ > (rlyh .~~3e1)
2950+ [%d s=%.y e=--1 a=3]
2951+```
2952+
2953+---
2954+### `++rlyq`
2955+
2956+Prep `@rq` for print
2957+
2958+Converts `a` from a quad-precision binary float to decimal128.
2959+
2960+#### Accepts
2961+
2962+`a` is a `@rq`, a quad-precision float.
2963+
2964+#### Produces
2965+
2966+A `dn`.
2967+
2968+#### Source
2969+
2970+```
2971+ ++ rlyq |= a=@rq ^- dn (drg:rq a)
2972+```
2973+
2974+#### Examples
2975+
2976+```
2977+ > (rlyq .~~~2.2628017865927756787440310766086816e-4343)
2978+ [%d s=%.y e=-4.377 a=22.628.017.865.927.756.787.440.310.766.086.816]
2979+```
2980+
2981+---
2982+### `++ryld`
2983+
2984+Finish parsing `@rd`
2985+
2986+Converts `a` from a decimal float to a double-precision binary float.
2987+
2988+#### Accepts
2989+
2990+`a` is a `dn`.
2991+
2992+#### Produces
2993+
2994+A a `@rd`, a double-precision float.
2995+
2996+#### Source
2997+
2998+```
2999+ ++ ryld |= a=dn ^- @rd (grd:rd a)
3000+```
3001+
3002+#### Examples
3003+
3004+```
3005+ > (ryld [%d s=%.y e=-324 a=24.703])
3006+ .~2.4703e-320
3007+```
3008+
3009+---
3010+### `++ryls`
3011+
3012+Finish parsing `@rs`
3013+
3014+Converts `a` from a decimal float to a single-precision binary float.
3015+
3016+#### Accepts
3017+
3018+`a` is a `dn`.
3019+
3020+#### Produces
3021+
3022+A a `@rs`, a single-precision float.
3023+
3024+#### Source
3025+
3026+```
3027+ ++ ryls |= a=dn ^- @rs (grd:rs a)
3028+```
3029+
3030+#### Examples
3031+
3032+```
3033+ > (ryls [%d s=%.y e=-324 a=24.703])
3034+ .0
3035+
3036+ > (ryls [%d s=%.y e=-32 a=24.703])
3037+ .2.4703e-28
3038+```
3039+
3040+---
3041+### `++rylh`
3042+
3043+Finish parsing `@rh`
3044+
3045+Converts `a` from a decimal float to a half-precision binary float.
3046+
3047+#### Accepts
3048+
3049+`a` is a `dn`.
3050+
3051+#### Produces
3052+
3053+A a `@rh`, a half-precision float.
3054+
3055+#### Source
3056+
3057+```
3058+ ++ rylh |= a=dn ^- @rh (grd:rh a)
3059+```
3060+
3061+#### Examples
3062+
3063+```
3064+ > (rylh [%d s=%.y e=--1 a=703])
3065+ .~~7.032e3
3066+
3067+ > (rylh [%d s=%.y e=--3 a=56])
3068+ .~~5.6e4
3069+
3070+ > (rylh [%d s=%.y e=--4 a=56])
3071+ .~~inf
3072+```
3073+
3074+---
3075+### `++rylq`
3076+
3077+Finish parsing `@rq`
3078+
3079+Converts `a` from a decimal float to a quad-precision binary float.
3080+
3081+#### Accepts
3082+
3083+`a` is a `dn`.
3084+
3085+#### Produces
3086+
3087+A a `@rq`, a quad-precision float.
3088+
3089+#### Source
3090+
3091+```
3092+ ++ rylq |= a=dn ^- @rq (grd:rq a)
3093+```
3094+
3095+#### Examples
3096+
3097+```
3098+ > (rylq [%d s=%.y e=-324 a=24.703])
3099+ .~~~2.4703e-320
3100+```
3101+
3102+---
3103+### `++rd`
3104+
3105+Double-precision fp
3106+
3107+A container core for operations related to double-precision binary floats.
3108+
3109+`++rd` has four rounding modes: round to nearest (`$n`), round up (`$u`), round
3110+down (`$d`), and round to zero (`$z`).
3111+
3112+#### Source
3113+
3114+```
3115+ ++ rd
3116+ ^?
3117+ ~% %rd +> ~
3118+ |_ r=$?($n $u $d $z)
3119+```
3120+
3121+---
3122+### `++ma:rd`
3123+
3124+Initialize `ff`
3125+
3126+Instantiates the core `ff`, giving values to its samples based on the
3127+configuration of the `rd` core.
3128+
3129+#### Source
3130+
3131+```
3132+ ++ ma
3133+ %*(. ff w 11, p 52, b --1.023, r r)
3134+```
3135+
3136+#### Examples
3137+
3138+```
3139+ > ~(ma rd %n)
3140+ < 24.ltg
3141+ {{{w/@ud p/@ud b/@sd} r/?($n $u $d $z)} <54.tyv 119.wim 31.ohr 1.jmk $143>}
3142+ >
3143+```
3144+
3145+---
3146+### `sea:rd`
3147+
3148+`@rd` to `fn`
3149+
3150+Converts `a` from a double-precision binary float to `fn`.
3151+
3152+```
3153+ ++ sea :: @rd to fn
3154+ |= [a=@rd] (sea:ma a)
3155+```
3156+
3157+#### Examples
3158+
3159+```
3160+ > (sea:rd .~4.94066e-319)
3161+ [%f s=%.y e=-1.074 a=100.000]
3162+```
3163+
3164+---
3165+### `bit:rd`
3166+
3167+`fn` to `@rd`
3168+
3169+Converts `a` from `fn` to a double-precision binary float.
3170+
3171+#### Accepts
3172+
3173+`a` is an `fn`.
3174+
3175+#### Produces
3176+
3177+A `@rd`, a double-precision float.
3178+
3179+#### Source
3180+
3181+```
3182+ ++ bit
3183+ |= [a=fn] ^- @rd (bit:ma a)
3184+```
3185+
3186+#### Examples
3187+
3188+```
3189+ > (bit:rd [%f s=%.y e=-1.074 a=100.000])
3190+ .~4.94066e-319
3191+```
3192+
3193+---
3194+### `add:rd`
3195+
3196+Add
3197+
3198+Produces the sum of `a` plus `b`.
3199+
3200+#### Accepts
3201+
3202+`a` is a `@rd`, a double-precision float.
3203+
3204+`b` is a `@rd`, a double-precision float.
3205+
3206+#### Produces
3207+
3208+A `@rd`.
3209+
3210+#### Source
3211+
3212+```
3213+ ++ add ~/ %add
3214+ |= [a=@rd b=@rd] ^- @rd
3215+ ~_ leaf+"rd-fail"
3216+ (add:ma a b)
3217+```
3218+
3219+#### Examples
3220+
3221+```
3222+ > (add:rd .~3.94066e12 .~9.2846e11)
3223+ .~4.86912e12
3224+```
3225+
3226+---
3227+### `sub:rd`
3228+
3229+Subtract
3230+
3231+Produces the difference of `a` minus `b`.
3232+
3233+#### Accepts
3234+
3235+`a` is a `@rd`, a double-precision float.
3236+
3237+`b` is a `@rd`, a double-precision float.
3238+
3239+#### Produces
3240+
3241+A `@rd`.
3242+
3243+#### Source
3244+
3245+```
3246+ ++ sub ~/ %sub
3247+ |= [a=@rd b=@rd] ^- @rd
3248+ ~_ leaf+"rd-fail"
3249+ (sub:ma a b)
3250+```
3251+
3252+#### Examples
3253+
3254+```
3255+ > (sub:rd .~7.94069e2 .~1.2846e3)
3256+ .~-4.9053099999999995e2
3257+```
3258+
3259+---
3260+### `sub:rd`
3261+
3262+Multiply
3263+
3264+Produces the product of `a` times `b`.
3265+
3266+#### Accepts
3267+
3268+`a` is a `@rd`, a double-precision float.
3269+
3270+`b` is a `@rd`, a double-precision float.
3271+
3272+#### Produces
3273+
3274+A `@rd`.
3275+
3276+#### Source
3277+
3278+```
3279+ ++ mul ~/ %mul
3280+ |= [a=@rd b=@rd] ^- @rd
3281+ ~_ leaf+"rd-fail"
3282+ (mul:ma a b)
3283+```
3284+
3285+#### Examples
3286+
3287+```
3288+ > (mul:rd .~7.94069e2 .~1.2246e3)
3289+ .~9.724168973999998e5
3290+```
3291+
3292+---
3293+### `div:rd`
3294+
3295+Divide
3296+
3297+Produces the quotient of `a` divided by `b`.
3298+
3299+#### Accepts
3300+
3301+`a` is a `@rd`, a double-precision float.
3302+
3303+`b` is a `@rd`.
3304+
3305+#### Produces
3306+
3307+A `@rd`.
3308+
3309+#### Source
3310+
3311+```
3312+ ++ div ~/ %div
3313+ |= [a=@rd b=@rd] ^- @rd
3314+ ~_ leaf+"rd-fail"
3315+ (div:ma a b)
3316+```
3317+
3318+#### Examples
3319+
3320+```
3321+ > (div:rd .~7.94099e2 .~1.2246e3)
3322+ .~6.484558223093255e-1
3323+```
3324+
3325+---
3326+### `++fma:rd`
3327+
3328+Fused multiply-add
3329+
3330+Produces the sum of `c` plus the product of `a` multiplied by `b`;
3331+`(a * b) + c`.
3332+
3333+#### Accepts
3334+
3335+`a` is a `@rd`, an IEEE float.
3336+
3337+`b` is a `@rd`.
3338+
3339+`c` is a `@rd`.
3340+
3341+#### Produces
3342+
3343+A `@rd`.
3344+
3345+#### Source
3346+
3347+
3348+#### Source
3349+
3350+```
3351+ ++ fma ~/ %fma
3352+ |= [a=@rd b=@rd c=@rd] ^- @rd
3353+ ~_ leaf+"rd-fail"
3354+ (fma:ma a b c)
3355+```
3356+
3357+#### Examples
3358+
3359+```
3360+ > (fma:rd .~7.94099e2 .~1.2246e3 .~3.94066e3)
3361+ .~9.763942954e5
3362+```
3363+
3364+---
3365+### `+sqt:fr`
3366+
3367+Square root
3368+
3369+Produces the square root of `a`.
3370+
3371+#### Accepts
3372+
3373+`a` is a `@rd`, a double-precision float.
3374+
3375+#### Produces
3376+
3377+A `@rd`.
3378+
3379+#### Source
3380+
3381+```
3382+ ++ sqt ~/ %sqt
3383+ |= [a=@rd] ^- @rd ~_ leaf+"rd-fail"
3384+ (sqt:ma a)
3385+```
3386+
3387+#### Examples
3388+
3389+```
3390+ > (sqt:rd .~3.94066e3)
3391+ .~6.2774676422901614e1
3392+```
3393+
3394+---
3395+### `lth:rd`
3396+
3397+Less than
3398+
3399+Test whether `a` is less than `b`.
3400+
3401+#### Accepts
3402+
3403+`a` is a `@rd`, a double-precision float.
3404+
3405+`b` is a `@rd`, a double-precision float.
3406+
3407+#### Produces
3408+
3409+A `@rd`.
3410+
3411+#### Source
3412+
3413+```
3414+ ++ lth ~/ %lth
3415+ |= [a=@rd b=@rd]
3416+ ~_ leaf+"rd-fail"
3417+ (lth:ma a b)
3418+```
3419+
3420+#### Examples
3421+
3422+```
3423+ > (lth:rd .~7.94099e2 .~1.2246e3)
3424+ %.y
3425+
3426+ > (lth:rd .~7.94099e2 .~1.2246e2)
3427+ %.n
3428+
3429+ > (lth:rd .~1.2246e2 .~1.2246e2)
3430+ %.n
3431+```
3432+
3433+---
3434+### `++lte:rd`
3435+
3436+Less than or equal
3437+
3438+Test whether `a` is less than or equal to `b`.
3439+
3440+#### Accepts
3441+
3442+`a` is a `@rd`, a double-precision float.
3443+
3444+`b` is a `@rd`, a double-precision float.
3445+
3446+#### Produces
3447+
3448+A `@rd`.
3449+
3450+#### Source
3451+
3452+```
3453+ ++ lte ~/ %lte :: less-equals
3454+ |= [a=@rd b=@rd]
3455+ ~_ leaf+"rd-fail"
3456+ (lte:ma a b)
3457+```
3458+
3459+#### Examples
3460+
3461+```
3462+ > (lte:rd .~7.94099e2 .~1.2246e3)
3463+ %.y
3464+
3465+ > (lte:rd .~7.94099e2 .~1.2246e2)
3466+ %.n
3467+
3468+ > (lte:rd .~1.2246e2 .~1.2246e2)
3469+ %.y
3470+```
3471+
3472+---
3473+### `equ:rd`
3474+
3475+Equals
3476+
3477+Test whether `a` is equal to `b`.
3478+
3479+#### Accepts
3480+
3481+`a` is a `@rd`, a double-precision float.
3482+
3483+`b` is a `@rd`, a double-precision float.
3484+
3485+#### Produces
3486+
3487+A `@rd`.
3488+
3489+#### Source
3490+
3491+```
3492+ ++ equ ~/ %equ
3493+ |= [a=@rd b=@rd]
3494+ ~_ leaf+"rd-fail"
3495+ (equ:ma a b)
3496+```
3497+
3498+#### Examples
3499+
3500+```
3501+ > (equ:rd .~7.94099e2 .~1.2246e3)
3502+ %.n
3503+
3504+ > (equ:rd .~7.94099e2 .~1.2246e2)
3505+ %.n
3506+
3507+ > (equ:rd .~1.2246e2 .~1.2246e2)
3508+ %.y
3509+```
3510+
3511+---
3512+### `++gte:rd`
3513+
3514+Greater than or equal
3515+
3516+Test whether `a` is greater than or equal to `b`.
3517+
3518+#### Accepts
3519+
3520+`a` is a `@rd`, a double-precision float.
3521+
3522+`b` is a `@rd`, a double-precision float.
3523+
3524+#### Produces
3525+
3526+A `@rd`.
3527+
3528+#### Source
3529+
3530+```
3531+ ++ gte ~/ %gte
3532+ |= [a=@rd b=@rd]
3533+ ~_ leaf+"rd-fail"
3534+ (gte:ma a b)
3535+```
3536+
3537+#### Examples
3538+
3539+```
3540+ > (gte:rd .~7.94099e2 .~1.2246e3)
3541+ %.n
3542+
3543+ > (gte:rd .~7.94099e2 .~1.2246e2)
3544+ %.y
3545+
3546+ > (gte:rd .~1.2246e2 .~1.2246e2)
3547+ %.y
3548+```
3549+
3550+---
3551+### `++gth:rd`
3552+
3553+Greater than
3554+
3555+Test whether `a` is greater `b`.
3556+
3557+#### Accepts
3558+
3559+`a` is a `@rd`, a double-precision float.
3560+
3561+`b` is a `@rd`, a double-precision float.
3562+
3563+#### Produces
3564+
3565+A `@rd`.
3566+
3567+#### Source
3568+
3569+```
3570+ ++ gth ~/ %gth
3571+ |= [a=@rd b=@rd]
3572+ ~_ leaf+"rd-fail"
3573+ (gth:ma a b)
3574+```
3575+
3576+#### Examples
3577+
3578+```
3579+ > (gte:rd .~7.94099e2 .~1.2246e3)
3580+ %.n
3581+
3582+ > (gte:rd .~7.94099e2 .~1.2246e2)
3583+ %.y
3584+
3585+ > (gte:rd .~1.2246e2 .~1.2246e2)
3586+ %.y
3587+```
3588+
3589+---
3590+### `++sun:rd`
3591+
3592+Unsigned integer to `@rd`
3593+
3594+Converts an unsigned integer `a` to `@rd`.
3595+
3596+#### Accepts
3597+
3598+`a` is a `@u`, an unsigned integer.
3599+
3600+#### Produces
3601+
3602+A `@rd`.
3603+
3604+#### Source
3605+
3606+```
3607+ ++ sun |= [a=@u] ^- @rd (sun:ma a)
3608+```
3609+
3610+#### Examples
3611+
3612+```
3613+ > (sun:rd 511)
3614+ .~5.11e2
3615+```
3616+
3617+---
3618+### `++san:rd`
3619+
3620+Unsigned integer to `@rd`
3621+
3622+Converts a signed integer `a` to `@rd`.
3623+
3624+#### Accepts
3625+
3626+`a` is a `@s`, a signed integer.
3627+
3628+#### Produces
3629+
3630+A `@rd`.
3631+
3632+#### Source
3633+
3634+```
3635+ ++ san |= [a=@s] ^- @rd (san:ma a)
3636+```
3637+
3638+#### Examples
3639+
3640+```
3641+ > (san:rd -511)
3642+ .~-5.11e2
3643+```
3644+
3645+---
3646+### `++sig:rd`
3647+
3648+Get sign
3649+
3650+Produces the sign of `a`.
3651+
3652+#### Accepts
3653+
3654+`a` is a `@rd`
3655+
3656+#### Produces
3657+
3658+A `flag`.
3659+
3660+#### Source
3661+
3662+```
3663+ ++ sig |= [a=@rd] ^- ? (sig:ma a)
3664+```
3665+
3666+#### Examples
3667+
3668+```
3669+ > (sig:rd .~1.2246e3)
3670+ %.y
3671+```
3672+
3673+---
3674+### `exp:rd`
3675+
3676+Get exponent
3677+
3678+Produces the exponent of `a`.
3679+
3680+#### Accepts
3681+
3682+`a` is a `@rd`
3683+
3684+#### Produces
3685+
3686+A `@s`.
3687+
3688+#### Source
3689+
3690+```
3691+ ++ exp |= [a=@rd] ^- @s (exp:ma a) :: get exponent
3692+```
3693+
3694+#### Examples
3695+
3696+```
3697+ > (exp:rd .~1.2246e3)
3698+ --10
3699+```
3700+
3701+---
3702+### `++toi:rd`
3703+
3704+Round to integer
3705+
3706+Rounds `a` to the nearest integer.
3707+
3708+#### Accepts
3709+
3710+`a` is a `@rd`
3711+
3712+#### Produces
3713+
3714+A `unit` of `@s`.
3715+
3716+#### Source
3717+
3718+```
3719+ ++ toi |= [a=@rd] ^- (unit @s) (toi:ma a)
3720+```
3721+
3722+#### Examples
3723+
3724+```
3725+ > (toi:rd .~1.2246e3)
3726+ [~ u=--1.224]
3727+```
3728+
3729+---
3730+### `++drg:rd`
3731+
3732+`@rd` to decimal float
3733+
3734+Produces the decimal form of `a` using the Dragon4 algorithm. Guarantees
3735+accurate results for rounded floats.
3736+
3737+#### Accepts
3738+
3739+`a` is a `@rd`
3740+
3741+#### Produces
3742+
3743+A `dn`.
3744+
3745+#### Source
3746+
3747+```
3748+ ++ drg |= [a=@rd] ^- dn (drg:ma a)
3749+```
3750+
3751+#### Examples
3752+
3753+```
3754+ > (drg:rd .~1.2246e3)
3755+ [%d s=%.y e=-1 a=12.246]
3756+```
3757+
3758+---
3759+### `++grd:rd`
3760+
3761+Decimal float to `@rd`
3762+
3763+Converts `a` from decimal float to `@rd`.
3764+
3765+#### Accepts
3766+
3767+`a` is a `@dn`
3768+
3769+#### Produces
3770+
3771+A `@rd`.
3772+
3773+#### Source
3774+
3775+```
3776+ ++ grd |= [a=dn] ^- @rd (grd:ma a) :: decimal float to @rd
3777+ --
3778+```
3779+
3780+#### Examples
3781+
3782+```
3783+ > (grd:rd [%d s=%.y e=-1 a=12.246])
3784+ .~1.2246e3
3785+```
3786+
3787+---
3788+### `++rs`
3789+
3790+Single-precision fp
3791+
3792+A container core for operations related to single-precision binary floats.
3793+
3794+`++rs` has four rounding modes: round to nearest (`$n`), round up (`$u`), round
3795+down (`$d`), and round to zero (`$z`).
3796+
3797+#### Source
3798+
3799+```
3800+ ++ rs
3801+ ~% %rs +> ~
3802+ ^?
3803+ |_ r=$?($n $u $d $z)
3804+```
3805+
3806+---
3807+### `ma:rs`
3808+
3809+Initialize `ff`
3810+
3811+Instantiates the core `ff`, giving values to its samples based on the
3812+configuration of the `rs` core.
3813+
3814+#### Source
3815+
3816+```
3817+ ++ ma
3818+ %*(. ff w 8, p 23, b --127, r r)
3819+```
3820+
3821+#### Examples
3822+
3823+```
3824+ > ~(ma rs %n)
3825+ < 24.ltg
3826+ {{{w/@ud p/@ud b/@sd} r/?($n $u $d $z)} <54.tyv 119.wim 31.ohr 1.jmk $143>}
3827+ >
3828+```
3829+
3830+---
3831+### `sea:rs`
3832+
3833+`@rs` to `fn`
3834+
3835+Converts `a` from `@rs` to `fn`.
3836+
3837+#### Accepts
3838+
3839+`a` is a `@rs`, an single-precision float.
3840+
3841+#### Produces
3842+
3843+An `fn`.
3844+
3845+#### Source
3846+
3847+```
3848+ ++ sea
3849+ |= [a=@rs] (sea:ma a)
3850+```
3851+
3852+#### Examples
3853+
3854+```
3855+ > (sea:rs .1.4e-43)
3856+ [%f s=%.y e=-149 a=100]
3857+```
3858+
3859+---
3860+### `bit:rs`
3861+
3862+`fn` to `@rs`
3863+
3864+Converts `a` from `fn` to `@rs`.
3865+
3866+#### Accepts
3867+
3868+`a` is an `fn`.
3869+
3870+#### Produces
3871+
3872+A `@rs`, a single-precision float.
3873+
3874+#### Source
3875+
3876+```
3877+ ++ bit
3878+ |= [a=fn] ^- @rs (bit:ma a)
3879+```
3880+
3881+#### Examples
3882+
3883+```
3884+ > (bit:rs [%f & -2 1.000])
3885+ .2.5e2
3886+```
3887+
3888+---
3889+### `++add:rs`
3890+
3891+Add
3892+
3893+Produces the sum of `a` plus `b`.
3894+
3895+#### Accepts
3896+
3897+`a` is a `@rs`, a single-precision float.
3898+
3899+`b` is a `@rs`.
3900+
3901+#### Produces
3902+
3903+A `@rs`.
3904+
3905+#### Source
3906+
3907+```
3908+ ++ add ~/ %add
3909+ |= [a=@rs b=@rs] ^- @rs
3910+ ~_ leaf+"rs-fail"
3911+ (add:ma a b)
3912+```
3913+
3914+#### Examples
3915+
3916+```
3917+ > (add:rs .2.5e1 .2.5e2)
3918+ .2.75e2
3919+```
3920+
3921+---
3922+### `++sub:rs`
3923+
3924+Subtract
3925+
3926+Subtracts `a` from `b`.
3927+
3928+#### Source
3929+
3930+```
3931+ ++ sub ~/ %sub
3932+ |= [a=@rs b=@rs] ^- @rs
3933+ ~_ leaf+"rs-fail"
3934+ (sub:ma a b)
3935+```
3936+
3937+#### Examples
3938+
3939+```
3940+ > (sub:rs .2.5e1 .2.5e2)
3941+ .-2.25e2
3942+```
3943+
3944+---
3945+### `++mul:rs`
3946+
3947+Multiply
3948+
3949+Produces the product of `a` multiplied by `b`.
3950+
3951+#### Accepts
3952+
3953+`a` is a `@rs`, a single-precision float.
3954+
3955+`b` is a `@rs`.
3956+
3957+#### Produces
3958+
3959+A `@rs`.
3960+
3961+#### Source
3962+
3963+```
3964+ ++ mul ~/ %mul
3965+ |= [a=@rs b=@rs] ^- @rs
3966+ ~_ leaf+"rs-fail"
3967+ (mul:ma a b)
3968+```
3969+
3970+#### Examples
3971+
3972+```
3973+ > (mul:rs .2.5e1 .2.5e2)
3974+ .6.25e3
3975+```
3976+
3977+---
3978+### `++div:rs`
3979+
3980+Divide
3981+
3982+Produces the quotient of `a` divided by `b`.
3983+
3984+#### Accepts
3985+
3986+`a` is a `@rs`, a single-precision float.
3987+
3988+`b` is a `@rs`.
3989+
3990+#### Produces
3991+
3992+A `@rs`.
3993+
3994+#### Source
3995+
3996+```
3997+ ++ div ~/ %div
3998+ |= [a=@rs b=@rs] ^- @rs
3999+ ~_ leaf+"rs-fail"
4000+ (div:ma a b)
4001+```
4002+
4003+#### Examples
4004+
4005+```
4006+ > (div:rs .4.5e1 .2.2e2)
4007+ .2.0454545e-1
4008+```
4009+
4010+---
4011+### `++fma:rs`
4012+
4013+Fused multiply-add
4014+
4015+Produces the sum of `c` plus the product of `a` multiplied by `b`;
4016+`(a * b) + c`.
4017+
4018+#### Accepts
4019+
4020+`a` is a `@rs`, a single-precision float.
4021+
4022+`b` is a `@rs`.
4023+
4024+`c` is a `@rs`.
4025+
4026+#### Produces
4027+
4028+A `@rs`.
4029+
4030+#### Source
4031+
4032+```
4033+ ++ fma ~/ %fma
4034+ |= [a=@rs b=@rs c=@rs] ^- @rs
4035+ ~_ leaf+"rs-fail"
4036+ (fma:ma a b c)
4037+```
4038+
4039+#### Examples
4040+
4041+```
4042+ > (fma:rs .2.5e1 .2.5e2 .8.2e1)
4043+ .6.332e3
4044+```
4045+
4046+---
4047+### `++sqt:rs`
4048+
4049+Square root
4050+
4051+Produces the square root of `a`.
4052+
4053+#### Accepts
4054+
4055+`a` is a `@rs`, a single-precision float.
4056+
4057+#### Produces
4058+
4059+A `@rs`.
4060+
4061+#### Source
4062+
4063+```
4064+ ++ sqt ~/ %sqt
4065+ |= [a=@rs] ^- @rs
4066+ ~_ leaf+"rs-fail"
4067+ (sqt:ma a)
4068+```
4069+
4070+#### Examples
4071+
4072+```
4073+ > (sqt:rs .2.5e2)
4074+ .1.5811388e1
4075+```
4076+
4077+---
4078+### `lth:rs`
4079+
4080+Less than
4081+
4082+Test whether `a` is less than `b`.
4083+
4084+#### Accepts
4085+
4086+`a` is a `@rs`, a single-precision float.
4087+
4088+`b` is a `@rs`.
4089+
4090+#### Produces
4091+
4092+A `@rs`.
4093+
4094+#### Source
4095+
4096+```
4097+ ++ lth ~/ %lth
4098+ |= [a=@rs b=@rs]
4099+ ~_ leaf+"rs-fail"
4100+ (lth:ma a b)
4101+```
4102+
4103+#### Examples
4104+
4105+```
4106+ > (lth:rs .9.9e1 .1.1e2)
4107+ %.y
4108+
4109+ > (lth:rs .9.9e1 .9.9e1)
4110+ %.n
4111+```
4112+
4113+---
4114+### `++lte:rs`
4115+
4116+Less than or equal
4117+
4118+Test whether `a` is less than or equal to `b`.
4119+
4120+#### Accepts
4121+
4122+`a` is a `@rs`, a single-precision float.
4123+
4124+`b` is a `@rs`.
4125+
4126+#### Produces
4127+
4128+A `@rs`.
4129+
4130+#### Source
4131+
4132+```
4133+ ++ lte ~/ %lte
4134+ |= [a=@rs b=@rs]
4135+ ~_ leaf+"rs-fail"
4136+ (lte:ma a b)
4137+```
4138+
4139+#### Examples
4140+
4141+```
4142+ > (lte:rs .9.9e1 .1.1e2)
4143+ %.y
4144+
4145+ > (lte:rs .9.9e1 .9.9e1)
4146+ %.y
4147+```
4148+
4149+---
4150+### `equ:rs`
4151+
4152+Equals
4153+
4154+Test whether `a` is equal to `b`.
4155+
4156+#### Accepts
4157+
4158+`a` is a `@rs`, a single-precision float.
4159+
4160+`b` is a `@rs`.
4161+
4162+#### Produces
4163+
4164+A `@rs`.
4165+
4166+#### Source
4167+
4168+```
4169+ ++ equ ~/ %equ
4170+ |= [a=@rs b=@rs]
4171+ ~_ leaf+"rs-fail"
4172+ (equ:ma a b)
4173+```
4174+
4175+#### Examples
4176+
4177+```
4178+ > (equ:rs .9.9e1 .1.1e2)
4179+ %.n
4180+
4181+ > (equ:rs .9.9e1 .9.9e1)
4182+ %.y
4183+```
4184+
4185+---
4186+### `++gte:rs`
4187+
4188+Greater than or equal
4189+
4190+Test whether `a` is greater than or equal to `b`.
4191+
4192+#### Accepts
4193+
4194+`a` is a `@rs`, a single-precision float.
4195+
4196+`b` is a `@rs`.
4197+
4198+#### Produces
4199+
4200+A `@rs`.
4201+
4202+#### Source
4203+
4204+```
4205+ ++ gte ~/ %gte
4206+ |= [a=@rs b=@rs]
4207+ ~_ leaf+"rs-fail"
4208+ (gte:ma a b)
4209+```
4210+
4211+#### Examples
4212+
4213+```
4214+ > (gte:rs .9.9e1 .9.9e1)
4215+ %.y
4216+
4217+ > (gte:rs .9.9e1 .9.2e2)
4218+ %.n
4219+```
4220+
4221+---
4222+### `++gth:rs`
4223+
4224+Greater than
4225+
4226+Test whether `a` is greater than `b`.
4227+
4228+#### Accepts
4229+
4230+`a` is a `@rs`, a single-precision float.
4231+
4232+`b` is a `@rs`.
4233+
4234+#### Produces
4235+
4236+A `@rs`.
4237+
4238+#### Source
4239+
4240+```
4241+ ++ gth ~/ %gth
4242+ |= [a=@rs b=@rs]
4243+ ~_ leaf+"rs-fail"
4244+ (gth:ma a b)
4245+```
4246+
4247+#### Examples
4248+
4249+```
4250+ > (gth:rs .9.9e1 .9.2e2)
4251+ %.n
4252+
4253+ > (gth:rs .9.9e1 .9.9e1)
4254+ %.n
4255+
4256+ > (gth:rs .9.9e1 .1.9e1)
4257+ %.y
4258+```
4259+
4260+---
4261+### `++sun:rs`
4262+
4263+Unsigned integer to `@rs`
4264+
4265+Converts `a` from an unsigned integer to `@rs`.
4266+
4267+#### Accepts
4268+
4269+`a` is an unsigned integer.
4270+
4271+#### Produces
4272+
4273+A `@rs`.
4274+
4275+#### Source
4276+
4277+```
4278+ ++ sun |= [a=@u] ^- @rs (sun:ma a)
4279+```
4280+
4281+#### Examples
4282+
4283+```
4284+ > (sun:rs 343)
4285+ .3.43e2
4286+```
4287+
4288+---
4289+### `++san:rs`
4290+
4291+Signed integer to `@rs`'
4292+
4293+Converts `a` from an unsigned integer to `@rs`.
4294+
4295+#### Accepts
4296+
4297+`a` is a signed integer.
4298+
4299+#### Produces
4300+
4301+A `@rs`.
4302+
4303+#### Source
4304+
4305+```
4306+ ++ san |= [a=@s] ^- @rs (san:ma a)
4307+```
4308+
4309+#### Examples
4310+
4311+```
4312+ > (san:rs -343)
4313+ .-3.43e2'
4314+```
4315+
4316+### `++sig:rs`
4317+
4318+Get sign
4319+
4320+Produces the sign of `a`.
4321+
4322+#### Accepts
4323+
4324+`a` is a `@rs`.
4325+
4326+#### Produces
4327+
4328+A `flag`.
4329+
4330+#### Source
4331+
4332+```
4333+ ++ sig |= [a=@rs] ^- ? (sig:ma a)
4334+```
4335+
4336+#### Examples
4337+
4338+```
4339+ > (sig:rs .3.43e2)
4340+ %.y
4341+
4342+ > (sig:rs .-3.43e2)
4343+ %.n
4344+```
4345+
4346+---
4347+### `exp:rs`
4348+
4349+Get exponent
4350+
4351+Produces the exponent of `a`.
4352+
4353+#### Accepts
4354+
4355+`a` is a `@rs`.
4356+
4357+#### Produces
4358+
4359+A signed integer.
4360+
4361+#### Source
4362+
4363+```
4364+ ++ exp |= [a=@rs] ^- @s (exp:ma a)
4365+```
4366+
4367+#### Examples
4368+
4369+```
4370+ > (exp:rs .-3.43e2)
4371+ --8
4372+```
4373+
4374+---
4375+### `++toi:rs`
4376+
4377+Round to integer
4378+
4379+Rounds `a` to the nearest integer.
4380+
4381+#### Accepts
4382+
4383+`a` is a `@rs`.
4384+
4385+#### Produces
4386+
4387+A `unit` of `@s`.
4388+
4389+#### Source
4390+
4391+```
4392+ ++ toi |= [a=@rs] ^- (unit @s) (toi:ma a)
4393+```
4394+
4395+#### Examples
4396+
4397+```
4398+ > (toi:rs .-3.43e2)
4399+ [~ u=-343]
4400+```
4401+
4402+---
4403+### `++drg:rs`
4404+
4405+`@rs` to decimal float
4406+
4407+Produces the decimal form of `a` using the Dragon4 algorithm. Guarantees
4408+accurate results for rounded floats.
4409+
4410+#### Accepts
4411+
4412+`a` is a `@rs`
4413+
4414+#### Produces
4415+
4416+A `dn`.
4417+
4418+#### Source
4419+
4420+```
4421+ ++ drg |= [a=@rs] ^- dn (drg:ma a)
4422+```
4423+
4424+#### Examples
4425+
4426+```
4427+ > (drg:rs .-3.43e2)
4428+ [%d s=%.n e=--0 a=343]
4429+```
4430+
4431+---
4432+### `++grd:rs`
4433+
4434+Decimal float to `@rs`
4435+
4436+Converts `a` from `dn` to `@rs`.
4437+
4438+#### Accepts
4439+
4440+`a` is a `dn`.
4441+
4442+#### Produces
4443+
4444+A `@rs`.
4445+
4446+#### Source
4447+
4448+```
4449+ ++ grd |= [a=dn] ^- @rs (grd:ma a)
4450+ --
4451+```
4452+
4453+#### Examples
4454+
4455+```
4456+ > (grd:rs [%d s=%.n e=--0 a=343])
4457+ .-3.43e2
4458+```
4459+
4460+---
4461+### `++rq`
4462+
4463+Quadruple-precision fp
4464+
4465+A container core for operations related to quadruple-precision binary floats.
4466+
4467+`++rq` has four rounding modes: round to nearest (`$n`), round up (`$u`), round
4468+down (`$d`), and round to zero (`$z`).
4469+
4470+#### Source
4471+
4472+```
4473+ ++ rq
4474+ ~% %rq +> ~
4475+ ^?
4476+ |_ r=$?($n $u $d $z)
4477+```
4478+
4479+### `++ma:rq`
4480+
4481+Initialize `ff`
4482+
4483+Instantiates the core `ff`, giving values to its samples based on the
4484+configuration of the `rq` core.
4485+
4486+#### Source
4487+
4488+```
4489+ ++ ma
4490+ %*(. ff w 15, p 112, b --16.383, r r)
4491+```
4492+
4493+---
4494+### `++sea:rq`
4495+
4496+`@rq` to `fn`
4497+
4498+Converts `a` from `@rq` to `fn`.
4499+
4500+#### Accepts
4501+
4502+`a` is a `@rq`, a quad-precision float.
4503+
4504+#### Produces
4505+
4506+An `fn`.
4507+
4508+#### Source
4509+
4510+```
4511+ ++ sea
4512+ |= [a=@rq] (sea:ma a)
4513+```
4514+
4515+#### Examples
4516+
4517+```
4518+ > (sea:rq .~~~1.05102e5)
4519+ [%f s=%.y e=-96 a=8.327.038.336.574.210.409.756.656.268.214.272]
4520+```
4521+
4522+---
4523+### `++bit:rq`
4524+
4525+`fn` to `@rq`
4526+
4527+Converts `a` from `fn` to `@rq`.
4528+
4529+#### Accepts
4530+
4531+`a` is an `fn`.
4532+
4533+#### Produces
4534+
4535+A `@rq`, a quad-precision float.
4536+
4537+#### Source
4538+
4539+```
4540+ ++ bit
4541+ |= [a=n] ^- @rq (bit:ma a)
4542+```
4543+
4544+#### Examples
4545+
4546+```
4547+ > (bit:rq [%f s=%.y e=-96 a=8.327.038.336.574.210.409.756.656.268.214.272])
4548+ .~~~1.05102e5
4549+```
4550+
4551+---
4552+### `++add:rq`
4553+
4554+Add
4555+
4556+Produces the sum of `a` plus `b`.
4557+
4558+#### Accepts
4559+
4560+`a` is a `@rq`, a quad-precision float.
4561+
4562+`b` is a `@rq`.
4563+
4564+#### Produces
4565+
4566+A `@rq`.
4567+
4568+#### Source
4569+
4570+```
4571+ ++ add ~/ %add
4572+ |= [a=@rq b=@rq] ^- @rq
4573+ ~_ leaf+"rq-fail"
4574+ (add:ma a b)
4575+```
4576+
4577+#### Examples
4578+
4579+```
4580+ > (add:rq .~~~-1.821e5 .~~~1.05102e5)
4581+ .~~~-7.6998e4
4582+```
4583+
4584+---
4585+### `++sub:rq`
4586+
4587+Subtract
4588+
4589+Produces the difference of `a` minus `b`.
4590+
4591+#### Accepts
4592+
4593+`a` is a `@rq`, a quad-precision float.
4594+
4595+`b` is a `@rq`.
4596+
4597+#### Produces
4598+
4599+A `@rq`.
4600+
4601+#### Source
4602+
4603+```
4604+ ++ sub ~/ %sub
4605+ |= [a=@rq b=@rq] ^- @rq
4606+ ~_ leaf+"rq-fail"
4607+ (sub:ma a b)
4608+```
4609+
4610+#### Examples
4611+
4612+```
4613+ > (sub:rq .~~~1.821e5 .~~~1.05102e5)
4614+ .~~~7.6998e4
4615+
4616+ > (sub:rq .~~~1.821e5 .~~~-1.05102e5)
4617+ .~~~2.87202e5
4618+```
4619+
4620+---
4621+### `++mul:rq`
4622+
4623+Multiply
4624+
4625+Produces the product of `a` times `b`.
4626+
4627+#### Accepts
4628+
4629+`a` is a `@rq`, a quad-precision float.
4630+
4631+`b` is a `@rq`.
4632+
4633+#### Produces
4634+
4635+A `@rq`.
4636+
4637+#### Source
4638+
4639+```
4640+ ++ mul ~/ %mul
4641+ |= [a=@rq b=@rq] ^- @rq
4642+ ~_ leaf+"rq-fail"
4643+ (mul:ma a b)
4644+```
4645+
4646+#### Examples
4647+
4648+```
4649+ > (mul:rq .~~~1.821e5 .~~~-1.05102e5)
4650+ .~~~-1.91390742e10
4651+```
4652+
4653+---
4654+### `div:rq`
4655+
4656+Divide
4657+
4658+Produces the product of `a` divided by `b`.
4659+
4660+#### Accepts
4661+
4662+`a` is a `@rq`, a quad-precision float.
4663+
4664+`b` is a `@rq`.
4665+
4666+#### Produces
4667+
4668+A `@rq`.
4669+
4670+#### Source
4671+
4672+```
4673+ ++ div ~/ %div
4674+ |= [a=@rq b=@rq] ^- @rq
4675+ ~_ leaf+"rq-fail"
4676+ (div:ma a b)
4677+```
4678+
4679+#### examples
4680+
4681+```
4682+ > (div:rq .~~~1.821e5 .~~~1.05102e3)
4683+ .~~~1.732602614602957127361991208540275e2
4684+```
4685+
4686+---
4687+### `fma:rq`
4688+
4689+Fused multiply-add
4690+
4691+Produces the sum of `c` plus the product of `a` multiplied by `b`;
4692+`(a * b) + c`.
4693+
4694+#### Accepts
4695+
4696+`a` is a `@rq`, a quad-precision float.
4697+
4698+`b` is a `@rq`.
4699+
4700+`c` is a `@rq`.
4701+
4702+#### Produces
4703+
4704+A `@rq`.
4705+
4706+#### Source
4707+
4708+```
4709+ ++ fma ~/ %fma
4710+ |= [a=@rq b=@rq c=@rq] ^- @rq
4711+ ~_ leaf+"rq-fail"
4712+ (fma:ma a b c)
4713+```
4714+
4715+#### Examples
4716+
4717+```
4718+ > (fma:rq .~~~1.821e5 .~~~-1.05102e2 .~~~6.2044e7)
4719+ .~~~4.29049258e7
4720+```
4721+
4722+---
4723+#### Source
4724+
4725+Square root
4726+
4727+Produces the square root of `a`.
4728+
4729+#### Accepts
4730+
4731+`a` is a `@rq`, a quad-precision float.
4732+
4733+#### Produces
4734+
4735+A `@rq`.
4736+
4737+#### Source
4738+
4739+```
4740+ ++ sqt ~/ %sqt
4741+ |= [a=@rq] ^- @rq
4742+ ~_ leaf+"rq-fail"
4743+ (sqt:ma a)
4744+```
4745+
4746+#### Source
4747+
4748+```
4749+ > (sqt:rq .~~~6.2044e7)
4750+ .~~~7.876801381271461258959876570289002e3
4751+```
4752+
4753+---
4754+### `++lth:rq`
4755+
4756+Less than
4757+
4758+Tests whether `a` is less than `b`.
4759+
4760+#### Accepts
4761+
4762+`a` is a `@rq`, a quad-precision float.
4763+
4764+`b` is a `@rq`.
4765+
4766+#### Produces
4767+
4768+A `@rq`.
4769+
4770+#### Source
4771+
4772+```
4773+ ++ lth ~/ %lth
4774+ |= [a=@rq b=@rq]
4775+ ~_ leaf+"rq-fail"
4776+ (lth:ma a b)
4777+```
4778+
4779+
4780+#### Examples
4781+
4782+```
4783+ > (lth:rq .~~~1.2044e7 (mul:rq .~~~9.02e2 .~~~7.114e3))
4784+ %.n
4785+
4786+ > (lth:rq .~~~1.2044e7 (mul:rq .~~~9.02e3 .~~~7.114e3))
4787+ %.y
4788+```
4789+
4790+---
4791+### `lte:rq`
4792+
4793+Less than or equal
4794+
4795+Tests whether `a` is less than or equal to `b`.
4796+
4797+#### Accepts
4798+
4799+`a` is a `@rq`, a quad-precision float.
4800+
4801+`b` is a `@rq`.
4802+
4803+#### Produces
4804+
4805+A `@rq`.
4806+
4807+#### Source
4808+
4809+```
4810+ ++ lte ~/ %lte
4811+ |= [a=@rq b=@rq]
4812+ ~_ leaf+"rq-fail"
4813+ (lte:ma a b)
4814+```
4815+
4816+#### Examples
4817+
4818+```
4819+ > (lte:rq .~~~1.2044e7 (mul:rq .~~~9.02e2 .~~~7.114e3))
4820+ %.n
4821+
4822+ > (lte:rq .~~~1.2044e7 (mul:rq .~~~9.02e3 .~~~7.114e3))
4823+ %.y
4824+
4825+ > (lte:rq .~~~1.2044e7 .~~~1.2044e7)
4826+ %.y
4827+```
4828+
4829+---
4830+### `++equ:rq`
4831+
4832+Equals
4833+
4834+Tests whether `a` is equal to `b`.
4835+
4836+#### Accepts
4837+
4838+`a` is a `@rq`, a quad-precision float.
4839+
4840+`b` is a `@rq`.
4841+
4842+#### Produces
4843+
4844+A `@rq`.
4845+
4846+#### Source
4847+
4848+```
4849+ ++ equ ~/ %equ
4850+ |= [a=@rq b=@rq]
4851+ ~_ leaf+"rq-fail"
4852+ (equ:ma a b)
4853+```
4854+
4855+#### Examples
4856+
4857+```
4858+ > (equ:rq .~~~1.2044e7 .~~~1.2044e7)
4859+ %.y
4860+
4861+ > (equ:rq .~~~2.2044e7 .~~~1.2044e7)
4862+ %.n
4863+```
4864+
4865+---
4866+### `++gte:rq`
4867+
4868+Greater than or equal
4869+
4870+Tests whether `a` is greater than or equal to `b`.
4871+
4872+#### Accepts
4873+
4874+`a` is a `@rq`, a quad-precision float.
4875+
4876+`b` is a `@rq`.
4877+
4878+#### Produces
4879+
4880+A `@rq`.
4881+
4882+#### Source
4883+
4884+```
4885+ ++ gte ~/ %gte
4886+ |= [a=@rq b=@rq]
4887+ ~_ leaf+"rq-fail"
4888+ (gte:ma a b)
4889+```
4890+
4891+#### Examples
4892+
4893+```
4894+ > (gte:rq .~~~1.2044e7 .~~~1.2044e7)
4895+ %.y
4896+
4897+ > (gte:rq .~~~2.2044e7 .~~~1.2044e7)
4898+ %.y
4899+
4900+ > (gte:rq .~~~1.2044e7 .~~~2.2044e7)
4901+ %.n
4902+```
4903+
4904+---
4905+### `++gth:rq`
4906+
4907+Tests whether `a` is greater than `b`.
4908+
4909+#### Accepts
4910+
4911+`a` is a `@rq`, a quad-precision float.
4912+
4913+`b` is a `@rq`.
4914+
4915+#### Produces
4916+
4917+A `@rq`.
4918+
4919+#### Source
4920+
4921+```
4922+ ++ gth ~/ %gth
4923+ |= [a=@rq b=@rq]
4924+ ~_ leaf+"rq-fail"
4925+ (gth:ma a b)
4926+```
4927+
4928+#### Examples
4929+
4930+```
4931+ > (gth:rq .~~~1.2044e7 .~~~1.2044e7)
4932+ %.n
4933+
4934+ > (gth:rq .~~~2.2044e7 .~~~1.2044e7)
4935+ %.y
4936+
4937+ > (gth:rq .~~~1.2044e7 .~~~2.2044e7)
4938+ %.n
4939+```
4940+
4941+---
4942+### `++sun:rq`
4943+
4944+Unsigned integer to `@rq`
4945+
4946+Converts `@` from an unsigned integer to `@rq`.
4947+
4948+#### Accepts
4949+
4950+`a` is a `@u`, an unsigned integer.
4951+
4952+#### Produces
4953+
4954+A `@rq`, a quad-precision float.
4955+
4956+#### Source
4957+
4958+```
4959+ ++ sun |= [a=@u] ^- @rq (sun:ma a)
4960+```
4961+
4962+#### Examples
4963+
4964+```
4965+ > (sun:rq 205)
4966+ .~~~2.05e2
4967+```
4968+
4969+---
4970+### `++san:rq`
4971+
4972+Signed integer to `rq`
4973+
4974+Converts `@` from a signed integer to `@rq`.
4975+
4976+#### Accepts
4977+
4978+`a` is a `@s`, a signed integer.
4979+
4980+#### Produces
4981+
4982+A `@rq`, a quad-precision float.
4983+
4984+#### Source
4985+
4986+```
4987+ ++ san |= [a=@s] ^- @rq (san:ma a)
4988+```
4989+
4990+#### Examples
4991+
4992+```
4993+ > (san:rq -205)
4994+ .~~~-2.05e2
4995+```
4996+
4997+---
4998+### `++sig:rq`
4999+
5000+Get sign
5001+
5002+Produces the sign of `a`.
5003+
5004+#### Accepts
5005+
5006+`a` is a `@rq`, a quad-precision float.
5007+
5008+#### Produces
5009+
5010+A `flag`.
5011+
5012+#### Source
5013+
5014+```
5015+ ++ sig |= [a=@rq] ^- ? (sig:ma a)
5016+```
5017+
5018+#### Examples
5019+
5020+```
5021+ > (sig:rq .~~~-2.05e2)
5022+ %.n
5023+```
5024+
5025+---
5026+### `++exp:rq`
5027+
5028+Get exponent
5029+
5030+Gets the exponent of `a`.
5031+
5032+#### Accepts
5033+
5034+`a` is a `@rq`, a quad-precision float.
5035+
5036+#### Produces
5037+
5038+A `@s`, a signed integer.
5039+
5040+#### Source
5041+
5042+```
5043+ ++ exp |= [a=@rq] ^- @s (exp:ma a)
5044+```
5045+
5046+#### Examples
5047+
5048+```
5049+ > (exp:rq .~~~-2.05e2)
5050+ --7
5051+```
5052+
5053+---
5054+### `toi:rq`
5055+
5056+Round to integer
5057+
5058+Rounds `a` to the nearest integer.
5059+
5060+#### Accepts
5061+
5062+`a` is a `@rq`, a quad-precision float.
5063+
5064+#### Produces
5065+
5066+A `unit` of `@s`.
5067+
5068+#### Source
5069+
5070+```
5071+ ++ toi |= [a=@rq] ^- (unit @s) (toi:ma a)
5072+```
5073+
5074+#### Examples
5075+
5076+```
5077+ > (toi:rq .~~~-2.085e2)
5078+ [~ u=-208]
5079+
5080+ > (toi:rq .~~~-2.08e2)
5081+ [~ u=-208]
5082+```
5083+
5084+---
5085+### `++drg:rq`
5086+
5087+`@rq` to decimal float
5088+
5089+Produces the decimal form of `a` using the Dragon4 algorithm. Guarantees
5090+accurate results for rounded floats.
5091+
5092+#### Accepts
5093+
5094+`a` is a `@rq`, a quad-precision float.
5095+
5096+#### Produces
5097+
5098+A `dn`.
5099+
5100+#### Source
5101+
5102+```
5103+ ++ drg |= [a=@rq] ^- dn (drg:ma a) :: @rq to decimal float
5104+```
5105+
5106+#### Examples
5107+
5108+```
5109+ > (drg:rq .~~~-2.085e2)
5110+ [%d s=%.n e=-1 a=2.085]
5111+
5112+ > (drg:rq .~~~-2.08e2)
5113+ [%d s=%.n e=--0 a=208]
5114+```
5115+
5116+---
5117+### `++grd:rq`
5118+
5119+Decimal float to `@rq`
5120+
5121+Converts `a` from `dn` to `@rq`.
5122+
5123+#### Accepts
5124+
5125+`a` is `dn`.
5126+
5127+`a` is a `@rq`.
5128+
5129+#### Produces
5130+
5131+A `@rq`, a quad-precision float.
5132+
5133+#### Source
5134+
5135+```
5136+ ++ grd |= [a=dn] ^- @rq (grd:ma a)
5137+ --
5138+```
5139+
5140+#### Examples
5141+
5142+```
5143+ > (grd:rq [%d s=%.n e=--0 a=343])
5144+ .~~~-3.43e2
5145+```
5146+
5147+---
5148+### `++rh`
5149+
5150+Half-precision fp
5151+
5152+A container core for operations related to half-precision binary floats.
5153+
5154+`++rh` has four rounding modes: round to nearest (`$n`), round up (`$u`), round
5155+down (`$d`), and round to zero (`$z`).
5156+
5157+#### Source
5158+
5159+```
5160+ ++ rh
5161+ ~% %rh +> ~
5162+ ^?
5163+ |_ r=$?($n $u $d $z)
5164+```
5165+
5166+---
5167+### `++ma:rh`
5168+
5169+Initialize `ff`
5170+
5171+Instantiates the core `ff`, giving values to its samples based on the
5172+configuration of the `rh` core.
5173+
5174+#### Source
5175+
5176+```
5177+ ++ ma
5178+ %*(. ff w 5, p 10, b --15, r r)
5179+```
5180+
5181+---
5182+### `++sea:rh`
5183+
5184+`@rh` to `fn`
5185+
5186+Converts `a` from `@rh` to `fn`.
5187+
5188+#### Accepts
5189+
5190+`a` is a `@rh`, a half-precision float.
5191+
5192+#### Produces
5193+
5194+An `fn`.
5195+
5196+#### Source
5197+
5198+```
5199+ ++ sea
5200+ |= [a=@rh] (sea:ma a)
5201+```
5202+
5203+#### Examples
5204+
5205+```
5206+ > (sea:rh .~~1.22e-5)
5207+ [%f s=%.y e=-24 a=205]
5208+```
5209+
15210---
2−navhome: /docs/
5211+### `++bit:rh`
5212+
5213+`fn` to `@rh`
5214+
5215+Converts `a` from `fn` to `@rh`.
5216+
5217+#### Accepts
5218+
5219+`a` is an `fn`.
5220+
5221+#### Produces
5222+
5223+A `@rh`, a half-precision float.
5224+
5225+#### Source
5226+
5227+```
5228+ ++ bit
5229+ |= [a=fn] ^- @rh (bit:ma a)
5230+```
5231+
5232+#### Examples
5233+
5234+```
5235+ > (bit:rh [%f s=%.y e=-24 a=205])
5236+ .~~1.22e-5
5237+```
5238+
35239---
5240+### `++add:rh`
45241
5242+Produces the sum of `a` plus `b`.
55243
6−# 3b: floating point
5244+#### Accepts
5245+
5246+`a` is a `@rh`, a half-precision float.
5247+
5248+`b` is a `@rh`.
5249+
5250+#### Produces
5251+
5252+A `@rh`.
5253+
5254+#### Source
5255+
5256+```
5257+ ++ add ~/ %add
5258+ |= [a=@rh b=@rh] ^- @rh
5259+ ~_ leaf+"rh-fail"
5260+ (add:ma a b)
5261+```
5262+
5263+#### Examples
5264+
5265+```
5266+ > (add:rh .~~1.82e2 .~~1.02e2)
5267+ .~~2.84e2
5268+```
5269+
5270+---
5271+### `++sub:rh`
5272+
5273+Subtract
5274+
5275+Produces the difference of `a` minus `b`.
5276+
5277+#### Accepts
5278+
5279+`a` is a `@rh`, a half-precision float.
5280+
5281+`b` is a `@rh`.
5282+
5283+#### Produces
5284+
5285+A `@rh`.
5286+
5287+#### Source
5288+
5289+```
5290+ ++ sub ~/ %sub
5291+ |= [a=@rh b=@rh] ^- @rh
5292+ ~_ leaf+"rh-fail"
5293+ (sub:ma a b)
5294+```
5295+
5296+#### Examples
5297+
5298+```
5299+ > (sub:rh .~~1.821e2 .~~1.051e2)
5300+ .~~7.7e1
5301+
5302+ > (sub:rh .~~1.821e2 .~~6.051e2)
5303+ .~~-4.228e2
5304+```
5305+
5306+---
5307+### `++mul:rh`
5308+
5309+Multiply
5310+
5311+Produces the product of `a` times `b`.
5312+
5313+#### Accepts
5314+
5315+`a` is a `@rh`, a quad-precision float.
5316+
5317+`b` is a `@rh`.
5318+
5319+#### Produces
5320+
5321+A `@rh`.
5322+
5323+#### Source
5324+
5325+```
5326+ ++ mul ~/ %mul
5327+ |= [a=@rh b=@rh] ^- @rh
5328+ ~_ leaf+"rh-fail"
5329+ (mul:ma a b)
5330+```
5331+
5332+#### Examples
5333+
5334+```
5335+ > (mul:rh .~~1.821e1 .~~-1.05102e2)
5336+ .~~-1.913e3
5337+```
5338+
5339+---
5340+### `div:rh`
5341+
5342+Divide
5343+
5344+Produces the product of `a` divided by `b`.
5345+
5346+#### Accepts
5347+
5348+`a` is a `@rh`, a half-precision float.
5349+
5350+`b` is a `@rh`.
5351+
5352+#### Produces
5353+
5354+A `@rh`.
5355+
5356+#### Source
5357+
5358+```
5359+ ++ div ~/ %div
5360+ |= [a=@rh b=@rh] ^- @rh
5361+ ~_ leaf+"rh-fail"
5362+ (div:ma a b)
5363+```
5364+
5365+#### examples
5366+
5367+```
5368+ > (div:rh .~~1.821e3 .~~1.05102e2)
5369+ .~~1.731e1
5370+```
5371+
5372+---
5373+### `fma:rh`
5374+
5375+Fused multiply-add
5376+
5377+Produces the sum of `c` plus the product of `a` multiplied by `b`;
5378+`(a * b) + c`.
5379+
5380+#### Accepts
5381+
5382+`a` is a `@rh`, a half-precision float.
5383+
5384+`b` is a `@rh`.
5385+
5386+`c` is a `@rh`.
5387+
5388+#### Produces
5389+
5390+A `@rh`.
5391+
5392+#### Source
5393+
5394+```
5395+ ++ fma ~/ %fma
5396+ |= [a=@rh b=@rh c=@rh] ^- @rh
5397+ ~_ leaf+"rh-fail"
5398+ (fma:ma a b c)
5399+```
5400+
5401+#### Examples
5402+
5403+```
5404+ > (fma:rh .~~1.821e4 .~~-1.05102e2 .~~6.2044e3)
5405+ .~~-6.55e4
5406+```
5407+
5408+---
5409+#### Source
5410+
5411+Square root
5412+
5413+Produces the square root of `a`.
5414+
5415+#### Accepts
5416+
5417+`a` is a `@rh`, a half-precision float.
5418+
5419+#### Produces
5420+
5421+A `@rh`.
5422+
5423+#### Source
5424+
5425+```
5426+ ++ sqt ~/ %sqt
5427+ |= [a=@rh] ^- @rh
5428+ ~_ leaf+"rh-fail"
5429+ (sqt:ma a)
5430+```
5431+
5432+#### Source
5433+
5434+```
5435+ > (sqt:rh .~~6.24e4)
5436+ .~~2.498e2
5437+```
5438+
5439+---
5440+### `++lth:rh`
5441+
5442+Less than
5443+
5444+Tests whether `a` is less than `b`.
5445+
5446+#### Accepts
5447+
5448+`a` is a `@rh`, a half-precision float.
5449+
5450+`b` is a `@rh`.
5451+
5452+#### Produces
5453+
5454+A `@rh`.
5455+
5456+#### Source
5457+
5458+```
5459+ ++ lth ~/ %lth
5460+ |= [a=@rh b=@rh]
5461+ ~_ leaf+"rh-fail"
5462+ (lth:ma a b)
5463+```
5464+
5465+#### Examples
5466+
5467+```
5468+ > (lth:rh .~~1.2e5 (mul:rh .~~9.02e2 .~~7.114e2))
5469+ %.n
5470+
5471+ > (lth:rh .~~1.2e3 (mul:rh .~~9.02e1 .~~7.114e2))
5472+ %.y
5473+```
5474+
5475+---
5476+### `lte:rh`
5477+
5478+Less than or equal
5479+
5480+Tests whether `a` is less than or equal to `b`.
5481+
5482+#### Accepts
5483+
5484+`a` is a `@rh`, a half-precision float.
5485+
5486+`b` is a `@rh`.
5487+
5488+#### Produces
5489+
5490+A `@rh`.
5491+
5492+#### Source
5493+
5494+```
5495+ ++ lte ~/ %lte
5496+ |= [a=@rh b=@rh]
5497+ ~_ leaf+"rh-fail"
5498+ (lte:ma a b)
5499+```
5500+
5501+#### Examples
5502+
5503+```
5504+ > (lth:rh .~~1.2e5 (mul:rh .~~9.02e2 .~~7.114e2))
5505+ %.n
5506+
5507+ > (lth:rh .~~1.2e3 (mul:rh .~~9.02e1 .~~7.114e2))
5508+ %.y
5509+
5510+ > (lte:rh .~~1.2e3 .~~1.2e3)
5511+ %.y
5512+```
5513+
5514+---
5515+### `++equ:rh`
5516+
5517+Equals
5518+
5519+Tests whether `a` is equal to `b`.
5520+
5521+#### Accepts
5522+
5523+`a` is a `@rh`, a half-precision float.
5524+
5525+`b` is a `@rh`.
5526+
5527+#### Produces
5528+
5529+A `@rh`.
5530+
5531+#### Source
5532+
5533+```
5534+ ++ equ ~/ %equ
5535+ |= [a=@rh b=@rh]
5536+ ~_ leaf+"rh-fail"
5537+ (equ:ma a b)
5538+```
5539+
5540+#### Examples
5541+
5542+```
5543+ > (equ:rh .~~1.24e4 .~~1.24e4)
5544+ %.y
5545+
5546+ > (equ:rh .~~2.24e4 .~~1.24e4)
5547+ %.n
5548+```
5549+
5550+---
5551+### `++gte:rh`
5552+
5553+Greater than or equal
5554+
5555+Tests whether `a` is greater than or equal to `b`.
5556+
5557+#### Accepts
5558+
5559+`a` is a `@rh`, a half-precision float.
5560+
5561+`b` is a `@rh`.
5562+
5563+#### Produces
5564+
5565+A `@rh`.
5566+
5567+#### Source
5568+
5569+```
5570+ ++ gte ~/ %gte
5571+ |= [a=@rh b=@rh]
5572+ ~_ leaf+"rh-fail"
5573+ (gte:ma a b)
5574+```
5575+
5576+#### Examples
5577+
5578+```
5579+ > (gte:rh .~~1.24e4 .~~1.24e4)
5580+ %.y
5581+
5582+ > (gte:rh .~~2.24e4 .~~1.24e4)
5583+ %.y
5584+
5585+ > (gte:rh .~~1.24e4 .~~2.24e4)
5586+ %.n
5587+```
5588+
5589+---
5590+### `++gth:rh`
5591+
5592+Tests whether `a` is greater than `b`.
5593+
5594+#### Accepts
5595+
5596+`a` is a `@rh`, a half-precision float.
5597+
5598+`b` is a `@rh`.
5599+
5600+#### Produces
5601+
5602+A `@rh`.
5603+
5604+#### Source
5605+
5606+```
5607+ ++ gth ~/ %gth
5608+ |= [a=@rh b=@rh]
5609+ ~_ leaf+"rh-fail"
5610+ (gth:ma a b)
5611+```
5612+
5613+#### Examples
5614+
5615+```
5616+ > (gth:rh .~~1.24e4 .~~1.244e4)
5617+ %.n
5618+
5619+ > (gth:rh .~~2.24e4 .~~1.24e4)
5620+ %.y
5621+
5622+ > (gth:rh .~~1.24e4 .~~2.24e4)
5623+ %.n
5624+```
5625+
5626+---
5627+### `++sun:rh`
5628+
5629+Unsigned integer to `@rh`
5630+
5631+Converts `@` from an unsigned integer to `@rh`.
5632+
5633+#### Accepts
5634+
5635+`a` is a `@u`, an unsigned integer.
5636+
5637+#### Produces
5638+
5639+A `@rh`, a half-precision float.
5640+
5641+#### Source
5642+
5643+```
5644+ ++ sun |= [a=@u] ^- @rh (sun:ma a)
5645+```
5646+
5647+#### Examples
5648+
5649+```
5650+ > (sun:rh 205)
5651+ .~~2.05e2
5652+```
5653+
5654+---
5655+### `++san:rh`
5656+
5657+Signed integer to `@rh`
5658+
5659+Converts `@` from a signed integer to `@rh`.
5660+
5661+#### Accepts
5662+
5663+`a` is a `@s`, a signed integer.
5664+
5665+#### Produces
5666+
5667+A `@rh`, a half-precision float.
5668+
5669+#### Source
5670+
5671+```
5672+ ++ san |= [a=@s] ^- @rh (san:ma a)
5673+```
5674+
5675+#### Examples
5676+
5677+```
5678+ > (san:rh -205)
5679+ .~~-2.05e2
5680+```
5681+
5682+---
5683+### `++sig:rh`
5684+
5685+Get sign
5686+
5687+Produces the sign of `a`.
5688+
5689+#### Accepts
5690+
5691+`a` is a `@rh`, a half-precision float.
5692+
5693+#### Produces
5694+
5695+A `flag`.
5696+
5697+#### Source
5698+
5699+```
5700+ ++ sig |= [a=@rh] ^- ? (sig:ma a)
5701+```
5702+
5703+#### Examples
5704+
5705+```
5706+ > (sig:rh .~~-2.05e2)
5707+ %.n
5708+```
5709+
5710+---
5711+### `++exp:rh`
5712+
5713+Get exponent
5714+
5715+Gets the exponent of `a`.
5716+
5717+#### Accepts
5718+
5719+`a` is a `@rh`, a half-precision float.
5720+
5721+#### Produces
5722+
5723+A `@s`, a signed integer.
5724+
5725+#### Source
5726+
5727+```
5728+ ++ exp |= [a=@rh] ^- @s (exp:ma a)
5729+```
5730+
5731+#### Examples
5732+
5733+```
5734+ > (exp:rh .~~-2.05e2)
5735+ --7
5736+```
5737+
5738+---
5739+### `toi:rh`
5740+
5741+Round to integer
5742+
5743+Rounds `a` to the nearest integer.
5744+
5745+#### Accepts
5746+
5747+`a` is a `@rh`, a half-precision float.
5748+
5749+#### Produces
5750+
5751+A `unit` of `@s`.
5752+
5753+#### Source
5754+
5755+```
5756+ ++ toi |= [a=@rh] ^- (unit @s) (toi:ma a)
5757+```
5758+
5759+#### Examples
5760+
5761+```
5762+ > (toi:rh .~~-2.085e2)
5763+ [~ u=-208]
5764+
5765+ > (toi:rh .~~-2.08e2)
5766+ [~ u=-208]
5767+```
5768+
5769+---
5770+### `++drg:rh`
5771+
5772+`@rh` to decimal float
5773+
5774+Produces the decimal form of `a` using the Dragon4 algorithm. Guarantees
5775+accurate results for rounded floats.
5776+
5777+#### Accepts
5778+
5779+`a` is a `@rh`, a half-precision float.
5780+
5781+#### Produces
5782+
5783+A `dn`.
5784+
5785+#### Source
5786+
5787+```
5788+ ++ drg |= [a=@rh] ^- dn (drg:ma a)
5789+```
5790+
5791+#### Examples
5792+
5793+```
5794+ > (drg:rh .~~-2.085e2)
5795+ [%d s=%.n e=-1 a=2.085]
5796+
5797+ > (drg:rh .~~-2.08e2)
5798+ [%d s=%.n e=--0 a=208]
5799+```
5800+
5801+---
5802+### `++grd:rh`
5803+
5804+Decimal float to `@rh`
5805+
5806+Converts `a` from `dn` to `@rh`.
5807+
5808+#### Accepts
5809+
5810+`a` is `dn`.
5811+
5812+`a` is a `@rh`.
5813+
5814+#### Produces
5815+
5816+A `@rh`, a a half-precision float.
5817+
5818+#### Source
5819+
5820+```
5821+ ++ grd |= [a=dn] ^- @rh (grd:ma a)
5822+ --
5823+```
5824+
5825+#### Examples
5826+
5827+```
5828+ > (grd:rh [%d s=%.n e=--0 a=343])
5829+ .~~-3.43e2
5830+```
5831+
5832+---
docs/reference/library/3c.umd+109−53
@@ -1,8 +1,9 @@
1+:- :~ navhome/'/docs/'
2+ sort/'23'
3+ title/'3c: Urbit Time'
4+ ==
15
2−---
3−navhome: /docs/
4−---
5−
6+;>
67
78# 3c: urbit time
89
@@ -23,7 +24,8 @@ A cell of unsigned decimals.
2324
2425#### Source
2526
26− ++ yall
27+```
28+ ++ yall
2729 |= day=@ud
2830 ^- [y=@ud m=@ud d=@ud]
2931 =+ [era=0 cet=0 lep=*?]
@@ -46,10 +48,11 @@ A cell of unsigned decimals.
4648 ?: (lth day zis)
4749 [yer +(mot) +(day)]
4850 $(mot +(mot), day (sub day zis))
49−
51+```
5052
5153#### Examples
5254
55+```
5356 > (yall 198)
5457 [y=0 m=7 d=17]
5558
@@ -58,10 +61,10 @@ A cell of unsigned decimals.
5861
5962 > (yall 0)
6063 [y=0 m=1 d=1]
64+```
6165
6266
63−
64−***
67+---
6568### `++yawn`
6669
6770Days since beginning of time
@@ -83,7 +86,8 @@ An unsigned decimal.
8386
8487#### Source
8588
86− ++ yawn
89+```
90+ ++ yawn
8791 |= [yer=@ud mot=@ud day=@ud]
8892 ^- @ud
8993 => .(mot (dec mot), day (dec day))
@@ -107,9 +111,11 @@ An unsigned decimal.
107111 =+ nec=(sub yer 100)
108112 $(yer nec, day (add day ?:((yelp nec) 36.525 36.524)))
109113 (add day (mul (div yer 400) (add 1 (mul 4 36.524))))
114+```
110115
111116#### Examples
112117
118+```
113119 > (yawn 2.018 7 4)
114120 737.244
115121
@@ -118,9 +124,9 @@ An unsigned decimal.
118124
119125 > (yawn 1.990 10 11)
120126 727.116
127+```
121128
122−
123−***
129+---
124130### `++year`
125131
126132Date to @d
@@ -138,7 +144,8 @@ A `@d`.
138144
139145#### Source
140146
141− ++ year
147+```
148+ ++ year
142149 |= det=date
143150 ^- @da
144151 =+ ^= yer
@@ -147,15 +154,16 @@ A `@d`.
147154 (sub 292.277.024.400 (dec y.det))
148155 =+ day=(yawn yer m.det d.t.det)
149156 (yule day h.t.det m.t.det s.t.det f.t.det)
150−
157+```
151158
152159#### Examples
153160
161+```
154162 > (year [[a=%.y y=2.014] m=8 t=[d=4 h=20 m=4 s=57 f=~[0xd940]]])
155163 0x8000000d227df4e9d940000000000000
164+```
156165
157−
158−***
166+---
159167### `++yell`
160168
161169Tarp from atomic date
@@ -172,7 +180,8 @@ A `tarp`.
172180
173181#### Source
174182
175− ++ yell
183+```
184+ ++ yell
176185 |= now=@d
177186 ^- tarp
178187 =+ sec=(rsh 6 1 now)
@@ -190,10 +199,11 @@ A `tarp`.
190199 =+ mit=(div sec mit:yo)
191200 => .(sec (mod sec mit:yo))
192201 [day hor mit sec fan]
193−
202+```
194203
195204#### Examples
196205
206+```
197207 > (yell ~2014.3.20..05.42.53..7456)
198208 [d=106.751.991.820.094 h=5 m=42 s=53 f=~[0x7456]]
199209
@@ -202,9 +212,9 @@ A `tarp`.
202212
203213 > (yell ~1776.7.4)
204214 [d=106.751.991.733.273 h=0 m=0 s=0 f=~]
215+```
205216
206−
207−***
217+---
208218### `++yelp`
209219
210220Leap-week?
@@ -221,12 +231,15 @@ A flag.
221231
222232#### Source
223233
224− ++ yelp
234+```
235+ ++ yelp
225236 |= yer=@ud ^- ?
226237 &(=(0 (mod yer 4)) |(!=(0 (mod yer 100)) =(0 (mod yer 400))))
238+```
227239
228240#### Examples
229241
242+```
230243 > (yelp 2.014)
231244 %.n
232245
@@ -238,9 +251,9 @@ A flag.
238251
239252 > (yelp 14.011)
240253 %.n
254+```
241255
242−
243−***
256+---
244257### `++yore`
245258
246259Date from atomic date
@@ -257,7 +270,8 @@ A `date`.
257270
258271#### Source
259272
260− ++ yore
273+```
274+ ++ yore
261275 |= now=@da
262276 ^- date
263277 =+ rip=(yell now)
@@ -266,15 +280,16 @@ A `date`.
266280 [a=& y=(sub y.ger 292.277.024.400)]
267281 [a=| y=+((sub 292.277.024.400 y.ger))]
268282 [m.ger d.ger h.rip m.rip s.rip f.rip]
269−
283+```
270284
271285#### Examples
272286
287+```
273288 > (yore ~2014.6.6..21.09.15..0a16)
274289 [[a=%.y y=2.014] m=6 t=[d=6 h=21 m=9 s=15 f=~[0xa16]]]
290+```
275291
276−
277−***
292+---
278293### `++yule`
279294
280295Daily time to time atom
@@ -292,6 +307,7 @@ A time atom, `@d`.
292307
293308#### Source
294309
310+```
295311 ++ yule :: time atom
296312 |= rip=tarp
297313 ^- @d
@@ -309,9 +325,11 @@ A time atom, `@d`.
309325 (add (lsh 4 muc i.f.rip) $(f.rip t.f.rip))
310326 (con (lsh 6 1 sec) fac)
311327 ::
328+```
312329
313330#### Examples
314331
332+```
315333 > =murica (yell ~1776.7.4)
316334
317335 > murica
@@ -331,9 +349,9 @@ A time atom, `@d`.
331349
332350 > `@dr`(yule `tarp`[31 12 30 0 ~])
333351 ~d31.h12.m30
352+```
334353
335−
336−***
354+---
337355### `++yo`
338356
339357Time constants core
@@ -342,9 +360,11 @@ Core whose arms contain constants for interacting with earth time.
342360
343361#### Source
344362
345− ++ yo
363+```
364+ ++ yo
365+```
346366
347−***
367+---
348368### `++cet:yo`
349369
350370Days in a century
@@ -359,10 +379,13 @@ An atom.
359379
360380#### Source
361381
362− |% ++ cet 36.524
382+```
383+ |% ++ cet 36.524
384+```
363385
364386#### Examples
365387
388+```
366389 > cet:yo
367390 36.524
368391
@@ -371,9 +394,9 @@ An atom.
371394
372395 > (sub (add 24 (mul 100 365)) cet:yo)
373396 0
397+```
374398
375−
376−***
399+---
377400### `++day:yo`
378401
379402Seconds in day
@@ -386,17 +409,21 @@ An atom.
386409
387410#### Source
388411
389− ++ day 86.400
412+```
413+ ++ day 86.400
414+```
390415
391416#### Examples
392417
418+```
393419 > day:yo
394420 86.400
395421
396422 > (add 60 day:yo)
397423 86.460
424+```
398425
399−***
426+---
400427### `++era:yo`
401428
402429Leap-year period
@@ -411,25 +438,29 @@ An atom.
411438
412439#### Source
413440
414− ++ era 146.097
441+```
442+ ++ era 146.097
443+```
415444
416445#### Examples
417446
447+```
418448 > era:yo
419449 146.097
420450
421451 > (sub era:yo (mul 4 cet:yo))
422452 1
453+```
423454
424455#### Discussion
425456
426457A year is a leap-year if:
427458
428− - it's divisible by 4;
429− - *unless* it's divisible by 100;
430− - *or* if it's divisible by 400.
459+- it's divisible by 4;
460+- *unless* it's divisible by 100;
461+- *or* if it's divisible by 400.
431462
432−***
463+---
433464### `++hor:yo`
434465
435466Seconds in hour
@@ -443,17 +474,21 @@ An atom.
443474
444475#### Source
445476
446− ++ hor 3.600
477+```
478+ ++ hor 3.600
479+```
447480
448481#### Examples
449482
483+```
450484 > hor:yo
451485 3.600
452486
453487 > (div hor:yo 60)
454488 60
489+```
455490
456−***
491+---
457492### `++jes:yo`
458493
459494Maximum 64-bit timestamp
@@ -467,19 +502,22 @@ An atom.
467502
468503#### Source
469504
505+```
470506 ++ jes 106.751.991.084.417
507+```
471508
472509#### Examples
473510
511+```
474512 > jes:yo
475513 106.751.991.084.417
476−
514+```
477515
478516#### Discussion
479517
480518The date is December 4, 292,277,026,596.
481519
482−***
520+---
483521### `++mit:yo`
484522
485523Seconds in minute
@@ -492,14 +530,18 @@ An atom.
492530
493531#### Source
494532
533+```
495534 ++ mit 60
535+```
496536
497537#### Examples
498538
539+```
499540 > mit:yo
500541 60
542+```
501543
502−***
544+---
503545### `++moh:yo`
504546
505547Days in month
@@ -514,18 +556,21 @@ A `list` of `@ud`
514556
515557#### Source
516558
559+```
517560 ++ moh `(list @ud)`[31 28 31 30 31 30 31 31 30 31 30 31 ~]
561+```
518562
519563#### Examples
520564
565+```
521566 > moh:yo
522567 ~[31 28 31 30 31 30 31 31 30 31 30 31]
523568
524569 > (snag 4 moh:yo)
525570 31
571+```
526572
527−
528−***
573+---
529574### `++moy:yo`
530575
531576Days in months of leap-year
@@ -540,17 +585,21 @@ A `list` of `@ud`.
540585
541586#### Source
542587
588+```
543589 ++ moy `(list @ud)`[31 29 31 30 31 30 31 31 30 31 30 31 ~]
590+```
544591
545592#### Examples
546593
594+```
547595 > moy:yo
548596 ~[31 29 31 30 31 30 31 31 30 31 30 31]
549597
550598 > (snag 1 moy:yo)
551599 29
600+```
552601
553−***
602+---
554603### `++qad:yo`
555604
556605Seconds in 4 years
@@ -564,14 +613,18 @@ An atom.
564613
565614#### Source
566615
567− ++ qad 126.144.001
616+```
617+ ++ qad 126.144.001
618+```
568619
569620#### Examples
570621
622+```
571623 > qad:yo
572624 126.144.001
625+```
573626
574−***
627+---
575628### `++yer:yo`
576629
577630Seconds in year
@@ -585,12 +638,15 @@ An atom.
585638
586639#### Source
587640
588− ++ yer 31.536.000
641+```
642+ ++ yer 31.536.000
643+```
589644
590645#### Examples
591646
647+```
592648 > yer:yo
593649 31.536.000
650+```
594651
595−
596−***
652+---
docs/reference/library/3d.umd+89−34
@@ -1,6 +1,9 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'24'
3+ title/'3d: SHA Hash Family'
4+ ==
5+
6+;>
47
58# 3d: SHA hash family
69
@@ -21,13 +24,17 @@ An atom.
2124
2225#### Source
2326
24− ++ shad |=(ruz=@ (shax (shax ruz)))
27+```
28+ ++ shad |=(ruz=@ (shax (shax ruz)))
29+```
2530
2631#### Examples
2732
33+```
2834 > (shad 11)
2935 \/20.519.637.820.582.103.109.435.907.615.585.653.479.776.629.591.855.451.248.\/
3036 718.295.626.625.655.417.234
37+```
3138
3239***
3340### `++shaf`
@@ -44,22 +51,25 @@ first and last halves of the 256-bit salted hash `shas`.
4451`ruz` is an atom.
4552
4653#### Source
54+
55+```
4756 ++ shaf :: half sha-256
4857 |= [sal=@ ruz=@]
4958 =+ haz=(shas sal ruz)
5059 (mix (end 7 1 haz) (rsh 7 1 haz))
51− ::
60+```
5261
5362#### Examples
5463
64+```
5565 > (shaf 17 8)
5666 52.667.672.807.485.289.251.324.336.639.183.409.041
5767
5868 > `@ub`(shaf 17 8)
5969 \/0b1011.1111.1101.0110.1110.1000.0100.1110.1100.1000.0010.0100.1111.0001.0010.0010\/
6070 .0100.1110.1110.0011.1100.1111.0001.1101.1101.1100.1110.1111.0100.0101.0001.0100
61− \/
62−
71+ \/
72+```
6373
6474***
6575### `++shal`
@@ -81,7 +91,8 @@ An atom.
8191
8292#### Source
8393
84− ++ shal
94+```
95+ ++ shal
8596 ~/ %shal
8697 |= [len=@ ruz=@] ^- @
8798 => .(ruz (cut 3 [0 len] ruz))
@@ -192,21 +203,23 @@ An atom.
192203 =+ p=(mix (dis e f) (dis (inv e) g)) :: ch
193204 =+ q=:(sum h o p (wac j kbx) (wac j wox)) :: t1
194205 $(j +(j), a (sum q n), b a, c b, d c, e (sum d q), f e, g f, h g)
195− ::
206+```
196207
197208#### Examples
198209
210+```
199211 > (shal 1 'hello')
200212 \/7.956.615.373.791.575.273.027.009.123.631.914.645.972.441.264.528.176.292.399.908\/
201213 .424.469.676.078.106.561.839.264.176.650.109.335.825.608.088.511.266.620.100.157.
202214 847.055.280.028.606.252.747.432.021.213.474
203− \/
215+ \/
204216
205217 > (shal 1 'hello')
206218 \/7.956.615.373.791.575.273.027.009.123.631.914.645.972.441.264.528.176.292.399.908\/
207219 .424.469.676.078.106.561.839.264.176.650.109.335.825.608.088.511.266.620.100.157.
208220 847.055.280.028.606.252.747.432.021.213.474
209− \/
221+ \/
222+```
210223
211224#### Discussion
212225
@@ -233,20 +246,24 @@ An atom.
233246
234247#### Source
235248
236− ++ sham
249+```
250+ ++ sham
237251 |= yux=* ^- @uvH ^- @
238252 ?@ yux
239253 (shaf %mash yux)
240254 (shaf %sham (jam yux))
241255 ::
256+```
242257
243258#### Examples
244259
260+```
245261 > (sham [2 4])
246262 0v3.71s52.4bqnp.ki2b8.9hhsp.2ufgg
247263
248264 > (sham "hello")
249265 0v1.hg8mv.t7s3f.u4f8a.q5noe.dvqvh
266+```
250267
251268***
252269### `++shan`
@@ -265,7 +282,8 @@ An atom.
265282
266283#### Source
267284
268− ++ shan
285+```
286+ ++ shan
269287 |= ruz=@
270288 =+ [few==>(fe .(a 5)) wac=|=([a=@ b=@] (cut 5 [a 1] b))]
271289 =+ [sum=sum.few ror=ror.few rol=rol.few net=net.few inv=inv.few]
@@ -330,13 +348,14 @@ An atom.
330348 :(sum (rol 0 5 a) fz e (wac 2 kbx) (wac j wox))
331349 :(sum (rol 0 5 a) fy e (wac 3 kbx) (wac j wox))
332350 $(j +(j), a tem, b a, c (rol 0 30 b), d c, e d)
333− ::
334−
351+```
335352
336353#### Examples
337354
355+```
338356 > (shan 'hello')
339357 975.987.071.262.755.080.377.722.350.727.279.193.143.145.743.181
358+```
340359
341360#### Discussion
342361
@@ -359,18 +378,20 @@ of that logical operation is then itself hashed with SHA-256.
359378
360379#### Source
361380
362− ++ shas
381+```
382+ ++ shas
363383 |= [sal=@ ruz=@]
364384 (shax (mix sal (shax ruz)))
365− ::
385+```
366386
367387#### Examples
368388
389+```
369390 > (shas 12.845 6)
370391 \/111.115.941.493.032.291.043.932.789.632.248.509.108.945.255.494.251.860.287\/
371392 .707.279.709.200.349.471.936
372− \/
373−
393+ \/
394+```
374395
375396***
376397### `++shaw`
@@ -394,18 +415,21 @@ An atom.
394415
395416#### Source
396417
397− ++ shaw
418+```
419+ ++ shaw
398420 |= [sal=@ len=@ ruz=@]
399421 (~(raw og (shas sal (mix len ruz))) len)
400− ::
422+```
401423
402424#### Examples
403425
426+```
404427 > `@ub`(shaw 3 6 98)
405428 0b11.0111
406429
407430 > `@ub`(shaw 2 6 98)
408431 0b11
432+```
409433
410434***
411435### `++shax`
@@ -416,18 +440,21 @@ Produces an atom by hashing an atom `ruz` with SHA-256.
416440
417441#### Sources
418442
419− ++ shax
443+```
444+ ++ shax
420445 ~/ %shax
421446 |= ruz=@ ^- @
422447 (shay [(met 3 ruz) ruz])
423− ::
448+```
424449
425450#### Examples
426451
452+```
427453 > (shax 'hello')
428454 \/16.552.786.619.039.860.277.601.417.878.457.384.195.409.020.923.835.016.617.984.82\/
429455 0.774.431.701.725.740
430− \/
456+ \/
457+```
431458
432459***
433460### `++shay`
@@ -445,7 +472,8 @@ the byte-length of the theoretical buffer represented by the atom.
445472
446473#### Source
447474
448− ++ shay
475+```
476+ ++ shay
449477 ~/ %shay
450478 |= [len=@u ruz=@] ^- @
451479 => .(ruz (cut 3 [0 len] ruz))
@@ -530,19 +558,21 @@ the byte-length of the theoretical buffer represented by the atom.
530558 =+ p=(mix (dis e f) (dis (inv e) g)) :: ch
531559 =+ q=:(sum h o p (wac j kbx) (wac j wox)) :: t1
532560 $(j +(j), a (sum q n), b a, c b, d c, e (sum d q), f e, g f, h g)
533−
561+```
534562
535563#### Examples
536564
565+```
537566 > (shay 1 'hello')
538567 \/16.144.219.278.061.159.438.339.586.294.967.166.038.336.988.797.862.808.055.174.98\/
539568 7.398.597.302.069.674
540− \/
569+ \/
541570
542571 > (shay 2 'hello')
543572 \/100.467.333.538.737.303.691.714.735.404.408.035.555.613.179.595.938.688.113.300.8\/
544573 01.974.878.934.544.183
545− \/
574+ \/
575+```
546576
547577#### Discussion
548578
@@ -567,17 +597,21 @@ An atom.
567597
568598#### Source
569599
570− ++ shaz
600+```
601+ ++ shaz
571602 |= ruz=@ ^- @
572603 (shal [(met 3 ruz) ruz])
604+```
573605
574606#### Examples
575607
608+```
576609 > (shaz 'hello')
577610 \/3.548.533.422.469.437.734.729.094.584.175.910.682.076.656.883.559.953.324.378.007\/
578611 .735.849.386.038.666.450.748.109.671.344.747.196.048.200.348.948.408.339.256.384.
579612 360.070.359.656.053.016.948.640.159.265.179
580613 \/
614+```
581615
582616***
583617### `++og`
@@ -594,14 +628,19 @@ atom that is used as a seed for the hash.
594628A core.
595629
596630#### Source
597− ++ og
631+
632+```
633+ ++ og
598634 ~/ %og
599635 |_ a=@
636+```
600637
601638#### Examples
602639
640+```
603641 > ~(. og 919)
604642 <4.wmp {a/@ud <54.tyv 119.olq 31.ohr 1.jmk $143>}>
643+```
605644
606645#### Discussion
607646
@@ -627,13 +666,16 @@ An atom.
627666
628667#### Source
629668
630− ++ rad
669+```
670+ ++ rad
631671 |= b=@ ^- @
632672 =+ c=(raw (met 0 b))
633673 ?:((lth c b) c $(a +(a)))
674+```
634675
635676#### Examples
636677
678+```
637679 > (~(rad og 5) 11)
638680 4
639681
@@ -645,6 +687,7 @@ An atom.
645687
646688 > (~(rad og eny) 11) :: `eny` acts as a random sample
647689 7
690+```
648691
649692***
650693### `++rads`
@@ -665,13 +708,16 @@ A cell.
665708
666709#### Source
667710
668− ++ rads
711+```
712+ ++ rads
669713 |= b=@
670714 =+ r=(rad b)
671715 [r +>.$(a (shas %og-s (mix a r)))]
716+```
672717
673718#### Examples
674719
720+```
675721 > (~(rads og 4) 10)
676722 [2 <4.wmp {a/@ <54.tyv 119.olq 31.ohr 1.jmk $143>}>]
677723
@@ -680,6 +726,7 @@ A cell.
680726 =^ b rng (rads:rng 10)
681727 [a b]
682728 [2 8]
729+```
683730
684731#### Discussion
685732
@@ -704,7 +751,8 @@ An atom.
704751
705752#### Source
706753
707− ++ raw
754+```
755+ ++ raw
708756 ~/ %raw
709757 |= b=@ ^- @
710758 %+ can
@@ -717,9 +765,11 @@ An atom.
717765 ?: (lth b 256)
718766 [[b (end 0 b d)] ~]
719767 [[256 d] $(c d, b (sub b 256))]
768+```
720769
721770#### Examples
722771
772+```
723773 > `@ud`(~(raw og 27) 4)
724774 0b1001
725775
@@ -731,6 +781,7 @@ An atom.
731781
732782 > `@ub`(~(raw og 11) 3)
733783 0b100
784+```
734785
735786***
736787### `++raws`
@@ -743,14 +794,17 @@ parent core with `(raw b)`.
743794
744795#### Source
745796
746− ++ raws
797+```
798+ ++ raws
747799 |= b=@
748800 =+ r=(raw b)
749801 [r +>.$(a (shas %og-s r))]
750802 --
803+```
751804
752805#### Examples
753806
807+```
754808 > `[@ub _og]`(~(raws og 7) 4)
755809 [0b1100 <4.wmp {a/@ <54.tyv 119.olq 31.ohr 1.jmk $143>}>]
756810
@@ -759,6 +813,7 @@ parent core with `(raw b)`.
759813 =^ b rng (rads:rng 4)
760814 [`@ub`a `@ub`b]
761815 [0b10 0b1]
816+```
762817
763818#### Discussion
764819
docs/reference/library/3e.umd+6−4
@@ -1,10 +1,12 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'25'
3+ title/'3e: (Removed)'
4+ ==
45
6+;>
57
68# 3e: AES encryption
79
810The standard-library functions in this section have been removed.
911
10−***
12+---
docs/reference/library/3f.umd+96−37
@@ -1,10 +1,13 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'26'
3+ title/'3f: Scrambling'
4+ ==
5+
6+;>
47
58# 3f: scrambling
69
7−### `++un`
10+### `++un`*
811
912Reversible scrambling
1013
@@ -13,10 +16,12 @@ Used in the `@p` phonetic base.
1316
1417#### Source
1518
16− ++ un
19+```
20+ ++ un
1721 |%
22+```
1823
19−***
24+---
2025### `++wren`
2126
2227Conceal structure
@@ -35,7 +40,8 @@ An atom.
3540
3641#### Source
3742
38− ++ wren
43+```
44+ ++ wren
3945 |= pyn=@ ^- @
4046 =+ len=(met 3 pyn)
4147 ?: =(0 len)
@@ -52,10 +58,11 @@ An atom.
5258 =+ mog=(zyft :(mix mig (end 3 1 len) (cut 3 [len 1] pyn)))
5359 [[1 mog] $(mig mog)]
5460 ::
55−
61+```
5662
5763#### Examples
5864
65+```
5966 > `@ux`(wren:un 'testing')
6067 0x30.bf6a.b9fe.7d8f
6168
@@ -64,8 +71,9 @@ An atom.
6471
6572 > `@da`(wred:un (wren:un ~2001.2.5))
6673 ~2001.2.5
74+```
6775
68−***
76+---
6977### `++wred`
7078
7179Restore structure
@@ -84,7 +92,8 @@ An atom.
8492
8593#### Source
8694
87− ++ wred
95+```
96+ ++ wred
8897 |= cry=@ ^- @
8998 =+ len=(met 3 cry)
9099 ?: =(0 len)
@@ -101,9 +110,11 @@ An atom.
101110 =+ mog=(cut 3 [len 1] cry)
102111 [[1 :(mix mig (end 3 1 len) (zyrt mog))] $(mig mog)]
103112 ::
113+```
104114
105115#### Examples
106116
117+```
107118 > (wred:un 0x30.bf6a.b9fe.7d8f)
108119 29.113.321.805.538.676
109120
@@ -112,8 +123,9 @@ An atom.
112123
113124 > (wred:un (wren:un 200.038.426))
114125 200.038.426
126+```
115127
116−***
128+---
117129### `++xafo`
118130
119131Add modulo 255
@@ -133,10 +145,13 @@ An atom.
133145
134146#### Source
135147
148+```
136149 ++ xafo |=([a=@ b=@] +((mod (add (dec b) a) 255)))
150+```
137151
138152#### Examples
139153
154+```
140155 > (xafo:un 5 6)
141156 11
142157
@@ -145,8 +160,9 @@ An atom.
145160
146161 > (xafo:un 256 (xaro:un 256 20))
147162 20
163+```
148164
149−***
165+---
150166### `++xaro`
151167
152168Subtract modulo 255
@@ -166,10 +182,13 @@ An atom.
166182
167183#### Source
168184
185+```
169186 ++ xaro |=([a=@ b=@] +((mod (add (dec b) (sub 255 (mod a 255))) 255)))
187+```
170188
171189#### Examples
172190
191+```
173192 > (xaro:un 17 57)
174193 40
175194
@@ -178,8 +197,9 @@ An atom.
178197
179198 > (xaro:un 256 (xafo:un 256 20))
180199 20
200+```
181201
182−***
202+---
183203### `++zaft`
184204
185205Look up in 255 sub box
@@ -197,7 +217,8 @@ An atom.
197217
198218#### Source
199219
200− ++ zaft
220+```
221+ ++ zaft
201222 |= a=@D
202223 =+ ^= b
203224 0xcc.75bc.86c8.2fb1.9a42.f0b3.79a0.92ca.21f6.1e41.cde5.fcc0.
@@ -212,10 +233,11 @@ An atom.
212233 3750.6ef1.44dd.89ef.6576.d00a.fbda.9ed2.3b6c.7b0c.bde9.2ade.
213234 5c88.c182.481a.1b0f.2bfd.d591.2726.57ba
214235 (cut 3 [(dec a) 1] b)
215− ::
236+```
216237
217238#### Examples
218239
240+```
219241 > (zaft:un 0x12)
220242 42
221243
@@ -227,8 +249,9 @@ An atom.
227249 > (zaft:un 0x0)
228250 ! decrement-underflow
229251 ! exit
252+```
230253
231−***
254+---
232255### `++zart`
233256
234257Reverse look up in 255 sub box
@@ -246,6 +269,7 @@ An atom.
246269
247270#### Source
248271
272+```
249273 ++ zart :: reverse 255-sbox
250274 |= a=@D
251275 =+ ^= b
@@ -262,9 +286,11 @@ An atom.
262286 e409.7b9f.1598.1d3f.33de.8ce3.8970.8e7a
263287 (cut 3 [(dec a) 1] b)
264288 ::
289+```
265290
266291#### Examples
267292
293+```
268294 > `@ux`(zart:un 204)
269295 0xff
270296
@@ -273,8 +299,9 @@ An atom.
273299
274300 > (zaft:un 0x12)
275301 42
302+```
276303
277−***
304+---
278305### `++zyft`
279306
280307Lookup byte in 256 sub box
@@ -292,6 +319,7 @@ An atom.
292319
293320#### Source
294321
322+```
295323 ++ zyft :: forward 256-sbox
296324 |= a=@D
297325 =+ ^= b
@@ -309,9 +337,11 @@ An atom.
309337 9068.1edf.8f33.b632.d427.97fa.9ee1
310338 (cut 3 [a 1] b)
311339 ::
340+```
312341
313342#### Examples
314343
344+```
315345 > (zyft:un 0x12)
316346 57
317347
@@ -322,8 +352,9 @@ An atom.
322352 187
323353 > `@ux`(zyrt:un 187)
324354 0xff
355+```
325356
326−***
357+---
327358### `++zyrt`
328359
329360Reverse lookup byte in 256 sub box
@@ -341,6 +372,7 @@ An atom.
341372
342373#### Source
343374
375+```
344376 ++ zyrt :: reverse 256-sbox
345377 |= a=@D
346378 =+ ^= b
@@ -357,9 +389,11 @@ An atom.
357389 1c4a.28ac.fc0b.26ca.5870.e576.f7f1.616d.905f.ef41.33bc.
358390 df4d.225e.2d56.7fd6.1395.a3f8.c582
359391 (cut 3 [a 1] b)
392+```
360393
361394#### Examples
362395
396+```
363397 > `@ux`(zyrt:un 57)
364398 0x12
365399
@@ -370,19 +404,22 @@ An atom.
370404 0xff
371405 > (zyft:un 0xff)
372406 187
407+```
373408
374−***
409+---
375410### `++ob`
376411
377412Reversible scrambling, v2
378413
414+```
379415 ++ ob
380416 |%
417+```
381418
382419A core for performing reversible scrambling operations for the `@p` phonetic
383420base.
384421
385−***
422+---
386423### `++feen`
387424
388425Conceal structure, v2
@@ -401,7 +438,8 @@ An atom.
401438
402439#### Source
403440
404− ++ feen
441+```
442+ ++ feen
405443 |= pyn=@ ^- @
406444 ?: &((gte pyn 0x1.0000) (lte pyn 0xffff.ffff))
407445 (add 0x1.0000 (fice (sub pyn 0x1.0000)))
@@ -412,10 +450,11 @@ An atom.
412450 (add 0x1.0000 (fice (sub lo 0x1.0000)))
413451 pyn
414452 ::
415−
453+```
416454
417455#### Examples
418456
457+```
419458 > `@p`(feen:ob 111.103)
420459 ~mophul-pagwyx
421460
@@ -427,8 +466,9 @@ An atom.
427466
428467 > `@p`(feen:ob ~wex)
429468 ~wex
469+```
430470
431−***
471+---
432472### `++fend`
433473
434474Restore structure, v2
@@ -448,7 +488,8 @@ An atom.
448488
449489#### Source
450490
451− ++ fend
491+```
492+ ++ fend
452493 |= cry=@ ^- @
453494 ?: &((gte cry 0x1.0000) (lte cry 0xffff.ffff))
454495 (add 0x1.0000 (teil (sub cry 0x1.0000)))
@@ -459,9 +500,11 @@ An atom.
459500 (add 0x1.0000 (teil (sub lo 0x1.0000)))
460501 cry
461502 ::
503+```
462504
463505#### Examples
464506
507+```
465508 > `@p`(fend:ob 111.103)
466509 ~doznec-sapfes
467510
@@ -476,9 +519,9 @@ An atom.
476519
477520 > `@p`(fend:ob ~tarmed)
478521 ~tarmed
522+```
479523
480−
481−***
524+---
482525### `++fice`
483526
484527Feistel-like cipher
@@ -498,6 +541,7 @@ An atom.
498541
499542#### Source
500543
544+```
501545 ++ fice :: adapted from
502546 |= nor=@ :: black and rogaway
503547 ^- @ :: "ciphers with
@@ -508,17 +552,19 @@ An atom.
508552 [(mod nor 65.535) (div nor 65.535)]
509553 (add (mul 65.535 -.sel) +.sel)
510554 ::
511−
555+```
512556
513557#### Examples
514558
559+```
515560 > (fice:ob 11)
516561 776.343.932
517562
518563 > (fice:ob (teil:ob 11))
519564 11
565+```
520566
521−***
567+---
522568### `++teil`
523569
524570Reverse Feistel-like cipher
@@ -538,6 +584,7 @@ An atom.
538584
539585#### Source
540586
587+```
541588 ++ teil :: reverse ++fice
542589 |= vip=@
543590 ^- @
@@ -548,19 +595,20 @@ An atom.
548595 [(mod vip 65.535) (div vip 65.535)]
549596 (add (mul 65.535 -.sel) +.sel)
550597 ::
551−
598+```
552599
553600
554601#### Examples
555602
603+```
556604 > (teil:ob 11)
557605 514.230.493
558606
559607 > (teil:ob (fice:ob 11))
560608 11
609+```
561610
562−
563−***
611+---
564612### `++rynd`
565613
566614Reverse Feistel-like cipher
@@ -582,24 +630,27 @@ A cell of two atoms.
582630
583631#### Source
584632
585− ++ rynd
633+```
634+ ++ rynd
586635 |= [n=@ l=@ r=@]
587636 ^- [@ @]
588637 :- r
589638 ?~ (mod n 2)
590639 (~(sum fo 65.535) l (en:aesc (snag n raku) r))
591640 (~(sum fo 65.536) l (en:aesc (snag n raku) r))
641+```
592642
593643#### Examples
594644
645+```
595646 > (rynd:ob 2 261 9)
596647 [9 37.422]
597648
598649 > (rynd:ob 2 (rund:ob 2 37.422 9))
599650 [261 32.902]
651+```
600652
601−
602−***
653+---
603654### `++rund`
604655
605656Reverse single Feistel-like
@@ -621,23 +672,27 @@ A cell of two atoms.
621672
622673#### Source
623674
624− ++ rund
675+```
676+ ++ rund
625677 |= [n=@ l=@ r=@]
626678 ^- [@ @]
627679 :- r
628680 ?~ (mod n 2)
629681 (~(dif fo 65.535) l (muk (snag n raku) 2 r))
630682 (~(dif fo 65.536) l (muk (snag n raku) 2 r))
683+```
631684
632685#### Examples
633686
687+```
634688 > (rund:ob 2 261 9)
635689 [9 28.635]
636690
637691 > (rund:ob 2 (rynd:ob 2 28.635 9))
638692 [261 32.651]
693+```
639694
640−***
695+---
641696### `++raku`
642697
643698Key list
@@ -650,6 +705,7 @@ A list of atoms of aura `@ux` (hexadecimal).
650705
651706#### Source
652707
708+```
653709 ++ raku
654710 ^- (list @ux)
655711 :~ 0xb76d.5eed
@@ -658,10 +714,13 @@ A list of atoms of aura `@ux` (hexadecimal).
658714 0x4b38.7af7
659715 ==
660716 --
717+```
661718
662719#### Examples
663720
721+```
664722 > raku:ob
665723 ~[0xb76d.5eed 0xee28.1300 0x85bc.ae01 0x4b38.7af7]
724+```
666725
667−***
726+---
docs/reference/library/3g.umd+91−53
@@ -1,9 +1,12 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'27'
3+ title/'3g: Molds and Mold-Builders'
4+ ==
45
6+;>
57
68# 3g: molds and mold builders
9+
710### `++coin`
811
912
@@ -14,14 +17,17 @@ and printed using `++so` and `++co` cores.
1417
1518#### Source
1619
17− ++ coin $% [$$ p=dime]
18− [$blob p=*]
19− [$many p=(list coin)]
20− ==
20+```
21+ ++ coin $% [$$ p=dime]
22+ [$blob p=*]
23+ [$many p=(list coin)]
24+ ==
25+```
2126
22−***
27+---
2328#### Examples
2429
30+```
2531 > `coin`(need (slay '~s1'))
2632 [%$ p=[p=~.dr q=18.446.744.073.709.551.616]]
2733
@@ -41,10 +47,10 @@ and printed using `++so` and `++co` cores.
4147
4248 > ~02cd1
4349 [3 4]
50+```
4451
4552
46−
47−***
53+---
4854### `++dime`
4955
5056Aura-atom pair
@@ -56,14 +62,18 @@ to parse atoms of specific auras.
5662
5763#### Source
5864
65+```
5966 ++ dime [p=@ta q=@]
67+```
6068
6169#### Examples
6270
71+```
6372 > +>:(slay '0x123')
6473 p=[p=~.ux q=291]
74+```
6575
66−***
76+---
6777### `++edge`
6878
6979Parsing location metadata
@@ -72,24 +82,26 @@ Optional result `p` and parsing continuation `q`.
7282
7383#### Source
7484
75− ++ hair [p=@ud q=@ud]
76−
85+```
86+ ++ hair [p=@ud q=@ud]
87+```
7788
7889#### Examples
7990
80−
91+```
8192 > *edge
8293 [p=[p=0 q=0] q=~]
8394
8495 > (tall:vast [1 1] "a b")
8596 [p=[p=1 q=3] q=[~ u=[p=[%wing p=~[%a]] q=[p=[p=1 q=2] q=" b"]]]]
97+```
8698
8799#### Discussion
88100
89101See also: [Section 2e](../2e.md), `++rule`
90102
91103
92−***
104+---
93105### `++hair`
94106
95107Parsing line and column
@@ -98,11 +110,13 @@ A pair of two `@ud` used in parsing indicating line and column number.
98110
99111#### Source
100112
101− ++ hair [p=@ud q=@ud]
102−
113+```
114+ ++ hair [p=@ud q=@ud]
115+```
103116
104117#### Examples
105118
119+```
106120 > *hair
107121 [p=0 q=0]
108122
@@ -114,9 +128,9 @@ A pair of two `@ud` used in parsing indicating line and column number.
114128
115129 > `hair`p:((plus ace) [1 1] " --")
116130 [p=1 q=4]
131+```
117132
118−
119−***
133+---
120134### `++like`
121135
122136Generic edge
@@ -125,16 +139,18 @@ Generates an `++edge` with a parsed result set to a specific type.
125139
126140#### Source
127141
128− ++ like |* a=gate
129− |= b=_`*`[(hair) ~]
130− :- p=(hair -.b)
131− ^= q
132− :- ~
142+```
143+ ++ like |* a=gate
144+ |= b=_`*`[(hair) ~]
145+ :- p=(hair -.b)
146+ ^= q
147+ :- ~
133148 u=[p=(a +>-.b) q=[p=(hair -.b) q=(tape +.b)]]
134−
149+```
135150
136151#### Examples
137152
153+```
138154 > *(like char)
139155 [p=[p=0 q=0] q=~]
140156
@@ -146,9 +162,9 @@ Generates an `++edge` with a parsed result set to a specific type.
146162
147163 > `(like ,@)`(ace [1 1] " a")
148164 [p=[p=1 q=2] q=[~ u=[p=32 q=[p=[p=1 q=2] q="a"]]]]
165+```
149166
150−
151−***
167+---
152168### `++nail`
153169
154170Location, remainder of parsed text
@@ -157,15 +173,18 @@ Indicates parsing position `p`, and remaining text to be parsed `q`.
157173
158174#### Source
159175
160− ++ nail [p=hair q=tape]
161−
176+```
177+ ++ nail [p=hair q=tape]
178+```
162179
163180#### Examples
164181
182+```
165183 > +<:;~(plug cab cab)
166184 c=[p=[p=0 q=0] q=""]
185+```
167186
168−***
187+---
169188### `++path`
170189
171190Filesystem path
@@ -174,19 +193,22 @@ A list of `++knot`s. `++knot` is another name for `@ta`.
174193
175194#### Source
176195
177− ++ path (list knot)
178−
196+```
197+ ++ path (list knot)
198+```
179199
180200#### Examples
181201
202+```
182203 > `path`"abc"
183204 /a/b/c
205+```
184206
185207#### Discussion
186208
187209Used in `%clay` and `%eyre` extensively.
188210
189−***
211+---
190212### `++pint`
191213
192214Parsing range
@@ -196,20 +218,22 @@ stack traces.
196218
197219#### Source
198220
199− ++ pint [p=[p=@ q=@] q=[p=@ q=@]]
200−
221+```
222+ ++ pint [p=[p=@ q=@] q=[p=@ q=@]]
223+```
201224
202225#### Examples
203226
227+```
204228 > !:(!!) :: !! always produces a crash
205229 /~zod/home/~2014.9.20..01.22.04..52e3/:<[1 4].[1 6]>
206230
207231 > `pint`[[1 4] [1 6]]
208232 [p=[p=1 q=4] q=[p=1 q=6]]
233+```
209234
210235
211−
212−***
236+---
213237### `++rule`
214238
215239Parsing rule
@@ -219,16 +243,18 @@ An empty parsing rule, but used to check that parsing rules match this with `_`.
219243
220244#### Source
221245
222− ++ rule _|=(nail *edge)
223−
246+```
247+ ++ rule _|=(nail *edge)
248+```
224249
225250#### Examples
226251
252+```
227253 > ([|=(a=nail [p.a ~ u=['a' a]])]:|6 [1 1] "hi")
228254 [[p=1 q=1] ~ u=['a' p=[p=1 q=1] q="hi"]]
255+```
229256
230−
231−***
257+---
232258### `++spot`
233259
234260Stack trace line
@@ -237,16 +263,19 @@ The stack trace that is printed after crashing.
237263
238264#### Source
239265
240− ++ spot [p=path q=pint]
266+```
267+ ++ spot [p=path q=pint]
268+```
241269
242270#### Examples
243271
272+```
244273 > !: !! :: !! always produces a crash
245274 /~zod/home/~2018.8.8..21.42.40..7852:<[1 5].[1 7]>
246275 ! exit
276+```
247277
248−
249−***
278+---
250279### `++tone`
251280
252281Nock result, error report
@@ -257,13 +286,16 @@ or failure with an error report (`%2`).
257286
258287#### Source
259288
289+```
260290 ++ tone $% [$0 p=*] :: success
261291 [$1 p=(list)] :: blocks
262292 [$2 p=(list [@ta *])] :: error report
263− ==
293+ ==
294+```
264295
265296#### Examples
266297
298+```
267299 > (mink [[20 21] 0 3] $~)
268300 [%0 p=21]
269301
@@ -289,9 +321,9 @@ or failure with an error report (`%2`).
289321 ]
290322 ]
291323 ]
324+```
292325
293−
294−***
326+---
295327### `++toon`
296328
297329Nock result, stack trace
@@ -302,22 +334,24 @@ or failure with a stack trace (`%2`).
302334
303335#### Source
304336
337+```
305338 ++ toon $% [$0 p=*] :: success
306339 [$1 p=(list)] :: blocks
307340 [$2 p=(list tank)] :: stack trace
308− ==
309−
341+ ==
342+```
310343
311344#### Examples
312345
346+```
313347 > (mock [[20 21] 0 3] $~)
314348 [%0 p=21]
315349
316350 > (mock [[1 2] !=(!:(+(.)))] ,~)
317351 [%2 p=~[[%leaf p="/~zod/try/~2014.9.23..18.34.32..d3c5/:<[1 20].[1 24]>"]]]
352+```
318353
319−
320−***
354+---
321355### `++wonk`
322356
323357Product from edge
@@ -326,10 +360,13 @@ Pull result out of a `++edge`, or crash if there's no result.
326360
327361#### Source
328362
329− ++ wonk |*(veq=edge ?~(q.veq !! p.u.q.veq))
363+```
364+ ++ wonk |*(veq=edge ?~(q.veq !! p.u.q.veq))
365+```
330366
331367#### Examples
332368
369+```
333370 > (wide:vast [1 1] "(add 2 2)")
334371 [ p=[p=1 q=10]
335372 q
@@ -343,9 +380,10 @@ Pull result out of a `++edge`, or crash if there's no result.
343380
344381 > (wonk (wide:vast [1 1] "(add 2 2)"))
345382 [%cnhp p=[%wing p=~[%add]] q=~[[%sand p=%ud q=2] [%sand p=%ud q=2]]]
383+```
346384
347385#### Discussion
348386
349387See also: `++edge`
350388
351−***
389+---
docs/reference/library/4a.umd+36−13
@@ -1,9 +1,14 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'28'
3+ title/'4a: Exotic Bases'
4+ ==
5+
6+;>
7+
48
59
610# 4a: exotic bases
11+
712### `++po`
813
914Phonetic base
@@ -14,6 +19,7 @@ contained arms.
1419
1520#### Source
1621
22+```
1723 ~/ %po
1824 =+ :- ^= sis :: prefix syllables
1925 'dozmarbinwansamlitsighidfidlissogdirwacsabwissib\
@@ -50,9 +56,9 @@ contained arms.
5056 /remlysfynwerrycsugnysnyllyndyndemluxfedsedbecmun\
5157 /lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes'
5258 |%
59+```
5360
54−
55−***
61+---
5662### `++ind`
5763
5864Parse suffix
@@ -69,13 +75,17 @@ A `unit`.
6975
7076#### Source
7177
72− ++ ind ~/ %ind
78+```
79+ ++ ind ~/ %ind
7380 |= a=@tas
7481 =+ b=0
7582 |- ^- (unit @)
7683 ?:(=(256 b) ~ ?:(=(a (tod b)) [~ b] $(b +(b))))
84+```
85+
7786#### Examples
7887
88+```
7989 > (ind:po 'zod')
8090 [~ u=0]
8191
@@ -84,8 +94,9 @@ A `unit`.
8494
8595 > (ind:po 'del')
8696 [~ u=37]
97+```
8798
88−***
99+---
89100### `++ins`
90101
91102Parse prefix
@@ -102,14 +113,17 @@ A `unit` of an atom.
102113
103114#### Source
104115
105− ++ ins ~/ %ins
116+```
117+ ++ ins ~/ %ins
106118 |= a=@tas
107119 =+ b=0
108120 |- ^- (unit @)
109121 ?:(=(256 b) ~ ?:(=(a (tos b)) [~ b] $(b +(b))))
122+```
110123
111124#### Examples
112125
126+```
113127 > (ins:po 'mar')
114128 [~ u=1]
115129
@@ -121,8 +135,9 @@ A `unit` of an atom.
121135
122136 > (ins:po 'pok')
123137 ~
138+```
124139
125−***
140+---
126141### `++tod`
127142
128143Fetch suffix
@@ -139,11 +154,14 @@ An atom.
139154
140155#### Source
141156
142− ++ tod ~/ %tod
157+```
158+ ++ tod ~/ %tod
143159 |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] dex)))
160+```
144161
145162#### Examples
146163
164+```
147165 > `@t`(tod:po 1)
148166 'nec'
149167
@@ -161,8 +179,9 @@ An atom.
161179
162180 > `@t`(tod:po 256)
163181 ! exit
182+```
164183
165−***
184+---
166185### `++tos`
167186
168187Fetch prefix
@@ -179,11 +198,14 @@ An atom.
179198
180199#### Source
181200
182− ++ tos ~/ %tos
201+```
202+ ++ tos ~/ %tos
183203 |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] sis)))
204+```
184205
185206#### Examples
186207
208+```
187209 > `@t`(tos:po 0)
188210 'doz'
189211
@@ -195,5 +217,6 @@ An atom.
195217
196218 > `@t`(tos:po 253)
197219 'mat'
220+```
198221
199−***
222+---
docs/reference/library/4b.umd+247−229
@@ -1,18 +1,26 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'29'
3+ title/'4b: Text Processing'
4+ ==
45
6+;>
57
68# 4b: text processing
9+
710### `++at`
811
12+```
913 ++ at
10− |_ a/@
14+ |_ a=@
15+```
1116
1217XX document
1318
19+
20+
1421### `++r`
1522
23+```
1624 ++ r
1725 ?: ?& (gte (met 3 a) 2)
1826 |-
@@ -27,55 +35,71 @@ XX document
2735 ?: (lte (met 3 a) 2)
2836 rud
2937 rux
30− ::
38+```
39+
3140
3241XX document
3342
3443### `++rf`
3544
45+```
3646 ++ rf `tape`[?-(a $& '&', $| '|', * !!) ~]
47+```
3748
3849
3950XX document
4051
4152### `++rn`
4253
54+```
4355 ++ rn `tape`[?>(=(0 a) '~') ~]
56+```
4457
4558XX document
4659
4760### `++rt`
4861
62+```
4963 ++ rt `tape`['\'' (weld (mesc (trip a)) `tape`['\'' ~])]
64+```
5065
5166XX document
5267
5368### `++rta`
5469
70+```
5571 ++ rta rt
72+```
5673
5774XX document
5875
5976### `++rtam`
6077
78+```
6179 ++ rtam `tape`['%' (trip a)]
80+```
6281
6382XX document
6483
6584### `++rub`
6685
86+```
6787 ++ rub `tape`['0' 'b' (rum 2 ~ |=(b/@ (add '0' b)))]
88+```
6889
6990XX document
7091
7192### `++rud`
7293
94+```
7395 ++ rud (rum 10 ~ |=(b/@ (add '0' b)))
96+```
7497
7598XX document
7699
77100### `++rum`
78101
102+```
79103 ++ rum
80104 |= {b/@ c/tape d/$-(@ @)}
81105 ^- tape
@@ -92,12 +116,13 @@ XX document
92116 e +(e)
93117 ==
94118 ::
95−
119+```
96120
97121XX document
98122
99123### `++rup`
100124
125+```
101126 ++ rup
102127 =+ b=(met 3 a)
103128 ^- tape
@@ -120,11 +145,13 @@ XX document
120145 =+ d=(end 3 2 a)
121146 (weld ^$(a c, b (met 3 c)) `tape`['-' $(a (mix c d), b 2)])
122147 ::
148+```
123149
124150XX document
125151
126152### `++ruv`
127153
154+```
128155 ++ ruv
129156 ^- tape
130157 :+ '0'
@@ -139,21 +166,24 @@ XX document
139166 '-'
140167 ?:((lth b 26) (add 65 b) ?:((lth b 52) (add 71 b) (sub b 4)))
141168 ::
169+```
142170
143171XX document
144172
145173### `++rux`
146174
175+```
147176 ++ rux `tape`['0' 'x' (rum 16 ~ |=(b/@ (add b ?:((lth b 10) 48 87))))]
148177 --
149178 :::::::::::::::::::::::::::::::::::::::::::::::::::::: ::
179+```
150180
151181XX document
152182
153−------------------------------------------------------------------------
183+---
154184
155185
156−***
186+---
157187
158188### `++cass`
159189
@@ -161,71 +191,74 @@ To lowercase
161191
162192Produce the case insensitive (all lowercase) [`++cord`]() of a [`++tape`]().
163193
164−Accepts
165−-------
194+#### Accepts
166195
167196`vib` is a `++tape`.
168197
169−Produces
170−--------
198+#### Produces
171199
172200A `++cord`.
173201
174−Source
175−------
202+#### Source
176203
204+```
177205 ++ cass :: lowercase
178206 |= vib/tape
179207 %+ rap 3
180208 (turn vib |=(a/@ ?.(&((gte a 'A') (lte a 'Z')) a (add 32 a))))
209+```
181210
182−Examples
183−--------
211+#### Examples
184212
213+```
185214 > (cass "john doe")
186215 7.309.170.810.699.673.450
216+
187217 > `cord`(cass "john doe")
188218 'john doe'
219+
189220 > (cass "abc, 123, !@#")
190221 2.792.832.775.110.938.439.066.079.945.313
191− > `cord`(cass "abc, 123, !@#")
192− 'abc, 123, !@#'
193222
223+ > `cord`(cass "abc, 123, !@#")
224+ 'abc, 123, !@#'
225+```
194226
195−***
227+---
196228### `++crip`
197229
198230Tape to cord
199231
200232Produce a `++cord` from a `++tape`.
201233
202−Accepts
203−-------
234+#### Accepts
204235
205236`a` is a `++tape`.
206237
207−Produces
208−--------
238+#### Produces
209239
210240A `++cord`.
211241
212−Source
213−------
242+#### Source
214243
244+```
215245 ++ crip |=(a=tape `@t`(rap 3 a)) :: tape to cord
246+```
216247
217−Examples
218−--------
248+#### Examples
219249
250+```
220251 > (crip "john doe")
221252 'john doe'
253+
222254 > (crip "abc 123 !@#")
223255 'abc 123 !@#'
256+
224257 > `@ud`(crip "abc")
225258 6.513.249
259+```
226260
227−
228−***
261+---
229262### `++cuss`
230263
231264To uppercase
@@ -233,59 +266,58 @@ To uppercase
233266Turn all occurances of lowercase letters in any `++tape` into uppercase
234267letters, as a `++cord`.
235268
236−Accepts
237−-------
269+#### Accepts
238270
239271`vib` is a `++tape`.
240272
241−Produces
242−--------
273+#### Produces
243274
244275A `++cord`.
245276
246−Source
247−------
277+#### Source
248278
279+```
249280 ++ cuss :: uppercase
250281 |= vib=tape
251282 ^- @t
252283 %+ rap 3
253284 (turn vib |=(a=@ ?.(&((gte a 'a') (lte a 'z')) a (sub a 32))))
254− ::
285+```
255286
256−Examples
257−--------
287+#### Examples
258288
289+```
259290 > (cuss "john doe")
260291 'JOHN DOE'
292+
261293 > (cuss "abc ABC 123 !@#")
262294 'ABC ABC 123 !@#'
295+
263296 > `@ud`(cuss "abc")
264297 4.407.873
298+
265299 > (cuss "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsQqRrVvWwXxYyZz")
266300 'AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSQQRRVVWWXXYYZZ'
301+```
267302
268−
269−***
303+---
270304### `++mesc`
271305
272306Escape special chars
273307
274308Escape special characters, used in `++show`.
275309
276−Accepts
277−-------
310+#### Accepts
278311
279312`vib` is a `++tape`.
280313
281−Produces
282−--------
314+#### Produces
283315
284316A `++tape`.
285317
286−Source
287−------
318+#### Source
288319
320+```
289321 ++ mesc :: ctrl code escape
290322 |= vib/tape
291323 ^- tape
@@ -296,42 +328,40 @@ Source
296328 ?: ?|((gth i.vib 126) (lth i.vib 32) =(`@`39 i.vib))
297329 ['\\' (welp ~(rux at i.vib) '/' $(vib t.vib))]
298330 [i.vib $(vib t.vib)]
299− ::
331+```
300332
301−Examples
302−--------
333+#### Examples
303334
304− /> (mesc "ham lus")
335+```
336+ > (mesc "ham lus")
305337 "ham lus"
306− /> (mesc "bas\\hur")
338+ > (mesc "bas\\hur")
307339 "bas\\\\hur"
308− /> (mesc "as'saß")
340+ > (mesc "as'saß")
309341 "as\0x27/sa\0xc3/\0x9f/"
342+```
310343
311344
312−
313−***
345+---
314346### `++runt`
315347
316348Prepend `n` times
317349
318350Add `a` repetitions of character `b` to the head of `++tape` `c`.
319351
320−Accepts
321−-------
352+#### Accepts
322353
323354`a` and `b` are atoms.
324355
325356`c` is a `++tape`.
326357
327−Produces
328−--------
358+#### Produces
329359
330360A `++tape`.
331361
332−Source
333−------
362+#### Source
334363
364+```
335365 ++ runt :: prepend repeatedly
336366 |= [[a/@ b/@] c/tape]
337367 ^- tape
@@ -339,77 +369,75 @@ Source
339369 c
340370 [b $(a (dec a))]
341371 ::
372+```
342373
343−Examples
344−--------
374+#### Examples
345375
346− /> (runt [2 '/'] "ham")
376+```
377+ > (runt [2 '/'] "ham")
347378 "//ham"
348− /> (runt [10 'a'] "")
379+ > (runt [10 'a'] "")
349380 "aaaaaaaaaa"
381+```
350382
351383
352−
353−***
384+---
354385### `++sand`
355386
356387Soft-cast by odor
357388
358389Soft-cast validity by odor.
359390
360−Accepts
361−-------
391+#### Accepts
362392
363393`a` is a `++span` (`@ta`).
364394
365395`b` is an atom.
366396
367−Produces
368−--------
397+#### Produces
369398
370399A `(unit @)`.
371400
372−Source
373−------
401+#### Source
374402
403+```
375404 ++ sand :: atom sanity
376405 |= a/@ta
377406 |= b/@ ^- (unit @)
378407 ?.(((sane a) b) ~ [~ b])
379408 ::
409+```
380410
381−Examples
382−--------
411+#### Examples
383412
384− /> `(unit @ta)`((sand %ta) 'sym-som')
413+```
414+ > `(unit @ta)`((sand %ta) 'sym-som')
385415 [~ ~.sym-som]
386− /> `(unit @ta)`((sand %ta) 'err!')
416+ > `(unit @ta)`((sand %ta) 'err!')
387417 ~
418+```
388419
389420
390−
391−***
421+---
392422### `++sane`
393423
394424Check odor validity
395425
396426Check validity by odor. Produces a gate.
397427
398−Accepts
399−-------
428+#### Accepts
400429
401430`a` is a `++span` (`@ta`).
402431
403432`b` is an atom.
404433
405−Produces
406−--------
434+#### Produces
407435
408436A boolean.
409437
410−Source
411−------
438+#### Source
412439
440+```
413441 ++ sane :: atom sanity
414442 |= a/@ta
415443 |= b/@ ^- ?
@@ -445,39 +473,38 @@ Source
445473 $(b (rsh 3 len b))
446474 ==
447475 ::
476+```
448477
449−Examples
450−--------
478+#### Examples
451479
452− /> ((sane %tas) %mol)
480+```
481+ > ((sane %tas) %mol)
453482 %.y
454− /> ((sane %tas) 'lam')
483+ > ((sane %tas) 'lam')
455484 %.y
456− /> ((sane %tas) 'more ace')
485+ > ((sane %tas) 'more ace')
457486 %.n
487+```
458488
459489
460−
461−***
490+---
462491### `++teff`
463492
464493UTF8 Length
465494
466495Produces the number of utf8 bytes.
467496
468−Accepts
469−-------
497+#### Accepts
470498
471499`a` is a `@t`.
472500
473−Produces
474−--------
501+#### Produces
475502
476503An atom.
477504
478−Source
479−------
505+#### Source
480506
507+```
481508 |= a/@t ^- @
482509 =+ b=(end 3 1 a)
483510 ~| %bad-utf8
@@ -485,39 +512,38 @@ Source
485512 ?>(=(`@`0 a) 0)
486513 ?> |((gte b 32) =(10 b))
487514 ?:((lte b 127) 1 ?:((lte b 223) 2 ?:((lte b 239) 3 4)))
515+```
488516
489−Examples
490−--------
517+#### Examples
491518
492− /> (teff 'a')
519+```
520+ > (teff 'a')
493521 1
494− /> (teff 'ß')
522+ > (teff 'ß')
495523 2
524+```
496525
497526
498−
499−***
527+---
500528### `++trim`
501529
502530Tape split
503531
504532Split first `a` characters off `++tape` `b`.
505533
506−Accepts
507−-------
534+#### Accepts
508535
509536`a` is an atom.
510537
511538`b` is a `++tape`.
512539
513−Produces
514−--------
540+#### Produces
515541
516542A cell of `++tape`s, `p` and `q`.
517543
518−Source
519−------
544+#### Source
520545
546+```
521547 ++ trim :: 31-bit nonzero
522548 |= key/@
523549 =+ syd=0xcafe.babe
@@ -527,38 +553,36 @@ Source
527553 ?.(=(0 ham) ham $(syd +(syd)))
528554 --
529555 ::
556+```
530557
558+#### Examples
531559
532−Examples
533−--------
534−
535− /> (trim 5 "lasok termun")
560+```
561+ > (trim 5 "lasok termun")
536562 [p="lasok" q=" termun"]
537− /> (trim 5 "zam")
563+ > (trim 5 "zam")
538564 [p="zam" q=""]
565+```
539566
540567
541−
542−***
568+---
543569### `++trip`
544570
545571Cord to tape
546572
547573Produce a `++tape` from `++cord`.
548574
549−Accepts
550−-------
575+#### Accepts
551576
552577`a` is an atom.
553578
554−Produces
555−--------
579+#### Produces
556580
557581A `++tape`.
558582
559−Source
560−------
583+#### Source
561584
585+```
562586 ++ trip :: cord to tape
563587 ~/ %trip
564588 |= a/@ ^- tape
@@ -566,94 +590,92 @@ Source
566590 ~
567591 [^-(@ta (end 3 1 a)) $(a (rsh 3 1 a))]
568592 ::
593+```
569594
595+#### Examples
570596
571−Examples
572−--------
573−
574− /> (trip 'john doe')
597+```
598+ > (trip 'john doe')
575599 "john doe"
576− /> (trip 'abc 123 !@#')
600+ > (trip 'abc 123 !@#')
577601 "abc 123 !@#"
578− /> (trip 'abc')
602+ > (trip 'abc')
579603 "abc"
604+```
580605
581606
582−
583−***
607+---
584608### `++tuba`
585609
586610UTF8 to UTF32 tape
587611
588612Convert `++tape` to a `++list` of codepoints (`@c`).
589613
590−Accepts
591−-------
614+#### Accepts
592615
593616`a` is a `++tape`.
594617
595−Produces
596−--------
618+#### Produces
597619
598620A `++list` of codepoints `@c`.
599621
600−Source
601−------
622+#### Source
602623
624+```
603625 ++ tuba :: utf8 to utf32 tape
604626 |= a/tape
605627 ^- (list @c)
606628 (rip 5 (turf (rap 3 a))) :: XX horrible
607629 ::
630+```
608631
609−Examples
610−--------
632+#### Examples
611633
612− /> (tuba "я тут")
634+```
635+ > (tuba "я тут")
613636 ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.]
614− /> (tuba "chars")
637+ > (tuba "chars")
615638 ~[~-c ~-h ~-a ~-r ~-s]
639+```
616640
617641
618−
619−***
642+---
620643### `++tufa`
621644
622645UTF32 to UTF8 tape
623646
624647Wrap a `++list` of utf32 codepoints into a utf8 `++tape`.
625648
626−Accepts
627−-------
649+#### Accepts
628650
629651`a` is a `++list` of `@c`.
630652
631−Produces
632−--------
653+#### Produces
633654
634655A `++tape`.
635656
636−Source
637−------
657+#### Source
638658
659+```
639660 ++ tufa :: utf32 to utf8 tape
640661 |= a=(list @c)
641662 ^- tape
642663 ?~ a ""
643664 (weld (rip 3 (tuft i.a)) $(a t.a))
644665 ::
666+```
645667
646−Examples
647−--------
668+#### Examples
648669
649− /> (tufa ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.])
670+```
671+ > (tufa ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.])
650672 "я тут"
651− /> (tufa ((list @c) ~[%a %b 0xb1 %c]))
673+ > (tufa ((list @c) ~[%a %b 0xb1 %c]))
652674 "ab±c"
675+```
653676
654677
655−
656−***
678+---
657679### `++tuft`
658680
659681UTF32 to UTF8 text
@@ -661,19 +683,17 @@ UTF32 to UTF8 text
661683Convert utf32 glyph to
662684LSB utf8 `++cord`.
663685
664−Accepts
665−-------
686+#### Accepts
666687
667688`a` is a codepoint (`@c`).
668689
669−Produces
670−--------
690+#### Produces
671691
672692A `++cord`.
673693
674−Source
675−------
694+#### Source
676695
696+```
677697 ++ tuft :: utf32 to utf8 text
678698 |= a/@c
679699 ^- @t
@@ -702,38 +722,36 @@ Source
702722 (mix 0b1000.0000 (end 0 6 b))
703723 c
704724 ==
705− ::
725+```
706726
707−Examples
708−--------
727+#### Examples
709728
710− /> (tuft `@c`%a)
729+```
730+ > (tuft `@c`%a)
711731 'a'
712− /> (tuft `@c`0xb6)
732+ > (tuft `@c`0xb6)
713733 '¶'
734+```
714735
715736
716−
717−***
737+---
718738### `++turf`
719739
720740UTF8 to UTF32 cord
721741
722742Convert utf8 (`++cord`) to utf32 codepoints.
723743
724−Accepts
725−-------
744+#### Accepts
726745
727746`a` is a `@t`.
728747
729−Produces
730−--------
748+#### Produces
731749
732750A `@c`, UTF-32 codepoint.
733751
734−Source
735−------
752+#### Source
736753
754+```
737755 ++ turf :: utf8 to utf32
738756 |= a/@t
739757 ^- @c
@@ -755,43 +773,42 @@ Source
755773 ?. =((tuft c) (end 3 b a)) ~|(%bad-utf8 !!)
756774 [c $(a (rsh 3 b a))]
757775 ::
776+```
758777
759−Examples
760−--------
778+#### Examples
761779
762− /> (turf 'my ßam')
780+```
781+ > (turf 'my ßam')
763782 ~-my.~df.am
764− /> 'я тут'
783+ > 'я тут'
765784 'я тут'
766− /> (turf 'я тут')
785+ > (turf 'я тут')
767786 ~-~44f..~442.~443.~442.
768− /> `@ux`'я тут'
787+ > `@ux`'я тут'
769788 0x82.d183.d182.d120.8fd1
770− /> `@ux`(turf 'я тут')
789+ > `@ux`(turf 'я тут')
771790 0x442.0000.0443.0000.0442.0000.0020.0000.044f
791+```
772792
773793
774−
775−***
794+---
776795### `++wack`
777796
778797Coin format encode
779798
780799Escape `++span` `~` as `~~` and `_` as `~-`. Used for printing.
781800
782−Accepts
783−-------
801+#### Accepts
784802
785803`a` is a `++span` (`@ta`).
786804
787−Produces
788−--------
805+#### Produces
789806
790807A `++span` (`@ta`).
791808
792−Source
793−------
809+#### Source
794810
811+```
795812 ++ wack :: coin format
796813 |= a/@ta
797814 ^- @ta
@@ -804,41 +821,42 @@ Source
804821 ?: =('_' i.b) ['~' '-' $(b t.b)]
805822 [i.b $(b t.b)]
806823 ::
824+```
807825
808−Examples
809−--------
826+#### Examples
810827
811− /> (wack '~20_sam~')
828+```
829+ > (wack '~20_sam~')
812830 ~.~~20~-sam~~
813− /> `@t`(wack '~20_sam~')
831+
832+ > `@t`(wack '~20_sam~')
814833 '~~20~-sam~~'
834+
815835 > ~(rend co %many ~[`ud/5 `ta/'~20_sam'])
816836 "._5_~~.~~20~-sam__"
837+
817838 > ._5_~~.~~20~-sam__
818839 [5 ~.~20_sam]
840+```
819841
820−
821−
822−***
842+---
823843### `++wick`
824844
825845Coin format decode
826846
827847Unescape `++span` `~~` as `~` and `~-` as `_`.
828848
829−Accepts
830−-------
849+#### Accepts
831850
832851`a` is a an atom.
833852
834−Produces
835−--------
853+#### Produces
836854
837855A `++span` `@ta`.
838856
839−Source
840−------
857+#### Source
841858
859+```
842860 ++ wick :: knot format
843861 |= a/@
844862 ^- (unit @ta)
@@ -856,37 +874,37 @@ Source
856874 @ [b ~]
857875 ==
858876 ::
877+```
859878
860−Examples
861−--------
879+#### Examples
862880
863− /> `@t`(wick '~-ams~~lop')
881+```
882+ > `@t`(wick '~-ams~~lop')
864883 '_ams~lop'
865− /> `@t`(wick (wack '~20_sam~'))
866− '~20_sam~'
867884
885+ > `@t`(wick (wack '~20_sam~'))
886+ '~20_sam~'
887+```
868888
869889
870−***
890+---
871891### `++woad`
872892
873893Unescape cord
874894
875895Unescape `++cord` codepoints.
876896
877−Accepts
878−-------
897+#### Accepts
879898
880899`a` is a `@ta`.
881900
882−Produces
883−--------
901+#### Produces
884902
885903A `++cord`.
886904
887−Source
888−------
905+#### Source
889906
907+```
890908 ++ woad :: cord format
891909 |= a/@ta
892910 ^- @t
@@ -920,35 +938,34 @@ Source
920938 $'~' ['~' $(a c)]
921939 ==
922940 ::
941+```
923942
924−Examples
925−--------
943+#### Examples
926944
927− /> (woad ~.~b6.20.as)
945+```
946+ > (woad ~.~b6.20.as)
928947 '¶20 as'
948+```
929949
930950
931−
932−***
951+---
933952### `++wood`
934953
935954Escape cord
936955
937956Escape `++cord` codepoints.
938957
939−Accepts
940−-------
958+#### Accepts
941959
942960`a` is a `++span` (`@ta`).
943961
944−Produces
945−--------
962+#### Produces
946963
947964A `++span` (`@ta`).
948965
949−Source
950−------
966+#### Source
951967
968+```
952969 ++ wood :: cord format
953970 |= a/@t
954971 ^- @ta
@@ -974,12 +991,13 @@ Source
974991 =+ f=(rsh 2 e c)
975992 [(add ?:((lte f 9) 48 87) f) $(c (end 2 e c))]
976993 ::
994+```
977995
978−Examples
979−--------
996+#### Examples
980997
981− /> (wood 'my ßam')
998+```
999+ > (wood 'my ßam')
9821000 ~.my.~df.am
1001+```
9831002
984−
985−***
1003+---
docs/reference/library/4c.umd+69−63
@@ -1,51 +1,54 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'30'
3+ title/'4c: Tank Printer'
4+ ==
45
6+;>
57
68# 4c: tank printer
9+
710### `++re`
811
912Pretty-printing engine
1013
1114Pretty-printing engine that accepts a `++tank` sample and contains arms that perform computation on it.
1215
13−Accepts
14−-------
16+#### Accepts
1517
1618`tac` is a `++tank`.
1719
18−Produces
19−--------
20+#### Produces
2021
22+```
2123 ++ re
2224 |_ tac/tank
25+```
2326
24−Examples
25−--------
27+#### Examples
2628
27− /> ~(. re leaf+"ham")
29+```
30+ > ~(. re leaf+"ham")
2831 <2.gdc {tac/{$leaf ""} <402.arm 110.jyx 1.ztu $151>}>
32+```
2933
34+---
3035### `++ram`
3136
3237Flatten to tape
3338
3439Flatten `++tank` out into a `++tape`.
3540
36−Accepts
37−-------
41+#### Accepts
3842
3943`tac` is a `++tank`, taken from sample of `++re` core.
4044
41−Produces
42−--------
45+#### Produces
4346
4447A `++tape`.
4548
46−Source
47−------
49+#### Source
4850
51+```
4952 ++ ram
5053 ^- tape
5154 ?- -.tac
@@ -61,36 +64,36 @@ Source
6164 (weld ram(tac i.q.tac) ?~(t.q.tac voz (weld p.p.tac voz)))
6265 ==
6366 ::
67+```
6468
65−Examples
66−--------
69+#### Examples
6770
68− /> ~(ram re leaf+"foo")
71+```
72+ > ~(ram re leaf+"foo")
6973 "foo"
70− /> ~(ram re rose+["." "(" ")"]^~[leaf+"bar" leaf+"baz" leaf+"bam"])
74+ > ~(ram re rose+["." "(" ")"]^~[leaf+"bar" leaf+"baz" leaf+"bam"])
7175 "(bar.baz.bam)"
72−
76+```
77+---
7378### `++win`
7479
7580Render at indent
7681
7782Render at indent level `tab` and width `edg`.
7883
79−Accepts
80−-------
84+#### Accepts
8185
8286`tac` is a `++tank`, taken from sample of `++re` core.
8387
8488`tab` and `edg` are atoms.
8589
86−Produces
87−--------
90+#### Produces
8891
8992A `++wall` (`++list` of `++tapes`).
9093
91−Source
92−------
94+#### Source
9395
96+```
9497 ++ win
9598 |= {tab/@ edg/@}
9699 =+ lug=`wall`~
@@ -117,36 +120,39 @@ Source
117120 ==
118121 (wig(lug qyr) q.p.tac)
119122 ::
123+```
120124
121−Examples
122−--------
125+#### Examples
123126
124− /> (~(win re leaf+"samoltekon-lapdok") 0 20)
127+```
128+ > (~(win re leaf+"samoltekon-lapdok") 0 20)
125129 <<"samoltekon-lapdok">>
126− /> (~(win re leaf+"samoltekon-lapdok") 0 10)
130+
131+ > (~(win re leaf+"samoltekon-lapdok") 0 10)
127132 <<"\/samolt\/" " ekon-l" " apdok" "\/ \/">>
128− /> (~(win re rose+["--" "[" "]"]^~[leaf+"1423" leaf+"2316"]) 0 20)
133+
134+ > (~(win re rose+["--" "[" "]"]^~[leaf+"1423" leaf+"2316"]) 0 20)
129135 <<"[1423--2316]">>
130− /> (~(win re rose+["--" "[" "]"]^~[leaf+"1423" leaf+"2316"]) 0 10)
136+
137+ > (~(win re rose+["--" "[" "]"]^~[leaf+"1423" leaf+"2316"]) 0 10)
131138 <<"[ 1423" " 2316" "]">>
139+```
132140
141+---
133142### `++din`
134143
135144XX document
136145
137−Accepts
138−-------
146+#### Accepts
139147
140−Produces
141−--------
148+#### Produces
142149
143−Source
144−------
150+#### Source
145151
146152 ++ din (mod (add 2 tab) (mul 2 (div edg 3)))
147153
148154
149−----------------------------------------------------------------------
155+---
150156
151157### `++fit`
152158
@@ -154,25 +160,21 @@ Fit on one line test
154160
155161Determine whether `tac` fits on one line. Internal to `++win`
156162
157−Accepts
158−-------
163+#### Accepts
159164
160−Produces
161−--------
165+#### Produces
162166
163−Source
164−------
167+#### Source
165168
166169++ fit (lte (lent ram) (sub edg tab))
167170
168171
169−Examples
170−--------
172+#### Examples
171173
172174
173175
174176
175−----------------------------------------------------------------------
177+---
176178
177179### `++rig`
178180
@@ -181,21 +183,19 @@ Wrap in `\/`
181183Wrap `++tape` in `\/` if it doesn't fit at current indentation. Internal to
182184`++win`
183185
184−Accepts
185−-------
186+#### Accepts
186187
187188`tac` is a `++tank`, taken from sample of `++re` core.
188189
189190`hom` is a `++tape`.
190191
191−Produces
192−--------
192+#### Produces
193193
194194A `++wall` (list of `++tape`s).
195195
196−Source
197−------
196+#### Source
198197
198+```
199199 ++ rig
200200 |= hom/tape
201201 ^- wall
@@ -214,26 +214,26 @@ Source
214214 => .(mut (trim (sub edg tab) hom))
215215 [(runt [tab ' '] p.mut) $(hom q.mut)]
216216 ::
217+```
217218
218−Examples
219−--------
219+#### Examples
220220
221+---
221222### `++wig`
222223
223224`++win` render tape
224225
225226Render `++tape`. Internal to `++win`.
226227
227−Accepts
228−-------
228+#### Accepts
229229
230230`tac` is a `++tank`, taken from sample of `++re` core.
231231
232232`hom` is a `++tape`.
233233
234−Produces
235−--------
234+#### Produces
236235
236+```
237237 ++ wig
238238 |= hom/tape
239239 ^- wall
@@ -249,13 +249,14 @@ Produces
249249 [(runt [tab ' '] (weld hom `tape`[' ' (slag wug i.lug)])) t.lug]
250250 --
251251 --
252+```
252253
253254
254255
255−
256−***
256+---
257257### `++show`
258258
259+```
259260 ++ show :: XX deprecated, use span
260261 |= vem/*
261262 |^ ^- tank
@@ -312,11 +313,13 @@ Produces
312313 {s/$z c/*} $(vem [[%r %$ %$ %$] c.vem])
313314 * !!
314315 ==
316+```
315317
316318XX document
317319
318320### `++shep`
319321
322+```
320323 ++ shep
321324 |= {fom/@ gar/*}
322325 ^- tank
@@ -334,11 +337,13 @@ XX document
334337 ['\\' '#' $(i (add 2 i))]
335338 (weld ~(ram re (show d -.gar)) $(i (add 2 i), gar +.gar))
336339 ::
340+```
337341
338342XX document
339343
340344### `++shop`
341345
346+```
342347 ++ shop
343348 |= {aug/* vel/$-(a/@ tape)}
344349 ^- tank
@@ -352,6 +357,7 @@ XX document
352357 [^$ ~]
353358 [^$(aug -.aug) $(aug +.aug)]
354359 ::
360+```
355361
356362
357363XX document
docs/reference/library/4d.umd+16−9
@@ -1,6 +1,9 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'31'
3+ title/'4d: Parsing (Tracing)'
4+ ==
5+
6+;>
47
58
69# 4d: parsing (tracing)
@@ -24,15 +27,17 @@ A `hair`.
2427
2528#### Source
2629
27− ++ last |= [zyc=hair naz=hair]
30+```
31+ ++ last |= [zyc=hair naz=hair]
2832 ^- hair
2933 ?: =(p.zyc p.naz)
3034 ?:((gth q.zyc q.naz) zyc naz)
3135 ?:((gth p.zyc p.naz) zyc naz)
32−
36+```
3337
3438#### Examples
3539
40+```
3641 > (last [1 1] [1 2])
3742 [p=1 q=2]
3843
@@ -44,7 +49,7 @@ A `hair`.
4449
4550 > (last [7 7] [7 7])
4651 [p=7 q=7]
47−
52+```
4853
4954***
5055### `lust`
@@ -66,14 +71,16 @@ A hair.
6671
6772#### Source
6873
69− ++ lust |= [weq=char naz=hair]
74+```
75+ ++ lust |= [weq=char naz=hair]
7076 ^- hair
7177 ?:(=(`@`10 weq) [+(p.naz) 1] [p.naz +(q.naz)])
72−
78+```
7379
7480
7581#### Examples
7682
83+```
7784 > (lust `a` [1 1])
7885 [p=1 q=2]
7986
@@ -92,6 +99,6 @@ A hair.
9299 lokes
93100 """
94101 [2 6]
95−
102+```
96103
97104***
docs/reference/library/4e.umd+117−105
@@ -1,9 +1,12 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'32'
3+ title/'4e: Parsing (Combinators)'
4+ ==
45
6+;>
57
68# 4e: parsing (combinators)
9+
710### `++bend`
811
912Conditional composer
@@ -14,8 +17,7 @@ result. If there is no suffix, or if the suffix fails to be composed
1417with the current result, the current result is produced. Used to map a
1518group of rules to a specified output.
1619
17−Accepts
18−-------
20+#### Accepts
1921
2022`raq` is a gate.
2123
@@ -23,14 +25,13 @@ Accepts
2325
2426`vex` is an edge.
2527
26−Produces
27−--------
28+#### Produces
2829
2930A `++rule`.
3031
31−Source
32−------
32+#### Source
3333
34+```
3435 ++ bend :: conditional comp
3536 ~/ %bend
3637 |* raq/_|*({a/* b/*} [~ u=[a b]])
@@ -47,27 +48,33 @@ Source
4748 [p=yur q=q.vex]
4849 [p=yur q=[~ u=[p=u.vux q=q.u.q.yit]]]
4950 ::
51+```
5052
51−Examples
52−--------
53+#### Examples
5354
55+```
5456 > (;~((bend |=([a/char b/char] ?.(=(a b) ~ (some +(a))))) prn prn) [1 1] "qs")
5557 [p=[p=1 q=3] q=[~ u=[p=~~q q=[p=[p=1 q=2] q="s"]]]]
58+
5659 > (;~((bend |=([a/char b/char] ?.(=(a b) ~ (some +(a))))) prn prn) [1 1] "qqq")
5760 [p=[p=1 q=3] q=[~ u=[p=~~r q=[p=[p=1 q=3] q="q"]]]]
61+
5862 > (scan "aa" ;~((bend |=([a/char b/char] ?.(=(a b) ~ (some +(a))))) prn prn))
5963 ~~b
64+
6065 > (scan "ba" ;~((bend |=([a/char b/char] ?.(=(a b) ~ (some +(a))))) prn prn))
6166 ! {1 3}
6267 ! exit
68+
6369 > `(unit @tas)`(scan "" ;~((bend) (easy ~) sym))
6470 ~
71+
6572 > `(unit @tas)`(scan "sep" ;~((bend) (easy ~) sym))
6673 [~ %sep]
74+```
6775
6876
69−
70−***
77+---
7178### `++comp`
7279
7380Arbitrary compose
@@ -76,8 +83,7 @@ Parsing composer: connects the `++edge` `vex` with a following `++rule` `sab`,
7683combining the contents of `vex` with the result of `sab` using a binary
7784gate `raq`. Used to fold over the results of several `++rules`.
7885
79−Accepts
80−-------
86+#### Accepts
8187
8288`raq` is a gate that accepts a cell of two nouns, `a` and `b`, and
8389produces a cell of two nouns.
@@ -86,14 +92,13 @@ produces a cell of two nouns.
8692
8793`vex` is an edge.
8894
89−Produces
90−--------
95+#### Produces
9196
9297A `++rule`.
9398
94−Source
95−------
99+#### Source
96100
101+```
97102 ++ comp
98103 ~/ %comp
99104 |* raq/_|*({a/* b/*} [a b]) :: arbitrary compose
@@ -108,17 +113,19 @@ Source
108113 [p=yur q=q.yit]
109114 [p=yur q=[~ u=[p=(raq p.u.q.vex p.u.q.yit) q=q.u.q.yit]]]
110115 ::
116+```
111117
112−Examples
113−--------
118+#### Examples
114119
120+```
115121 > (scan "123" ;~((comp |=([a/@u b/@u] (add a b))) dit dit dit))
116122 6
117123 > (scan "12" ;~((comp |=([a/@u b/@u] (add a b))) dit dit dit))
118124 ! {1 3}
119125 ! exit
126+```
120127
121−***
128+---
122129### `++fail`
123130
124131Never parse
@@ -126,32 +133,32 @@ Never parse
126133Produces an `++edge` at the same text position (`++hair`) with a failing
127134result (`q=~`).
128135
129−Accepts
130−-------
136+#### Accepts
131137
132138`tub` is a `++nail`.
133139
134−Produces
135−--------
140+#### Produces
136141
137142An `++edge`.
138143
139−Source
140−------
144+#### Source
141145
146+```
142147 ++ fail |=(tub/nail [p=p.tub q=~]) :: never parse
148+```
143149
144−Examples
145−--------
150+#### Examples
146151
152+```
147153 > (fail [[1 1] "abc"])
148154 [p=[p=1 q=1] q=~]
155+
149156 > (fail [[p=1.337 q=70] "Parse me, please?"])
150157 [p=[p=1.337 q=70] q=~]
158+```
151159
152160
153−
154−***
161+---
155162### `++glue`
156163
157164Skip delimiter
@@ -160,8 +167,7 @@ Parsing composer: connects an `++edge` `vex` with a following `++rule` `sab` by
160167parsing the `++rule` `bus` (the delimiting symbol) and throwing out the
161168result.
162169
163−Accepts
164−-------
170+#### Accepts
165171
166172`bus` is a `++rule`.
167173
@@ -169,14 +175,13 @@ Accepts
169175
170176`vex` is an `++edge`.
171177
172−Produces
173−--------
178+#### Produces
174179
175180
176181
177−Source
178−------
182+#### Source
179183
184+```
180185 ++ glue :: add rule
181186 ~/ %glue
182187 |* bus/rule
@@ -184,22 +189,25 @@ Source
184189 |* {vex/edge sab/rule}
185190 (plug vex ;~(pfix bus sab))
186191 ::
192+```
187193
188−Examples
189−--------
194+#### Examples
190195
196+```
191197 > (scan "200|mal|bon" ;~((glue bar) dem sym sym))
192198 [q=200 7.102.829 7.237.474]
199+
193200 > `[@u @tas @tas]`(scan "200|mal|bon" ;~((glue bar) dem sym sym))
194201 [200 %mal %bon]
202+
195203 > (scan "200|;|bon" ;~((glue bar) dem sem sym))
196204 [q=200 ~~~3b. 7.237.474]
205+
197206 > (scan "200.;.bon" ;~((glue dot) dem sem sym))
198207 [q=200 ~~~3b. 7.237.474]
208+```
199209
200−
201−
202−***
210+---
203211### `++less`
204212
205213Parse unless
@@ -207,21 +215,19 @@ Parse unless
207215Parsing composer: if an `++edge` `vex` reflects a success, fail. Otherwise,
208216connect `vex` with the following `++rule`.
209217
210−Accepts
211−-------
218+#### Accepts
212219
213220`sab` is a `++rule`.
214221
215222`vex` is an `++edge`.
216223
217−Produces
218−--------
224+#### Produces
219225
220226
221227
222−Source
223−------
228+#### Source
224229
230+```
225231 ++ less :: no first and second
226232 |* {vex/edge sab/rule}
227233 ?~ q.vex
@@ -229,22 +235,25 @@ Source
229235 [p=(last p.vex p.roq) q=q.roq]
230236 (fail +<.sab)
231237 ::
238+```
232239
233−Examples
234−--------
240+#### Examples
235241
242+```
236243 > (scan "sas-/lo" (star ;~(less lus bar prn)))
237244 "sas-/lo"
245+
238246 > (scan "sas-/l+o" (star ;~(less lus bar prn)))
239247 ! {1 8}
240248 ! exit
249+
241250 > (scan "sas|-/lo" (star ;~(less lus bar prn)))
242251 ! {1 5}
243252 ! exit
253+```
244254
245255
246−
247−***
256+---
248257### `++pfix`
249258
250259Discard first rule
@@ -252,34 +261,34 @@ Discard first rule
252261Parsing composer: connects an `++edge` `vex` with two subsequent `++rule`s,
253262ignoring the result of the first and producing the result of the second.
254263
255−Accepts
256−-------
264+#### Accepts
257265
258266`vex` is an edge.
259267
260−Produces
261−--------
268+#### Produces
262269
263270
264271
265−Source
266−------
272+#### Source
267273
274+```
268275 ++ pfix :: discard first rule
269276 ~/ %pfix
270277 (comp |*({a/* b/*} b))
278+```
271279
272−Examples
273−--------
280+#### Examples
274281
282+```
275283 > `@t`(scan "%him" ;~(pfix cen sym))
276284 'him'
285+
277286 > (scan "+++10" ;~(pfix (star lus) dem))
278287 q=10
288+```
279289
280290
281−
282−***
291+---
283292### `++plug`
284293
285294Parse to tuple
@@ -288,21 +297,19 @@ Parsing composer: connects an `++edge` `vex` with a following `++rule` `sab`, pr
288297a cell of both the results. See also: the monad applicator ;\~ for a
289298more detailed explanation.
290299
291−Accepts
292−-------
300+#### Accepts
293301
294302`sab` is a `++rule`.
295303
296304`vex` is an `++edge`.
297305
298−Produces
299−--------
306+#### Produces
300307
301308
302309
303−Source
304−------
310+#### Source
305311
312+```
306313 ++ plug :: first then second
307314 ~/ %plug
308315 |* {vex/edge sab/rule}
@@ -314,20 +321,23 @@ Source
314321 [p=yur q=q.yit]
315322 [p=yur q=[~ u=[p=[p.u.q.vex p.u.q.yit] q=q.u.q.yit]]]
316323 ::
324+```
317325
318−Examples
319−--------
326+#### Examples
320327
328+```
321329 > (scan "1..20" ;~(plug dem dot dot dem))
322330 [q=1 ~~~. ~~~. q=20]
331+
323332 > (scan "moke/~2014.1.1" ;~(plug sym fas nuck:so))
324333 [1.701.539.693 ~~~2f. [% p=[p=~.da q=170.141.184.500.766.106.671.844.917.172.921.958.400]]]
334+
325335 > ;;(,[@tas @t ~ %da @da] (scan "moke/~2014.1.1" ;~(plug sym fas nuck:so)))
326336 [%moke '/' ~ %da ~2014.1.1]
337+```
327338
328339
329−
330−***
340+---
331341### `++pose`
332342
333343Parse options
@@ -335,21 +345,19 @@ Parse options
335345Parsing composer: if `vex` reflects a failure, connect it with the
336346following rule `sab`. See also: the monad applicator ;\~
337347
338−Accepts
339−-------
348+#### Accepts
340349
341350`sab` is a `++rule`.
342351
343352`vex` is an `++edge`.
344353
345−Produces
346−--------
354+#### Produces
347355
348356
349357
350−Source
351−------
358+#### Source
352359
360+```
353361 ++ pose :: first or second
354362 ~/ %pose
355363 |* {vex/edge sab/rule}
@@ -358,24 +366,27 @@ Source
358366 [p=(last p.vex p.roq) q=q.roq]
359367 vex
360368 ::
369+```
361370
371+#### Examples
362372
363−Examples
364−--------
365−
373+```
366374 > `@t`(scan "+" ;~(pose lus tar cen))
367375 '+'
376+
368377 > `@t`(scan "*" ;~(pose lus tar cen))
369378 '*'
379+
370380 > `@t`(scan "%" ;~(pose lus tar cen))
371381 '%'
382+
372383 > `@t`(scan "-" ;~(pose lus tar cen))
373384 ! {1 1}
374385 ! exit
386+```
375387
376388
377−
378−***
389+---
379390### `++sfix`
380391
381392Discard second rule
@@ -383,37 +394,36 @@ Discard second rule
383394Parsing composer: connects `++edge`s `vex` with two subsequent `++rule`s returning the
384395result of the first and discarding the result of the second.
385396
386−Accepts
387−-------
397+#### Accepts
388398
389399`a` is the result of parsing the first `++rule`.
390400
391401`b` is the result of of parsing the second `++rule`.
392402
393−Produces
394−--------
403+#### Produces
395404
396405
397406
398−Source
399−------
407+#### Source
400408
409+```
401410 ++ sfix :: discard second rule
402411 ~/ %sfix
403412 (comp |*({a/* b/*} a))
413+```
404414
415+#### Examples
405416
406−Examples
407−--------
408−
417+```
409418 > `@t`(scan "him%" ;~(sfix sym cen))
410419 'him'
420+
411421 > (scan "10+++" ;~(sfix dem (star lus)))
412422 q=10
423+```
413424
414425
415−
416−***
426+---
417427### `++simu`
418428
419429First and second
@@ -421,21 +431,19 @@ First and second
421431Parsing composer: if an `++edge` `vex` reflects a failure, fail. Otherwise,
422432connect `vex` with the following `++rule`.
423433
424−Accepts
425−-------
434+#### Accepts
426435
427436`sab` is a `++rule`.
428437
429438`vex` is an `++edge`.
430439
431−Produces
432−--------
440+#### Produces
433441
434442
435443
436−Source
437−------
444+#### Source
438445
446+```
439447 ++ simu :: first and second
440448 |* {vex/edge sab/rule}
441449 ?~ q.vex
@@ -443,20 +451,24 @@ Source
443451 =+ roq=(sab)
444452 roq
445453 ::
454+```
446455
447−Examples
448−--------
456+#### Examples
449457
458+```
450459 > (scan "~zod" scat:vast)
451460 [%dtzy p=%p q=0]
461+
452462 > (scan "%zod" scat:vast)
453463 [%dtzz p=%tas q=6.582.138]
464+
454465 > (scan "%zod" ;~(simu cen scat:vast))
455466 [%dtzz p=%tas q=6.582.138]
467+
456468 > (scan "~zod" ;~(simu cen scat:vast))
457469 ! {1 1}
458470 ! exit
471+```
459472
460473
461−
462−***
474+---
docs/reference/library/4f.umd+289−268
@@ -1,29 +1,31 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'33'
3+ title/'4f: Parsing (Rule-Builders)'
4+ ==
5+
6+;>
47
58
69# 4f: parsing (rule builders)
10+
711### `++bass`
812
913Parser modifier: LSB
1014ordered `++list` as atom of a `++base`.
1115
12−Accepts
13−-------
16+#### Accepts
1417
1518`wuc` is an atom.
1619
1720`tyd` is a `++rule`.
1821
19−Produces
20−--------
22+#### Produces
2123
2224A `++rule`.
2325
24−Source
25−------
26+#### Source
2627
28+```
2729 ++ bass
2830 |* {wuc/@ tyd/rule}
2931 %+ cook
@@ -33,21 +35,21 @@ Source
3335 =|({p/@ q/@} |.((add p (mul wuc q))))
3436 tyd
3537 ::
38+```
3639
40+#### Examples
3741
38−Examples
39−--------
40−
42+```
4143 > (scan "123" (bass 10 (star dit)))
4244 q=123
4345 > (scan "123" (bass 8 (star dit)))
4446 q=83
4547 > `@ub`(scan "123" (bass 8 (star dit)))
4648 0b101.0011
49+```
4750
4851
49−
50−***
52+---
5153
5254### `++boss`
5355
@@ -55,21 +57,19 @@ Parser modifier: LSB
5557
5658Ordered `++list` as atom of a `++base`.
5759
58−Accepts
59−-------
60+#### Accepts
6061
6162`wuc` is an atom.
6263
6364`tyd` is a `++rule`.
6465
65−Produces
66−--------
66+#### Produces
6767
6868A `++rule`.
6969
70−Source
71−------
70+#### Source
7271
72+```
7373 ++ boss
7474 |* {wuc/@ tyd/rule}
7575 %+ cook
@@ -79,19 +79,22 @@ Source
7979 =|({p/@ q/@} |.((add p (mul wuc q))))
8080 tyd
8181 ::
82+```
83+
84+#### Examples
8285
83−Examples
84−--------
85−
86+```
8687 > (scan "123" (boss 10 (star dit)))
8788 q=321
89+
8890 > `@t`(scan "bam" (boss 256 (star alp)))
8991 'bam'
92+
9093 > `@ux`(scan "bam" (boss 256 (star alp)))
9194 0x6d.6162
95+```
9296
93−
94−***
97+---
9598### `++cold`
9699
97100Replace with constant
@@ -99,21 +102,19 @@ Replace with constant
99102Parser modifier. Accepts a `++rule` `sef` and produces a parser that
100103produces a constant `cus`, assuming `sef` is successful.
101104
102−Accepts
103−-------
105+#### Accepts
104106
105107`cus` is a constant noun.
106108
107109`sef` is a `++rule`.
108110
109−Produces
110−--------
111+#### Produces
111112
112113An `++edge`.
113114
114−Source
115−------
115+#### Source
116116
117+```
117118 ++ cold :: replace w+ constant
118119 ~/ %cold
119120 |* {cus/* sef/rule}
@@ -123,18 +124,20 @@ Source
123124 ?~ q.vex
124125 vex
125126 [p=p.vex q=[~ u=[p=cus q=q.u.q.vex]]]
127+```
126128
127−Examples
128−--------
129+#### Examples
129130
131+```
130132 > ((cold %foo (just 'a')) [[1 1] "abc"])
131133 [p=[p=1 q=2] q=[~ u=[p=%foo q=[p=[p=1 q=2] q="bc"]]]]
134+
132135 > ((cold %foo (just 'a')) [[1 1] "bc"])
133136 [p=[p=1 q=1] q=~]
137+```
134138
135139
136−
137−***
140+---
138141### `++cook`
139142
140143Apply gate
@@ -142,21 +145,19 @@ Apply gate
142145Parser modifier. Produces a parser that takes a (successful) result of a
143146`++rule` `sef` and slams it through `poq`.
144147
145−Accepts
146−-------
148+#### Accepts
147149
148150`poq` is a gate.
149151
150152`sef` is a `++rule`.
151153
152−Produces
153−--------
154+#### Produces
154155
155156An `++rule`.
156157
157−Source
158−------
158+#### Source
159159
160+```
160161 ++ cook :: apply gate
161162 ~/ %cook
162163 |* {poq/gate sef/rule}
@@ -167,22 +168,26 @@ Source
167168 vex
168169 [p=p.vex q=[~ u=[p=(poq p.u.q.vex) q=q.u.q.vex]]]
169170 ::
171+```
170172
171−Examples
172−--------
173+#### Examples
173174
175+```
174176 > ((cook ,@ud (just 'a')) [[1 1] "abc"])
175177 [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]]
178+
176179 > ((cook ,@tas (just 'a')) [[1 1] "abc"])
177180 [p=[p=1 q=2] q=[~ u=[p=%a q=[p=[p=1 q=2] q="bc"]]]]
181+
178182 > ((cook |=(a=@ +(a)) (just 'a')) [[1 1] "abc"])
179183 [p=[p=1 q=2] q=[~ u=[p=98 q=[p=[p=1 q=2] q="bc"]]]]
184+
180185 > ((cook |=(a=@ `@t`+(a)) (just 'a')) [[1 1] "abc"])
181186 [p=[p=1 q=2] q=[~ u=[p='b' q=[p=[p=1 q=2] q="bc"]]]]
187+```
182188
183189
184−
185−***
190+---
186191### `++easy`
187192
188193Always parse
@@ -190,19 +195,17 @@ Always parse
190195Parser generator. Produces a parser that succeeds with given noun `huf`
191196without consuming any text.
192197
193−Accepts
194−-------
198+#### Accepts
195199
196200`huf` is a noun.
197201
198−Produces
199−--------
202+#### Produces
200203
201204A `++rule`.
202205
203−Source
204−------
206+#### Source
205207
208+```
206209 ++ easy :: always parse
207210 ~/ %easy
208211 |* huf=*
@@ -211,20 +214,23 @@ Source
211214 ^- (like ,_huf)
212215 [p=p.tub q=[~ u=[p=huf q=tub]]]
213216 ::
217+```
214218
215−Examples
216−--------
219+#### Examples
217220
221+```
218222 > ((easy %foo) [[1 1] "abc"])
219223 [p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="abc"]]]]
224+
220225 > ((easy %foo) [[1 1] "bc"])
221226 [p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="bc"]]]]
227+
222228 > ((easy 'a') [[1 1] "bc"])
223229 [p=[p=1 q=1] q=[~ [p='a' q=[p=[p=1 q=1] q="bc"]]]]
230+```
224231
225232
226−
227−***
233+---
228234### `++full`
229235
230236Parse to end
@@ -232,76 +238,77 @@ Parse to end
232238Parser modifier. Accepts a `++rule` `sef`, and produces a parser that succeeds only
233239when the of `tub` is fully consumed using `sef`.
234240
235−Accepts
236−-------
241+#### Accepts
237242
238243`sef` is a `++rule`.
239244
240−Produces
241−--------
245+#### Produces
242246
243247A `++rule`.
244248
245−Source
246−------
249+#### Source
247250
248− ++ full :: parse to end
251+```
252+ ++ full :: parse to end
249253 |* sef=_rule
250254 |= tub=nail
251255 =+ vex=(sef tub)
252256 ?~(q.vex vex ?:(=(~ q.q.u.q.vex) vex [p=p.vex q=~]))
253257 ::
258+```
254259
255−Examples
256−--------
260+#### Examples
257261
262+```
258263 > ((full (just 'a')) [[1 1] "ab"])
259264 [p=[p=1 q=2] q=~]
265+
260266 > ((full (jest 'ab')) [[1 1] "ab"])
261267 [p=[p=1 q=3] q=[~ u=[p='ab' q=[p=[p=1 q=3] q=""]]]]
268+
262269 > ((full ;~(plug (just 'a') (just 'b'))) [[1 1] "ab"])
263270 [p=[p=1 q=3] q=[~ u=[p=[~~a ~~b] q=[p=[p=1 q=3] q=""]]]]
271+```
264272
265273
266−
267−***
274+---
268275### `++funk`
269276
270277Add to tape
271278
272279Parser modifier: prepend text to `++tape` before applying parser.
273280
274−Accepts
275−-------
281+#### Accepts
276282
277283`pre` is a `++tape`
278284
279285`sef` is a `++rule`
280286
281−Produces
282−--------
287+#### Produces
283288
284289A `++rule`.
285290
286−Source
287−------
291+#### Source
288292
293+```
289294 ++ funk :: add to tape first
290295 |* {pre/tape sef/rule}
291296 |= tub/nail
292297 (sef p.tub (weld pre q.tub))
298+```
293299
294−Examples
295−--------
300+#### Examples
296301
302+```
297303 > ((funk "abc prefix-" (jest 'abc')) [[1 1] "to be parsed"])
298304 [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=" prefix-to be parsed"]]]]
305+
299306 > ((funk "parse" (just 'a')) [[1 4] " me"])
300307 [p=[p=1 q=4] q=~]
308+```
301309
302310
303−
304−***
311+---
305312### `++here`
306313
307314Place-based apply
@@ -310,21 +317,19 @@ Parser modifier. Similar to `++cook` in that it produces a parser that takes a
310317(successful) result of `sef` and slams it through `hez`. `hez` accepts a
311318`++pint` `a` and a noun `b`, which is what the parser parsed.
312319
313−Accepts
314−-------
320+#### Accepts
315321
316322`hez` is a gate.
317323
318324`sef` is a `++rule`
319325
320−Produces
321−--------
326+#### Produces
322327
323328A `++rule`.
324329
325−Source
326−------
330+#### Source
327331
332+```
328333 ++ here :: place-based apply
329334 ~/ %here
330335 |* {hez/_|=({a/pint b/*} [a b]) sef/rule}
@@ -335,20 +340,23 @@ Source
335340 vex
336341 [p=p.vex q=[~ u=[p=(hez [p.tub p.q.u.q.vex] p.u.q.vex) q=q.u.q.vex]]]
337342 ::
343+```
338344
339−Examples
340−--------
345+#### Examples
341346
347+```
342348 > (scan "abc" (star alf))
343349 "abc"
350+
344351 > (scan "abc" (here |*(^ +<) (star alf)))
345352 [[[p=1 q=1] p=1 q=4] "abc"]
353+
346354 > (scan "abc" (star (here |*(^ +<) alf)))
347355 ~[[[[p=1 q=1] p=1 q=2] ~~a] [[[p=1 q=2] p=1 q=3] ~~b] [[[p=1 q=3] p=1 q=4] ~~c]]
356+```
348357
349358
350−
351−***
359+---
352360### `++ifix`
353361
354362Infix
@@ -356,21 +364,19 @@ Infix
356364Parser modifier: surround with pair of `++rule`s, the output of which is
357365discarded.
358366
359−Accepts
360−-------
367+#### Accepts
361368
362369`fel` is a pair of `++rule`s.
363370
364371`hof` is a `++rule`.
365372
366−Produces
367−--------
373+#### Produces
368374
369375A `++rule`.
370376
371−Source
372−------
377+#### Source
373378
379+```
374380 ++ ifix
375381 |* {fel/{rule rule} hof/rule}
376382 ~! +<
@@ -378,37 +384,37 @@ Source
378384 ~! +<:+.fel
379385 ;~(pfix -.fel ;~(sfix hof +.fel))
380386 ::
387+```
388+
389+#### Examples
381390
382−Examples
383−--------
384−
391+```
385392 > (scan "-40-" (ifix [hep hep] dem))
386393 q=40
394+
387395 > (scan "4my4" (ifix [dit dit] (star alf)))
388396 "my"
397+```
389398
390399
391−
392−***
400+---
393401### `++jest`
394402
395403Match a cord
396404
397405Match and consume a cord.
398406
399−Accepts
400−-------
407+#### Accepts
401408
402409`daf` is a `@t`.
403410
404−Produces
405−--------
411+#### Produces
406412
407413An `++edge`.
408414
409−Source
410−------
415+#### Source
411416
417+```
412418 ++ jest :: match a cord
413419 |= daf/@t
414420 |= tub/nail
@@ -420,45 +426,48 @@ Source
420426 (fail tub)
421427 $(p.tub (lust i.q.tub p.tub), q.tub t.q.tub, daf (rsh 3 1 daf))
422428 ::
429+```
423430
424−Examples
425−--------
431+#### Examples
426432
433+```
427434 > ((jest 'abc') [[1 1] "abc"])
428435 [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=""]]]]
436+
429437 > (scan "abc" (jest 'abc'))
430438 'abc'
439+
431440 > (scan "abc" (jest 'acb'))
432441 ! {1 2}
433442 ! 'syntax-error'
434443 ! exit
444+
435445 > ((jest 'john doe') [[1 1] "john smith"])
436446 [p=[p=1 q=6] q=~]
447+
437448 > ((jest 'john doe') [[1 1] "john doe"])
438449 [p=[p=1 q=9] q=[~ [p='john doe' q=[p=[p=1 q=9] q=""]]]]
450+```
439451
440452
441−
442−***
453+---
443454### `++just`
444455
445456Match a char
446457
447458Match and consume a single character.
448459
449−Accepts
450−-------
460+#### Accepts
451461
452462`daf` is a `++char`
453463
454−Produces
455−--------
464+#### Produces
456465
457466A `++rule`.
458467
459−Source
460−------
468+#### Source
461469
470+```
462471 ++ just :: XX redundant, jest
463472 ~/ %just :: match a char
464473 |= daf/char
@@ -471,25 +480,28 @@ Source
471480 (fail tub)
472481 (next tub)
473482 ::
483+```
474484
485+#### Examples
475486
476−Examples
477−--------
478−
487+```
479488 > ((just 'a') [[1 1] "abc"])
480489 [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
490+
481491 > (scan "abc" (just 'a'))
482492 ! {1 2}
483493 ! 'syntax-error'
484494 ! exit
495+
485496 > (scan "a" (just 'a'))
497+
486498 ~~a
487499 > (scan "%" (just '%'))
488500 ~~~25.
501+```
489502
490503
491−
492−***
504+---
493505### `++knee`
494506
495507Recursive parsers
@@ -497,34 +509,34 @@ Recursive parsers
497509Used for recursive parsers, which would otherwise be infinite when
498510compiled.
499511
500−Accepts
501−-------
512+#### Accepts
502513
503514`gar` is a noun.
504515
505516`sef` is a gate that accepts a `++rule`
506517
507−Produces
508−--------
518+#### Produces
509519
510520A `++rule`.
511521
512−Source
513−------
522+#### Source
514523
524+```
515525 ++ knee :: callbacks
516526 |* {gar/* sef/_|.(*rule)}
517527 |= tub/nail
518528 ^- (like _gar)
519529 ((sef) tub)
520530 ::
531+```
521532
522−Examples
523−--------
533+#### Examples
524534
535+```
525536 > |-(;~(plug prn ;~(pose $ (easy ~))))
526537 ! rest-loop
527538 ! exit
539+
528540 > |-(;~(plug prn ;~(pose (knee *tape |.(^$)) (easy ~))))
529541 < 1.obo
530542 [ c=c=tub=[p=[p=@ud q=@ud] q=""]
@@ -542,10 +554,10 @@ Examples
542554 >
543555 > (scan "abcd" |-(;~(plug prn ;~(pose (knee *tape |.(^$)) (easy ~)))))
544556 [~~a "bcd"]
557+```
545558
546559
547−
548−***
560+---
549561### `++mask`
550562
551563Match char
@@ -553,19 +565,17 @@ Match char
553565Parser generator. Matches the next character if it is in a list of
554566characters.
555567
556−Accepts
557−-------
568+#### Accepts
558569
559570`bud` is a list of `++char`
560571
561−Produces
562−--------
572+#### Produces
563573
564574A `++rule`.
565575
566−Source
567−------
576+#### Source
568577
578+```
569579 ++ mask :: match char in set
570580 ~/ %mask
571581 |= bud/(list char)
@@ -578,120 +588,123 @@ Source
578588 (fail tub)
579589 (next tub)
580590 ::
591+```
581592
582−Examples
583−--------
593+#### Examples
584594
595+```
585596 > (scan "a" (mask "cba"))
586597 ~~a
598+
587599 > ((mask "abc") [[1 1] "abc"])
588600 [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
601+
589602 > ((mask "abc") [[1 1] "bbc"])
590603 [p=[p=1 q=2] q=[~ [p=~~b q=[p=[p=1 q=2] q="bc"]]]]
604+
591605 > ((mask "abc") [[1 1] "dbc"])
592606 [p=[p=1 q=1] q=~]
607+```
593608
594−
595−
596−***
609+---
597610### `++more`
598611
599612Parse list with delimiter
600613
601614Parser modifier: Parse a list of matches using a delimiter `++rule`.
602615
603−Accepts
604−-------
616+#### Accepts
605617
606618`bus` is a `++rule`.
607619
608620`fel` is a `++rule`.
609621
610−Produces
611−--------
622+#### Produces
612623
613624A `++rule`.
614625
615−Source
616−------
626+#### Source
617627
628+```
618629 ++ more
619630 |* {bus/rule fel/rule}
620631 ;~(pose (most bus fel) (easy ~))
621632 ::
633+```
634+
635+#### Examples
622636
623−Examples
624−--------
625−
637+```
626638 > (scan "" (more ace dem))
627639 ~
640+
628641 > (scan "40 20" (more ace dem))
629642 [q=40 ~[q=20]]
643+
630644 > (scan "40 20 60 1 5" (more ace dem))
631645 [q=40 ~[q=20 q=60 q=1 q=5]]
646+```
632647
633648
634−
635−***
649+---
636650### `++most`
637651
638652Parse list of at least one match
639653
640654Parser modifier: parse a `++list` of at least one match using a delimiter `++rule`.
641655
642−Accepts
643−-------
656+#### Accepts
644657
645658`bus` is a `++rule`.
646659
647660`fel` is a `++rule`.
648661
649−Produces
650−--------
662+#### Produces
651663
652664A `++rule`.
653665
654−Source
655−------
666+#### Source
656667
668+```
657669 ++ most
658670 |* {bus/rule fel/rule}
659671 ;~(plug fel (star ;~(pfix bus fel)))
660672 ::
673+```
674+
675+#### Examples
661676
662−Examples
663−--------
664−
677+```
665678 > (scan "40 20" (most ace dem))
666679 [q=40 ~[q=20]]
680+
667681 > (scan "40 20 60 1 5" (most ace dem))
668682 [q=40 ~[q=20 q=60 q=1 q=5]]
683+
669684 > (scan "" (most ace dem))
670685 ! {1 1}
671686 ! exit
687+```
672688
673689
674−
675−***
690+---
676691### `++next`
677692
678693Consume char
679694
680695Consume any character, producing it as a result.
681696
682−Accepts
683−-------
697+#### Accepts
684698
685699`tub` is a `++nail`
686700
687−Produces
688−--------
701+#### Produces
689702
690703An `++edge`.
691704
692−Source
693−------
705+#### Source
694706
707+```
695708 ++ next :: consume a char
696709 |= tub/nail
697710 ^- (like char)
@@ -700,18 +713,20 @@ Source
700713 =+ zac=(lust i.q.tub p.tub)
701714 [zac [~ i.q.tub [zac t.q.tub]]]
702715 ::
716+```
703717
704−Examples
705−--------
718+#### Examples
706719
720+```
707721 > (next [[1 1] "ebc"])
708− [p=[p=1 q=2] q=[~ [p=~~e q=[p=[p=1 q=2] q="bc"]]]]
722+ [p=[p=1 q=2] q=[~ [p=~~e q=[p=[p=1 q=2] q="bc"]]]]
723+
709724 > (next [[1 1] "john jumps jones"])
710725 [p=[p=1 q=2] q=[~ [p=~~j q=[p=[p=1 q=2] q="ohn jumps jones"]]]]
726+```
711727
712728
713−
714−***
729+---
715730
716731### `++plus`
717732
@@ -719,37 +734,38 @@ List of at least one match.
719734
720735Parser modifier: parse `++list` of at least one match.
721736
722−Accepts
723−-------
737+#### Accepts
724738
725739`fel` is a `++rule`.
726740
727−Produces
728−--------
741+#### Produces
729742
730743A `++rule`.
731744
732−Source
733−------
745+#### Source
734746
747+```
735748 ++ plus |*(fel/rule ;~(plug fel (star fel)))
749+```
736750
751+#### Examples
737752
738−Examples
739−--------
740−
753+```
741754 > (scan ">>>>" (cook lent (plus gar)))
742755 4
756+
743757 > (scan "- - " (plus ;~(pose ace hep)))
744758 [~~- " - "]
759+
745760 > `tape`(scan "- - " (plus ;~(pose ace hep)))
746761 "- - "
762+
747763 > `(pole ,@t)`(scan "- - " (plus ;~(pose ace hep)))
748764 ['-' [' ' [' ' ['-' [' ' ~]]]]]
765+```
749766
750767
751−
752−***
768+---
753769### `++sear`
754770
755771Conditional `++cook`
@@ -757,19 +773,17 @@ Conditional `++cook`
757773Conditional `++cook`. Slams the result through a gate that produces
758774a unit; if that unit is empty, fail.
759775
760−Accepts
761−-------
776+#### Accepts
762777
763778`tub` is a `++nail`.
764779
765−Produces
766−--------
780+#### Produces
767781
768782A `++rule`.
769783
770−Source
771−------
784+#### Source
772785
786+```
773787 ++ sear :: conditional cook
774788 |* {pyq/$-(* (unit)) sef/rule}
775789 |= tub/nail
@@ -781,40 +795,39 @@ Source
781795 [p=p.vex q=~]
782796 [p=p.vex q=[~ u=[p=u.gey q=q.u.q.vex]]]
783797 ::
798+```
784799
800+#### Examples
785801
786−Examples
787−--------
788−
802+```
789803 > ((sear |=(a/* ?@(a (some a) ~)) (just `a`)) [[1 1] "abc"])
790804 [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]]
805+
791806 > ((sear |=(* ~) (just 'a')) [[1 1] "abc"])
792807 [p=[p=1 q=2] q=~]
808+```
793809
794810
795−
796−***
811+---
797812### `++shim`
798813
799814Char in range
800815
801816Match characters (`++char`) within a range.
802817
803−Accepts
804−-------
818+#### Accepts
805819
806820`les` is an atom.
807821
808822`mos` is an atom.
809823
810−Produces
811−--------
824+#### Produces
812825
813826A `++rule`.
814827
815−Source
816−------
828+#### Source
817829
830+```
818831 ++ shim :: match char in range
819832 ~/ %shim
820833 |= {les/@ mos/@}
@@ -827,20 +840,23 @@ Source
827840 (fail tub)
828841 (next tub)
829842 ::
843+```
830844
831−Examples
832−--------
845+#### Examples
833846
847+```
834848 > ((shim 'a' 'z') [[1 1] "abc"])
835849 [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
850+
836851 > ((shim 'a' 'Z') [[1 1] "abc"])
837852 [p=[p=1 q=1] q=~]
853+
838854 > ((shim 'a' 'Z') [[1 1] "Abc"])
839855 [p=[p=1 q=2] q=[~ [p=~~~41. q=[p=[p=1 q=2] q="bc"]]]]
856+```
840857
841858
842−
843−***
859+---
844860### `++slug`
845861
846862Use gate to parse delimited list
@@ -848,60 +864,57 @@ Use gate to parse delimited list
848864Parser modifier: By composing with a gate, parse a delimited `++list` of
849865matches.
850866
851−Accepts
852−-------
867+#### Accepts
853868
854869`bus` is a `++rule`.
855870
856871`fel` is a `++rule`.
857872
858−Produces
859−--------
873+#### Produces
860874
861875A `++rule`.
862876
863−Source
864−------
877+#### Source
865878
879+```
866880 ++ slug
867881 |* raq/_|*({a/* b/*} [a b])
868882 |* {bus/rule fel/rule}
869883 ;~((comp raq) fel (stir +<+.raq raq ;~(pfix bus fel)))
870884 ::
885+```
871886
887+#### Examples
872888
873−Examples
874−--------
875−
889+```
876890 > (scan "20+5+110" ((slug add) lus dem))
877891 135
892+
878893 > `@t`(scan "a b c" ((slug |=(a/[@ @t] (cat 3 a))) ace alp))
879894 'abc'
895+```
880896
881897
882−
883−***
898+---
884899### `++stag`
885900
886901Add label
887902
888903Add a label to an edge parsed by a rule.
889904
890−Accepts
891−-------
905+#### Accepts
892906
893907`gob` is a noun.
894908
895909`sef` is a rule.
896910
897−Produces
898−--------
911+#### Produces
899912
900913A `++rule`.
901914
902−Source
903−------
915+#### Source
904916
917+```
905918 ++ stag :: add a label
906919 ~/ %stag
907920 |* {gob/* sef/rule}
@@ -912,78 +925,83 @@ Source
912925 vex
913926 [p=p.vex q=[~ u=[p=[gob p.u.q.vex] q=q.u.q.vex]]]
914927 ::
928+```
915929
916−Examples
917−--------
930+#### Examples
918931
932+```
919933 > ((stag %foo (just 'a')) [[1 1] "abc"])
920934 [p=[p=1 q=2] q=[~ u=[p=[%foo ~~a] q=[p=[p=1 q=2] q="bc"]]]]
935+
921936 > ((stag "xyz" (jest 'abc')) [[1 1] "abc"])
922937 [p=[p=1 q=4] q=[~ u=[p=["xyz" 'abc'] q=[p=[p=1 q=4] q=""]]]]
938+
923939 > ((stag 10.000 (shim 0 100)) [[1 1] "abc"])
924940 [p=[p=1 q=2] q=[~ u=[p=[10.000 ~~a] q=[p=[p=1 q=2] q="bc"]]]]
941+```
925942
926943
927−
928−***
944+---
929945### `++star`
930946
931947List of matches
932948
933949Parser modifier: parse `++list` of matches.
934950
935−Accepts
936−-------
951+#### Accepts
937952
938953`fel` is a `++rule`.
939954
940−Produces
941−--------
955+#### Produces
942956
957+```
943958 ++ star :: 0 or more times
944959 |* fel/rule
945960 (stir `(list _(wonk *fel))`~ |*({a/* b/*} [a b]) fel)
961+```
962+
963+#### Examples
946964
947−Examples
948−--------
949−
965+```
950966 > (scan "aaaaa" (just 'a'))
951967 ! {1 2}
952968 ! 'syntax-error'
953969 ! exit
970+
954971 > (scan "aaaaa" (star (just 'a')))
955972 "aaaaa"
973+
956974 > (scan "abcdef" (star (just 'a')))
957975 ! {1 2}
958976 ! 'syntax-error'
959977 ! exit
978+
960979 > (scan "abcabc" (star (jest 'abc')))
961980 <|abc abc|>
981+
962982 > (scan "john smith" (star (shim 0 200)))
963983 "john smith"
984+```
964985
965986
966−
967−***
987+---
968988### `++stet`
969989
970990Add faces
971991
972992Add faces `[p q]` to range-parser pairs in a list.
973993
974−Accepts
975−-------
994+#### Accepts
976995
977996`leh` is a list of range-parsers.
978997
979−Produces
980−--------
998+#### Produces
981999
9821000
9831001
984−Source
985−------
1002+#### Source
9861003
1004+```
9871005 ++ stet
9881006 |* leh/(list {?(@ {@ @}) rule})
9891007 |-
@@ -991,11 +1009,12 @@ Source
9911009 ~
9921010 [i=[p=-.i.leh q=+.i.leh] t=$(leh t.leh)]
9931011 ::
1012+```
9941013
995−Examples
996−--------
1014+#### Examples
9971015
998− > (stet (limo [[5 (just 'a')] [1 (jest 'abc')] [[1 1] (shim 0 200)]
1016+```
1017+ > (stet (limo [[5 (just 'a')] [1 (jest 'abc')] [[1 1] (shim 0 200)]
9991018 [[1 10] (cold %foo (just 'a'))]~]))
10001019 ~[
10011020 [p=5 q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
@@ -1010,17 +1029,18 @@ Examples
10101029 ]
10111030 > (stet (limo [[[1 1] (just 'a')] [[2 1] (shim 0 200)] ~]))
10121031 ~[
1013− [p=[1 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
1032+ [p=[1 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
10141033 [p=[2 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
10151034 ]
1035+```
10161036
10171037
1018−
1019−***
1038+---
10201039### `++stew`
10211040
10221041Switch by first
10231042
1043+```
10241044 ++ stew :: switch by first char
10251045 ~/ %stew
10261046 |* leh/(list {p/?(@ {@ @}) q/rule}) :: char+range keys
@@ -1065,7 +1085,7 @@ Switch by first
10651085 $(hel l.hel)
10661086 $(hel r.hel)
10671087 ::
1068−
1088+```
10691089
10701090
10711091Parser generator. From an associative `++list` of characters or character
@@ -1074,7 +1094,7 @@ with `++rules` associated with a range that the `++tape`'s first character falls
10741094
10751095
10761096
1077−***
1097+---
10781098### `++stir`
10791099
10801100Parse repeatedly
@@ -1082,8 +1102,7 @@ Parse repeatedly
10821102Parse with `++rule` as many times as possible, and fold over results with a
10831103binary gate.
10841104
1085−Accepts
1086−-------
1105+#### Accepts
10871106
10881107`rud` is a noun.
10891108
@@ -1091,14 +1110,13 @@ Accepts
10911110
10921111`fel` is a rule.
10931112
1094−Produces
1095−--------
1113+#### Produces
10961114
10971115A rule.
10981116
1099−Source
1100−------
1117+#### Source
11011118
1119+```
11021120 ++ stun :: parse several times
11031121 |* {lig/{@ @} fel/rule}
11041122 |= tub/nail
@@ -1118,40 +1136,39 @@ Source
11181136 ?~ q.wag
11191137 wag
11201138 [p.wag [~ [p.u.q.vex p.u.q.wag] q.u.q.wag]]
1139+```
11211140
1141+#### Examples
11221142
1123−Examples
1124−--------
1125−
1143+```
11261144 > (scan "abc" (stir *@ add prn))
11271145 294
1146+
11281147 > (roll "abc" add)
11291148 b=294
1149+```
11301150
11311151
1132−
1133−***
1152+---
11341153### `++stun`
11351154
11361155Parse several times
11371156
11381157Parse bounded number of times.
11391158
1140−Accepts
1141−-------
1159+#### Accepts
11421160
11431161`[les=@ mos=@]` is a cell of atoms indicating the bounds.
11441162
11451163`fel` is a `++rule`.
11461164
1147−Produces
1148−--------
1165+#### Produces
11491166
11501167A `++rule`.
11511168
1152−Source
1153−------
1169+#### Source
11541170
1171+```
11551172 ++ stun :: parse several times
11561173 |* {lig/{@ @} fel/rule}
11571174 |= tub/nail
@@ -1171,15 +1188,19 @@ Source
11711188 ?~ q.wag
11721189 wag
11731190 [p.wag [~ [p.u.q.vex p.u.q.wag] q.u.q.wag]]
1191+```
11741192
1175−Examples
1176−--------
1193+#### Examples
11771194
1195+```
11781196 > ((stun [5 10] prn) [1 1] "aquickbrownfoxran")
11791197 [p=[p=1 q=11] q=[~ [p="aquickbrow" q=[p=[p=1 q=11] q="nfoxran"]]]]
1198+
11801199 > ((stun [5 10] prn) [1 1] "aquickbro")
11811200 [p=[p=1 q=10] q=[~ [p="aquickbro" q=[p=[p=1 q=10] q=""]]]]
1201+
11821202 > ((stun [5 10] prn) [1 1] "aqui")
11831203 [p=[p=1 q=5] q=~]
1204+```
11841205
1185−***
1206+---
docs/reference/library/4g.umd+55−47
@@ -1,9 +1,13 @@
1−---
2−navhome: /docs/
3−---
1+:- :~ navhome/'/docs/'
2+ sort/'34'
3+ title/'4g: Parsing (Outside Caller)'
4+ ==
5+
6+;>
47
58
69# 4g: parsing (outside caller)
10+
711### `++rash`
812
913Parse or crash
@@ -11,43 +15,44 @@ Parse or crash
1115Parse a cord with a given `++rule` and crash if the `++cord` isn't entirely
1216parsed.
1317
14−Accepts
15−-------
18+#### Accepts
1619
1720`naf` is an atom.
1821
1922`sab` is a `++rule`.
2023
21−Produces
22−--------
24+#### Produces
2325
2426The value of the parse result, or crash.
2527
26−Source
27−------
28+#### Source
2829
30+```
2931 ++ rash |*({naf/@ sab/rule} (scan (trip naf) sab)) ::
32+```
3033
34+#### Examples
3135
32−Examples
33−--------
34−
36+```
3537 > (rash 'I was the world in which I walked, and what I saw' (star (shim 0 200)))
3638 "I was the world in which I walked, and what I saw"
39+
3740 > (rash 'abc' (just 'a'))
3841 ! {1 2}
3942 ! 'syntax-error'
4043 ! exit
44+
4145 > (rash 'abc' (jest 'abc'))
4246 'abc'
43− `> (rash 'abc' (jest 'ab'))
47+
48+ > (rash 'abc' (jest 'ab'))
4449 ! {1 3}
4550 ! 'syntax-error'
4651 ! exit
52+```
4753
4854
49−
50−***
55+---
5156### `++rush`
5257
5358Parse or null
@@ -55,41 +60,43 @@ Parse or null
5560Parse a given with a given rule and produce null if the cord isn't
5661entirely parsed.
5762
58−Accepts
59−-------
63+#### Accepts
6064
6165`naf` is an atom.
6266
6367`sab` is a rule.
6468
65−Produces
66−--------
69+#### Produces
6770
6871The value of the parse result, or null.
6972
70−Source
71−------
73+#### Source
7274
75+```
7376 ++ rush |*({naf/@ sab/rule} (rust (trip naf) sab))
77+```
7478
79+#### Examples
7580
76−Examples
77−--------
78−
81+```
7982 > (rush 'I was the world in which I walked, and what I saw' (star (shim 0 200)))
8083 [~ "I was the world in which I walked, and what I saw"]
84+
8185 > (rush 'abc' (just 'a'))
8286 ~
87+
8388 > (rush 'abc' (jest 'abc'))
8489 [~ 'abc']
90+
8591 > (rush 'abc' (jest 'ac'))
8692 ~
93+
8794 > (rush 'abc' (jest 'ab'))
8895 ~
96+```
8997
9098
91−
92−***
99+---
93100### `++rust`
94101
95102Parse tape or null
@@ -97,39 +104,39 @@ Parse tape or null
97104Parse a `++tape` with a given `++rule` and produce null if the `++tape` isn't
98105entirely parsed.
99106
100−Accepts
101−-------
107+#### Accepts
102108
103109`los` is a `++tape`.
104110
105111`sab` is a `++rule`.
106112
107−Produces
108−--------
113+#### Produces
109114
110115A `(unit ,@t)`
111116
112−Source
113−------
117+#### Source
114118
119+```
115120 ++ rust |* {los/tape sab/rule}
116121 =+ vex=((full sab) [[1 1] los])
117122 ?~(q.vex ~ [~ u=p.u.q.vex])
123+```
118124
125+#### Examples
119126
120−Examples
121−--------
122−
127+```
123128 > (rust "I was the world in which I walked, and what I saw" (star (shim 0 200)))
124129 [~ "I was the world in which I walked, and what I saw"]
130+
125131 > (rust "Or heard or felt came not but from myself;" (star (shim 0 200)))
126132 [~ "Or heard or felt came not but from myself;"]
133+
127134 > (rust "And there I found myself more truly and more strange." (jest 'And there I'))
128135 ~
136+```
129137
130138
131−
132−***
139+---
133140### `++scan`
134141
135142Parse tape or crash
@@ -137,39 +144,40 @@ Parse tape or crash
137144Parse a `++tape` with a given `++rule` and crash if the `++tape` isn't entirely
138145parsed.
139146
140−Accepts
141−-------
147+#### Accepts
142148
143149`los` is a tape.
144150
145151`sab` is a rule.
146152
147−Produces
148−--------
153+#### Produces
149154
150155Either a `++tape` or a crash.
151156
152−Source
153−------
157+#### Source
154158
159+```
155160 ++ scan |* {los/tape sab/rule}
156161 =+ vex=((full sab) [[1 1] los])
157162 ?~ q.vex
158163 ~_ (show [%m '{%d %d}'] p.p.vex q.p.vex ~)
159164 ~|('syntax-error' !!)
160165 p.u.q.vex
166+```
161167
162−Examples
163−--------
168+#### Examples
164169
170+```
165171 > (scan "I was the world in which I walked, and what I saw" (star (shim 0 200)))
166172 "I was the world in which I walked, and what I saw"
173+
167174 > (scan "Or heard or felt came not but from myself;" (star (shim 0 200)))
168175 "Or heard or felt came not but from myself;"
176+
169177 > (scan "And there I found myself more truly and more strange." (jest 'And there I'))
170178 ! {1 12}
171179 ! 'syntax-error'
172180 ! exit
181+```
173182
174−
175−***
183+---
docs/reference/library/4h.umd+330−243

This diff is too big to show here.

docs/reference/library/4i.umd+7−3

This diff is too big to show here.

docs/reference/library/4j.umd+461−457

This diff is too big to show here.

docs/reference/library/4k.umd+322−263

This diff is too big to show here.

docs/reference/library/4l.umd+96−87

This diff is too big to show here.

docs/reference/library/4m.umd+102−109

This diff is too big to show here.

docs/reference/library/4n.umd+71−79

This diff is too big to show here.

docs/reference/library/4o.umd+439−163

This diff is too big to show here.

docs/reference/library/5a.umd+7−3

This diff is too big to show here.

docs/reference/library/5b.umd+7−3

This diff is too big to show here.

docs/reference/library/5c.umd+7−3

This diff is too big to show here.

docs/reference/library/5d.umd+8−3

This diff is too big to show here.

docs/reference/library/5e.umd+8−3

This diff is too big to show here.

docs/reference/library/5f.umd+54−50

This diff is too big to show here.

docs/reference/library/5g.umd+9−3

This diff is too big to show here.

docs/reference/library/zuse.umd+11−6

This diff is too big to show here.