on master help sign in
converts standard library to .umd
e5863d1Robert
docs/reference/library/1a.umd+109−74
@@ -1,9 +1,13 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'1'
3+ title/'1a: Basic Arithmetic'
4+ ==
5+
6+;>
4
7
5
8
6# 1a: basic arithmetic
9# 1a: basic arithmetic
10+
7### `++add`
11### `++add`
8
12
9Add
13Add
@@ -22,15 +26,18 @@ An atom.
22
26
23#### Source
27#### Source
24
28
29+```
25− ++ add
30+ ++ add
26 ~/ %add
31 ~/ %add
27 |= [a=@ b=@]
32 |= [a=@ b=@]
28 ^- @
33 ^- @
29 ?: =(0 a) b
34 ?: =(0 a) b
30 $(a (dec a), b +(b))
35 $(a (dec a), b +(b))
36+```
31
37
32#### Examples
38#### Examples
33
39
40+```
34 > (add 2 2)
41 > (add 2 2)
35 4
42 4
36
43
@@ -40,19 +47,20 @@ An atom.
40 > (add 1.333 (mul 2 2))
47 > (add 1.333 (mul 2 2))
41 1.337
48 1.337
42
49
43− > (add 'a' 4)
50+ > (add 'a' 4)
44 101
51 101
45
52
46 > (add 'a' 'b')
53 > (add 'a' 'b')
47− 195
54+ 195
48
55
49− > (add 0xc 0xf)
56+ > (add 0xc 0xf)
50 27
57 27
51
58
52− > `@ux`(add 0xc 0xf)
59+ > `@ux`(add 0xc 0xf)
53 0x1b
60 0x1b
61+```
54
62
55−***
63+---
56### `++dec`
64### `++dec`
57
65
58Decrement
66Decrement
@@ -69,7 +77,8 @@ An atom.
69
77
70#### Source
78#### Source
71
79
80+```
72− ++ dec
81+ ++ dec
73 ~/ %dec
82 ~/ %dec
74 |= a=@
83 |= a=@
75 ~| %decrement-underflow
84 ~| %decrement-underflow
@@ -78,9 +87,11 @@ An atom.
78 |- ^- @
87 |- ^- @
79 ?: =(a +(b)) b
88 ?: =(a +(b)) b
80 $(b +(b))
89 $(b +(b))
90+```
81
91
82#### Examples
92#### Examples
83
93
94+```
84 > (dec 7)
95 > (dec 7)
85 6
96 6
86
97
@@ -93,14 +104,14 @@ An atom.
93 > `@t`(dec 'b')
104 > `@t`(dec 'b')
94 'a'
105 'a'
95
106
96− > (dec 0xc)
107+ > (dec 0xc)
97 11
108 11
98− > `@ux`(dec 0xc)
109+ > `@ux`(dec 0xc)
99 0xb
110 0xb
111+```
100
112
101
113
102−
114+---
103−***
104### `++div`
115### `++div`
105
116
106Divide
117Divide
@@ -119,7 +130,8 @@ An atom.
119
130
120#### Source
131#### Source
121
132
133+```
122− ++ div
134+ ++ div
123 ~/ %div
135 ~/ %div
124 |: [a=`@`1 b=`@`1]
136 |: [a=`@`1 b=`@`1]
125 ^- @
137 ^- @
@@ -129,11 +141,11 @@ An atom.
129 |-
141 |-
130 ?: (lth a b) c
142 ?: (lth a b) c
131 $(a (sub a b), c +(c))
143 $(a (sub a b), c +(c))
132−
144+```
133
145
134#### Examples
146#### Examples
135
147
136−
148+```
137 > (div 4 2)
149 > (div 4 2)
138 2
150 2
139
151
@@ -152,9 +164,9 @@ An atom.
152
164
153 > (div 0x9f 0x29)
165 > (div 0x9f 0x29)
154 6
166 6
167+```
155
168
156−
169+---
157−***
158### `++dvr`
170### `++dvr`
159
171
160Divide with remainder
172Divide with remainder
@@ -173,14 +185,17 @@ A cell of atoms.
173
185
174#### Source
186#### Source
175
187
188+```
176 ++ dvr
189 ++ dvr
177 ~/ %dvr
190 ~/ %dvr
178 |= [a=@ b=@]
191 |= [a=@ b=@]
179 ^- [p=@ q=@]
192 ^- [p=@ q=@]
180 [(div a b) (mod a b)]
193 [(div a b) (mod a b)]
194+```
181
195
182#### Examples
196#### Examples
183
197
198+```
184 > (dvr 17 8)
199 > (dvr 17 8)
185 [p=2 q=1]
200 [p=2 q=1]
186
201
@@ -195,12 +210,13 @@ A cell of atoms.
195
210
196 > (dvr 'ab 'a')
211 > (dvr 'ab 'a')
197 [p=259 q=62]
212 [p=259 q=62]
198− > `@`'a'
213+ > `@`'a'
199− 97
214+ 97
200 > `@`'ab'
215 > `@`'ab'
201− 25.185
216+ 25.185
217+```
202
218
203−***
219+---
204### `++gte`
220### `++gte`
205
221
206Greater-than/equal
222Greater-than/equal
@@ -219,15 +235,17 @@ A flag.
219
235
220#### Source
236#### Source
221
237
238+```
222− ++ gte
239+ ++ gte
223 ~/ %gte
240 ~/ %gte
224 |= [a=@ b=@]
241 |= [a=@ b=@]
225 ^- ?
242 ^- ?
226 !(lth a b)
243 !(lth a b)
227−
244+```
228
245
229#### Examples
246#### Examples
230
247
248+```
231 > (gte 100 10)
249 > (gte 100 10)
232 %.y
250 %.y
233
251
@@ -236,10 +254,9 @@ A flag.
236
254
237 > (gte 3 4)
255 > (gte 3 4)
238 %.n
256 %.n
257+```
239
258
240−
259+---
241−
242−***
243### `++gth`
260### `++gth`
244
261
245Greater-than
262Greater-than
@@ -258,16 +275,18 @@ A flag.
258
275
259#### Source
276#### Source
260
277
278+```
261− ++ gth
279+ ++ gth
262 ~/ %gth
280 ~/ %gth
263 |= [a=@ b=@]
281 |= [a=@ b=@]
264 ^- ?
282 ^- ?
265 !(lte a b)
283 !(lte a b)
266−
284+```
267
285
268
286
269#### Examples
287#### Examples
270
288
289+```
271 > (gth 'd' 'c')
290 > (gth 'd' 'c')
272 %.y
291 %.y
273
292
@@ -276,9 +295,9 @@ A flag.
276
295
277 > (gth 'steak' 'brisket')
296 > (gth 'steak' 'brisket')
278 %.n
297 %.n
298+```
279
299
280−
300+---
281−***
282### `++lte`
301### `++lte`
283
302
284Less-than/equal
303Less-than/equal
@@ -297,14 +316,16 @@ A flag.
297
316
298#### Source
317#### Source
299
318
319+```
300− ++ lte
320+ ++ lte
301 ~/ %lte
321 ~/ %lte
302 |= [a=@ b=@]
322 |= [a=@ b=@]
303 |(=(a b) (lth a b))
323 |(=(a b) (lth a b))
304−
324+```
305
325
306#### Examples
326#### Examples
307
327
328+```
308 > (lte 4 5)
329 > (lte 4 5)
309 %.y
330 %.y
310
331
@@ -328,12 +349,12 @@ A flag.
328 > (lte 'abraham' 'bob')
349 > (lte 'abraham' 'bob')
329 %.n
350 %.n
330
351
331− > (lte ~m61 ~h1)
352+ > (lte ~m61 ~h1)
332 %.n
353 %.n
354+```
333
355
334
356
335−
357+---
336−***
337### `++lth`
358### `++lth`
338
359
339Less-than
360Less-than
@@ -352,7 +373,8 @@ A flag.
352
373
353#### Source
374#### Source
354
375
376+```
355− ++ lth
377+ ++ lth
356 ~/ %lth
378 ~/ %lth
357 |= [a=@ b=@]
379 |= [a=@ b=@]
358 ^- ?
380 ^- ?
@@ -362,9 +384,11 @@ A flag.
362 ?& !=(0 b)
384 ?& !=(0 b)
363 $(a (dec a), b (dec b))
385 $(a (dec a), b (dec b))
364 == == ==
386 == == ==
387+```
365
388
366#### Examples
389#### Examples
367
390
391+```
368 > (lth 4 5)
392 > (lth 4 5)
369 %.y
393 %.y
370
394
@@ -379,16 +403,16 @@ A flag.
379
403
380 > (lth 'a' 'b')
404 > (lth 'a' 'b')
381 %.y
405 %.y
382− > `@`'a'
406+ > `@`'a'
383− 97
407+ 97
384 > `@`'b'
408 > `@`'b'
385 98
409 98
386
410
387 > (lth 'abraham' 'bob')
411 > (lth 'abraham' 'bob')
388 %.n
412 %.n
413+```
389
414
390−
415+---
391−***
392### `++max`
416### `++max`
393
417
394Maximum
418Maximum
@@ -407,15 +431,18 @@ An atom.
407
431
408#### Source
432#### Source
409
433
434+```
410− ++ max
435+ ++ max
411 ~/ %max
436 ~/ %max
412 |= [a=@ b=@]
437 |= [a=@ b=@]
413 ^- @
438 ^- @
414 ?: (gth a b) a
439 ?: (gth a b) a
415 b
440 b
441+```
416
442
417#### Examples
443#### Examples
418
444
445+```
419 > (max 10 100)
446 > (max 10 100)
420 100
447 100
421
448
@@ -428,19 +455,20 @@ An atom.
428 > (max 'abraham' 'bob')
455 > (max 'abraham' 'bob')
429 30.787.873.400.840.801
456 30.787.873.400.840.801
430
457
431− > `@t`(max 'abraham' 'bob')
458+ > `@t`(max 'abraham' 'bob')
432 'abraham'
459 'abraham'
433
460
434 > `@t`(max 'abraham' 'benjamin')
461 > `@t`(max 'abraham' 'benjamin')
435 'benjamin'
462 'benjamin'
436
463
437− > `@dr`(max ~m6 ~h1)
464+ > `@dr`(max ~m6 ~h1)
438 ~h1
465 ~h1
439
466
440− >`@ux`(max 0xe1 0x1e)
467+ >`@ux`(max 0xe1 0x1e)
441 0xe1
468 0xe1
469+```
442
470
443−***
471+---
444### `++min`
472### `++min`
445
473
446Minimum
474Minimum
@@ -459,15 +487,18 @@ An atom.
459
487
460#### Source
488#### Source
461
489
490+```
462− ++ min
491+ ++ min
463 ~/ %min
492 ~/ %min
464 |= [a=@ b=@]
493 |= [a=@ b=@]
465 ^- @
494 ^- @
466 ?: (lth a b) a
495 ?: (lth a b) a
467 b
496 b
497+```
468
498
469#### Examples
499#### Examples
470
500
501+```
471 > (min 10 100)
502 > (min 10 100)
472 10
503 10
473
504
@@ -480,18 +511,18 @@ An atom.
480 > (min 'abraham' 'bob')
511 > (min 'abraham' 'bob')
481 6.451.042
512 6.451.042
482
513
483− > `@t`(min 'abraham' 'bob')
514+ > `@t`(min 'abraham' 'bob')
484 'bob'
515 'bob'
485
516
486 > `@t`(min 'abraham' 'benjamin')
517 > `@t`(min 'abraham' 'benjamin')
487 'abraham'
518 'abraham'
488
519
489− > `@dr`(min ~m6 ~h1)
520+ > `@dr`(min ~m6 ~h1)
490 ~m6
521 ~m6
522+```
491
523
492
524
493−
525+---
494−***
495### `++mod`
526### `++mod`
496
527
497Modulus
528Modulus
@@ -510,17 +541,18 @@ An atom.
510
541
511#### Source
542#### Source
512
543
544+```
513− ++ mod
545+ ++ mod
514 ~/ %mod
546 ~/ %mod
515 |: [a=`@`1 b=`@`1]
547 |: [a=`@`1 b=`@`1]
516 ^- @
548 ^- @
517 ?< =(0 b)
549 ?< =(0 b)
518 (sub a (mul b (div a b)))
550 (sub a (mul b (div a b)))
519−
551+```
520
552
521#### Examples
553#### Examples
522
554
523−
555+```
524 > (mod 5 2)
556 > (mod 5 2)
525 1
557 1
526
558
@@ -533,15 +565,15 @@ An atom.
533 > (mod 40 20)
565 > (mod 40 20)
534 0
566 0
535
567
536− > `@`'c'
568+ > `@`'c'
537− 99
569+ 99
538 >`@`'a'
570 >`@`'a'
539 97
571 97
540 > (mod 'c' 'a')
572 > (mod 'c' 'a')
541 2
573 2
574+```
542
575
543−
576+---
544−***
545### `++mul`
577### `++mul`
546
578
547Multiply
579Multiply
@@ -560,7 +592,8 @@ An atom.
560
592
561#### Source
593#### Source
562
594
595+```
563− ++ mul
596+ ++ mul
564 ~/ %mul
597 ~/ %mul
565 |: [a=`@`1 b=`@`1]
598 |: [a=`@`1 b=`@`1]
566 ^- @
599 ^- @
@@ -568,17 +601,19 @@ An atom.
568 |-
601 |-
569 ?: =(0 a) c
602 ?: =(0 a) c
570 $(a (dec a), c (add b c))
603 $(a (dec a), c (add b c))
604+```
571
605
572#### Examples
606#### Examples
573
607
608+```
574 > (mul 3 4)
609 > (mul 3 4)
575 12
610 12
576
611
577 > (mul 0 1)
612 > (mul 0 1)
578 0
613 0
579
614
580− > `@`'a'
615+ > `@`'a'
581− 97
616+ 97
582 > `@`'b'
617 > `@`'b'
583 98
618 98
584 > (mul 'a' 'b')
619 > (mul 'a' 'b')
@@ -586,10 +621,10 @@ An atom.
586
621
587 >`@ux`(mul 0x1f 0xe)
622 >`@ux`(mul 0x1f 0xe)
588 0x1b2
623 0x1b2
624+```
589
625
590
626
591−
627+---
592−***
593### `++sub`
628### `++sub`
594
629
595Subtract
630Subtract
@@ -608,18 +643,20 @@ An atom.
608
643
609#### Source
644#### Source
610
645
646+```
611− ++ sub
647+ ++ sub
612 ~/ %sub
648 ~/ %sub
613 |= [a=@ b=@]
649 |= [a=@ b=@]
614 ~_ leaf+"subtract-underflow"
650 ~_ leaf+"subtract-underflow"
615 ^- @
651 ^- @
616 ?: =(0 b) a
652 ?: =(0 b) a
617 $(a (dec a), b (dec b))
653 $(a (dec a), b (dec b))
618−
654+```
619
655
620
656
621#### Examples
657#### Examples
622
658
659+```
623 > (sub 10 5)
660 > (sub 10 5)
624 5
661 5
625
662
@@ -633,17 +670,15 @@ An atom.
633 ! subtract-underflow
670 ! subtract-underflow
634 ! exit
671 ! exit
635
672
636− > (sub 'c' 'a')
673+ > (sub 'c' 'a')
637− 2
674+ 2
638− > `@`'c'
675+ > `@`'c'
639− 99
676+ 99
640 > `@`'a'
677 > `@`'a'
641 97
678 97
642
679
643 > (sub 0x1f 0xe)
680 > (sub 0x1f 0xe)
644 17
681 17
645− > `@ux`(sub 0x1f 0xe)
682+ > `@ux`(sub 0x1f 0xe)
646 0x11
683 0x11
647−
684+```
648−
649−***
docs/reference/library/1b.umd+44−27
@@ -1,14 +1,18 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'2'
3+ title/'1b: Tree Addressing'
4+ ==
4
5
6+;>
7+
8+[create an anchor](#anchors-in-markdown)
5
9
6# 1b: tree addressing
10# 1b: tree addressing
7
11
8Check out the Nock [explanation](docs/nock/explanation/) for more
12Check out the Nock [explanation](docs/nock/explanation/) for more
9information on the tree-addressing system.
13information on the tree-addressing system.
10
14
11−### `++cap`
15+### `++cap`(#anchors-in-markdown))
12
16
13Tree head
17Tree head
14
18
@@ -27,7 +31,8 @@ A constant atom.
27
31
28#### Source
32#### Source
29
33
34+```
30− ++ cap
35+ ++ cap
31 ~/ %cap
36 ~/ %cap
32 |= a=@
37 |= a=@
33 ^- ?($2 $3)
38 ^- ?($2 $3)
@@ -37,10 +42,11 @@ A constant atom.
37 ?(%0 %1) !!
42 ?(%0 %1) !!
38 * $(a (div a 2))
43 * $(a (div a 2))
39 ==
44 ==
40−
45+```
41
46
42#### Examples
47#### Examples
43
48
49+```
44 > (cap 4)
50 > (cap 4)
45 %2
51 %2
46
52
@@ -53,18 +59,18 @@ A constant atom.
53 > (cap 1) ::address '1' is in neither the head nor the tail
59 > (cap 1) ::address '1' is in neither the head nor the tail
54 ! exit
60 ! exit
55
61
56− > (cap 0x40))
62+ > (cap 0x40))
57 %2
63 %2
58 > `@`0x40
64 > `@`0x40
59− 64
65+ 64
60
66
61− > (cap 'a')
67+ > (cap 'a')
62 %3
68 %3
63 > `@`'a'
69 > `@`'a'
64− 97
70+ 97
71+```
65
72
66−
73+---
67−***
68### `++mas`
74### `++mas`
69
75
70Address within head/tail
76Address within head/tail
@@ -82,7 +88,8 @@ An atom.
82
88
83#### Source
89#### Source
84
90
91+```
85− ++ mas
92+ ++ mas
86 ~/ %mas
93 ~/ %mas
87 |= a=@
94 |= a=@
88 ^- @
95 ^- @
@@ -92,10 +99,11 @@ An atom.
92 3 1
99 3 1
93 * (add (mod a 2) (mul $(a (div a 2)) 2))
100 * (add (mod a 2) (mul $(a (div a 2)) 2))
94 ==
101 ==
95−
102+```
96
103
97#### Examples
104#### Examples
98
105
106+```
99 > (mas 3)
107 > (mas 3)
100 1
108 1
101
109
@@ -121,30 +129,32 @@ An atom.
121 > (cap (mas 6))
129 > (cap (mas 6))
122 %3
130 %3
123
131
124− > (mas 0)
132+ > (mas 0)
125 ! exit ::address `0` is in neither the head nor the tail
133 ! exit ::address `0` is in neither the head nor the tail
126
134
127 > (mas 1)
135 > (mas 1)
128 ! exit ::address `1` is in neither the head nor the tail
136 ! exit ::address `1` is in neither the head nor the tail
129−
137+```
130
138
131#### Discussion
139#### Discussion
132
140
133−
141+```
134 1
142 1
135 / \
143 / \
136 / \
144 / \
137− 2 3 <--here are the head (`+2`) and the tail (`+3`)
145+ 2 3 <--here are the head (`+2`) and the tail (`+3`)
138 / \ /\
146 / \ /\
139 4 5 6 7
147 4 5 6 7
140 /\ /\ /\ /\
148 /\ /\ /\ /\
141 (continues...)
149 (continues...)
150+```
142
151
143Running `(mas 7)` in the Dojo will return `3`, because address `+3` is what
152Running `(mas 7)` in the Dojo will return `3`, because address `+3` is what
144`+7` now occupies. The tree below helps illustrate the relationship. With
153`+7` now occupies. The tree below helps illustrate the relationship. With
145parentheses are `a` values (if `a` is in subtree `+3`), and without parentheses
154parentheses are `a` values (if `a` is in subtree `+3`), and without parentheses
146are the values returned with `(mas a)`.
155are the values returned with `(mas a)`.
147
156
157+```
148 1(3) ::new/(old) addresses
158 1(3) ::new/(old) addresses
149 / \
159 / \
150 2 3
160 2 3
@@ -155,11 +165,12 @@ are the values returned with `(mas a)`.
155 (12) (13) (14) (15)
165 (12) (13) (14) (15)
156 / \ / \ / \ / \
166 / \ / \ / \ / \
157 (continues...)
167 (continues...)
168+```
158
169
159Notice how the old values in the head (subtree `+2`) were not illustrated in
170Notice how the old values in the head (subtree `+2`) were not illustrated in
160this case, because `+7` is within the tail (subtree `+3`).
171this case, because `+7` is within the tail (subtree `+3`).
161
172
162−***
173+---
163### `++peg`
174### `++peg`
164
175
165Address within address
176Address within address
@@ -179,20 +190,23 @@ An atom.
179
190
180#### Source
191#### Source
181
192
193+```
182− ++ peg
194+ ++ peg
183 ~/ %peg
195 ~/ %peg
184− |= [a=@ b=@]
196+ |= [a=@ b=@]
185− ?< =(0 a)
197+ ?< =(0 a)
186− ^- @
198+ ^- @
187− ?- b
199+ ?- b
188 $1 a
200 $1 a
189 $2 (mul a 2)
201 $2 (mul a 2)
190 $3 +((mul a 2))
202 $3 +((mul a 2))
191 * (add (mod b 2) (mul $(b (div b 2)) 2))
203 * (add (mod b 2) (mul $(b (div b 2)) 2))
192 ==
204 ==
205+```
193
206
194#### Examples
207#### Examples
195
208
209+```
196 > (peg 4 1)
210 > (peg 4 1)
197 4
211 4
198
212
@@ -214,6 +228,7 @@ An atom.
214 > (cap (peg 4 2)) ::`(cap a)` computes whether address `a` is in the head or the tail
228 > (cap (peg 4 2)) ::`(cap a)` computes whether address `a` is in the head or the tail
215 %2
229 %2
216
230
231+```
217
232
218#### Discussion
233#### Discussion
219
234
@@ -225,6 +240,7 @@ greater tree, is returned.
225Running `(peg 3 4)` in the Dojo, for example, will return `12`. Looking at
240Running `(peg 3 4)` in the Dojo, for example, will return `12`. Looking at
226a tree diagram makes it easy to see why.
241a tree diagram makes it easy to see why.
227
242
243+```
228 1
244 1
229 / \
245 / \
230 / \
246 / \
@@ -237,7 +253,7 @@ a tree diagram makes it easy to see why.
237 8 9 10 11 12 13 14 15
253 8 9 10 11 12 13 14 15
238 /\ /\ /\ /\ /\ /\ /\ /\
254 /\ /\ /\ /\ /\ /\ /\ /\
239 (continues...)
255 (continues...)
240−
256+```
241
257
242When we consider subtree at address `+3` by itself, it has relative addresses
258When we consider subtree at address `+3` by itself, it has relative addresses
243that are structured in the same way as its parent tree's absolute addresses.
259that 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.
245Notice how relative address `+4` is at the same position as absolute address
261Notice how relative address `+4` is at the same position as absolute address
246`+12`.
262`+12`.
247
263
264+```
248 1(3) ::new/(old) addresses
265 1(3) ::new/(old) addresses
249 / \
266 / \
250 2 3
267 2 3
@@ -255,7 +272,7 @@ Notice how relative address `+4` is at the same position as absolute address
255 (12) (13) (14) (15)
272 (12) (13) (14) (15)
256 / \ / \ / \ / \
273 / \ / \ / \ / \
257 (continues...)
274 (continues...)
275+```
258
276
259
277
260−
278+---
261−***
docs/reference/library/1c.umd+86−48
@@ -1,6 +1,9 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'3'
3+ title/'1c: Molds and Mold-Builders'
4+ ==
5+
6+;>
4
7
5
8
6# 1c: molds and mold builders
9# 1c: molds and mold builders
@@ -13,22 +16,25 @@ Atom representing block size. A block of size `a` has a bitwidth of `2^a`.
13
16
14#### Source
17#### Source
15
18
19+```
16− ++ bloq @
20+ ++ bloq @
21+```
17
22
18#### Examples
23#### Examples
19
24
25+```
20 :: ++met measures how many a-bloqs long an atom is.
26 :: ++met measures how many a-bloqs long an atom is.
21
27
22− > (met 3 256)
28+ > (met 3 256)
23 2
29 2
24
30
25− > (met 3 255)
31+ > (met 3 255)
26 1
32 1
27
33
28− > (met 3 65.535)
34+ > (met 3 65.535)
29− 2
35+ 2
30
36
31− > (met 2 65.536)
37+ > (met 2 65.536)
32 > 3
38 > 3
33
39
34 > (met 0 4)
40 > (met 0 4)
@@ -42,6 +48,7 @@ Atom representing block size. A block of size `a` has a bitwidth of `2^a`.
42
48
43 > (met 2 0xb5)
49 > (met 2 0xb5)
44 2
50 2
51+```
45
52
46#### Discussion
53#### Discussion
47
54
@@ -62,7 +69,7 @@ And so on.
62
69
63See the [bit arithmetic](../2c) section for operations that use `bloq`s.
70See the [bit arithmetic](../2c) section for operations that use `bloq`s.
64
71
65−***
72+---
66
73
67### `++each`
74### `++each`
68
75
@@ -79,6 +86,7 @@ A mold generator. Produces a discriminated fork between two types, defaulting to
79
86
80#### Examples
87#### Examples
81
88
89+```
82 > ? *(each cord time)
90 > ? *(each cord time)
83 ?({$.y p/@t} {$.n p/@da})
91 ?({$.y p/@t} {$.n p/@da})
84 [%.y p='']
92 [%.y p='']
@@ -86,8 +94,9 @@ A mold generator. Produces a discriminated fork between two types, defaulting to
86 > ? *(each * tape)
94 > ? *(each * tape)
87 ?({$.y p/*} {$.n p/""})
95 ?({$.y p/*} {$.n p/""})
88 [%.y p=0]
96 [%.y p=0]
97+```
89
98
90−***
99+---
91### `++gate`
100### `++gate`
92
101
93Function
102Function
@@ -99,12 +108,14 @@ product noun. If used dryly as a type, the subject must have a sample type of
99
108
100#### Source
109#### Source
101
110
111+```
102− ++ gate
112+ ++ gate
103− $-(* *)
113+ $-(* *)
104−
114+```
105
115
106#### Examples
116#### Examples
107
117
118+```
108 > ? gate
119 > ? gate
109 <1.rdl {* <31.ohr 1.jmk $143>}>
120 <1.rdl {* <31.ohr 1.jmk $143>}>
110 <1.rdl {* <31.ohr 1.jmk $143>}>
121 <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
115 > (`gate`|=(a=@ [a 'b']) 1)
126 > (`gate`|=(a=@ [a 'b']) 1)
116 ! nest-fail
127 ! nest-fail
117 ! exit
128 ! exit
129+```
118
130
119#### Discussion
131#### Discussion
120
132
@@ -124,7 +136,7 @@ mathematical sense. Any `gate` normalizes to an iron `gate`.
124
136
125See also: [`++lift`](../2a), [`++cork`](../2n)
137See also: [`++lift`](../2a), [`++cork`](../2n)
126
138
127−***
139+---
128### `++list`
140### `++list`
129
141
130List
142List
@@ -135,12 +147,14 @@ homogenous type.
135
147
136#### Source
148#### Source
137
149
150+```
138− ++ list
151+ ++ list
139 |*(a=mold $@($~ (lest a)))
152 |*(a=mold $@($~ (lest a)))
140−
153+```
141
154
142#### Examples
155#### Examples
143
156
157+```
144 > *(list)
158 > *(list)
145 ~
159 ~
146
160
@@ -153,11 +167,12 @@ homogenous type.
153 > `(list @)`[1 2 'j' ~]
167 > `(list @)`[1 2 'j' ~]
154 ~[1 2 106]
168 ~[1 2 106]
155
169
170+```
156#### Discussion
171#### Discussion
157
172
158See also: [`++turn`](../2b), [`++snag`](../2b)
173See also: [`++turn`](../2b), [`++snag`](../2b)
159
174
160−***
175+---
161### `++lone`
176### `++lone`
162
177
163Face on mold
178Face on mold
@@ -166,12 +181,14 @@ A mold generator. Puts face of `p` on the passed-in mold.
166
181
167#### Source
182#### Source
168
183
184+```
169 ++ lone
185 ++ lone
170 |*(a=mold [p=a])
186 |*(a=mold [p=a])
187+```
171
188
172#### Examples
189#### Examples
173
190
174−
191+```
175 > ? *cord
192 > ? *cord
176 @t
193 @t
177 ''
194 ''
@@ -185,8 +202,9 @@ A mold generator. Puts face of `p` on the passed-in mold.
185 > ? *@
202 > ? *@
186 @
203 @
187 0
204 0
205+```
188
206
189−***
207+---
190### `++pair`
208### `++pair`
191
209
192Mold of pair of types
210Mold of pair of types
@@ -196,21 +214,23 @@ A mold generator. Produces a tuple of two of the types passed in.
196
214
197#### Source
215#### Source
198
216
217+```
199 ++ pair
218 ++ pair
200 |*([a=mold b=mold] [p=a q=b])
219 |*([a=mold b=mold] [p=a q=b])
201−
220+```
202−
203
221
204#### Examples
222#### Examples
205
223
224+```
206 > *(pair ? cord)
225 > *(pair ? cord)
207 [p=%.y q='']
226 [p=%.y q='']
208
227
209 > *(pair tape @)
228 > *(pair tape @)
210 [p="" q=0]
229 [p="" q=0]
211
230
231+```
212
232
213−***
233+---
214### `++pole`
234### `++pole`
215
235
216Faceless list
236Faceless list
@@ -219,22 +239,24 @@ A mold generator. A `list` without the faces `i` and `t`.
219
239
220#### Source
240#### Source
221
241
242+```
222 ++ pole
243 ++ pole
223 |*(a=mold $@($~ [a (pole a)]))
244 |*(a=mold $@($~ [a (pole a)]))
224−
245+```
225
246
226
247
227#### Examples
248#### Examples
228
249
250+```
229 > =/(a "asdf" ?>(?=(^ a) `(lest @tD)`a))
251 > =/(a "asdf" ?>(?=(^ a) `(lest @tD)`a))
230 [i='a' t=[i='s' t=[i='d' t=[i='f' t=~]]]]
252 [i='a' t=[i='s' t=[i='d' t=[i='f' t=~]]]]
231
253
232 > `(pole char)`"asdf"
254 > `(pole char)`"asdf"
233 ['a' ['s' ['d' ['f' ~]]]]
255 ['a' ['s' ['d' ['f' ~]]]]
256+```
234
257
235
258
236−
259+---
237−***
238### `++qual`
260### `++qual`
239
261
240Mold of 4-type tuple
262Mold of 4-type tuple
@@ -243,20 +265,23 @@ A mold generator. Produces a tuple of four of the types passed in.
243
265
244#### Source
266#### Source
245
267
268+```
246− ++ qual
269+ ++ qual
247 |* [a=mold b=mold c=mold d=mold]
270 |* [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+```
249
273
250#### Examples
274#### Examples
251
275
276+```
252 > *(qual date time tape cord)
277 > *(qual date time tape cord)
253 [p=[[a=%.y y=0] m=0 t=[d=0 h=0 m=0 s=0 f=~]] q=~292277024401-.1.1 r="" s='']
278 [p=[[a=%.y y=0] m=0 t=[d=0 h=0 m=0 s=0 f=~]] q=~292277024401-.1.1 r="" s='']
254
279
255 > *(qual (list @) @u @ud @ux)
280 > *(qual (list @) @u @ud @ux)
256 [p=~ q=0 r=0 s=0x0]
281 [p=~ q=0 r=0 s=0x0]
282+```
257
283
258−
284+---
259−***
260### `++quip`
285### `++quip`
261
286
262Mold of pair of `list` and type
287Mold 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`.
265
290
266#### Source
291#### Source
267
292
293+```
268− ++ quip
294+ ++ quip
269− |*([a=mold b=mold] [(list a) b])
295+ |*([a=mold b=mold] [(list a) b])
296+```
270
297
271#### Examples
298#### Examples
272
299
300+```
273 > *(quip @ _'hi')
301 > *(quip @ _'hi')
274 [~ 'hi']
302 [~ 'hi']
275
303
276 > `(quip @ @ux)`[[1 2 3 4 ~] 0x10]
304 > `(quip @ @ux)`[[1 2 3 4 ~] 0x10]
277 [~[1 2 3 4] 0x10]
305 [~[1 2 3 4] 0x10]
306+```
278
307
279#### Discussion
308#### Discussion
280
309
281A common pattern in Hoon code is to return a `list` of changes, along with a
310A common pattern in Hoon code is to return a `list` of changes, along with a
282new state. You'll often see `quip` used in Gall apps.
311new state. You'll often see `quip` used in Gall apps.
283
312
284−***
313+---
285### `++trap`
314### `++trap`
286
315
287Core with one arm `$`
316Core with one arm `$`
@@ -290,12 +319,14 @@ A trap is a core with one arm `$`.
290
319
291#### Source
320#### Source
292
321
322+```
293 ++ trap
323 ++ trap
294 |*(a=mold _|?(*a))
324 |*(a=mold _|?(*a))
295−
325+```
296
326
297#### Examples
327#### Examples
298
328
329+```
299 > (*trap)
330 > (*trap)
300 <1?dxy 1.oeg {a/<1|rbb {* <31.ohr 1.jmk $143>}> <31.ohr 1.jmk $143>}>
331 <1?dxy 1.oeg {a/<1|rbb {* <31.ohr 1.jmk $143>}> <31.ohr 1.jmk $143>}>
301
332
@@ -304,10 +335,10 @@ A trap is a core with one arm `$`.
304
335
305 > (|.(42))
336 > (|.(42))
306 42
337 42
338+```
307
339
308
340
309−
341+---
310−***
311### `++tree`
342### `++tree`
312
343
313Tree mold generator
344Tree mold generator
@@ -317,18 +348,20 @@ left/right sub `tree` of the same type. Pretty-printed with `{}`.
317
348
318#### Source
349#### Source
319
350
351+```
320− ++ tree
352+ ++ tree
321− |*(a=mold $@($~ [n=a l=(tree a) r=(tree a)]))
353+ |*(a=mold $@($~ [n=a l=(tree a) r=(tree a)]))
322−
354+```
323
355
324#### Examples
356#### Examples
325
357
358+```
326 > `(tree [@ tape])`[[1 "hi"] [[2 "bye"] ~ ~] ~]
359 > `(tree [@ tape])`[[1 "hi"] [[2 "bye"] ~ ~] ~]
327 {[2 "bye"] [1 "hi"]}
360 {[2 "bye"] [1 "hi"]}
361+```
328
362
329
363
330−
364+---
331−***
332### `++trel`
365### `++trel`
333
366
334Mold of three types
367Mold of three types
@@ -337,20 +370,22 @@ A mold generator. A mold of the tuple of the three types passed in.
337
370
338#### Source
371#### Source
339
372
373+```
340 ++ trel
374 ++ trel
341 |*([a=mold b=mold c=mold] [p=a q=b r=c])
375 |*([a=mold b=mold c=mold] [p=a q=b r=c])
342−
376+```
343
377
344#### Examples
378#### Examples
345
379
380+```
346 > *(trel @ud @t @s)
381 > *(trel @ud @t @s)
347 [p=0 q='' r=--0]
382 [p=0 q='' r=--0]
348
383
349 > *(trel cord bloq tape)
384 > *(trel cord bloq tape)
350 [p='' q=0 r=""]
385 [p='' q=0 r=""]
386+```
351
387
352−
388+---
353−***
354### `++unit`
389### `++unit`
355
390
356Maybe
391Maybe
@@ -361,22 +396,25 @@ type that was passed in.
361
396
362#### Source
397#### Source
363
398
399+```
364− ++ unit
400+ ++ unit
365 |*(a=mold $@($~ [$~ u=a]))
401 |*(a=mold $@($~ [$~ u=a]))
402+```
366
403
367#### Examples
404#### Examples
368
405
369−
406+```
370 > ? *(unit time)
407 > ? *(unit time)
371 ?({$~ u/@da} $~)
408 ?({$~ u/@da} $~)
372 ~
409 ~
373
410
374− > =a |= a=@
411+ > =a |= a=@
375 ^- (unit @)
412 ^- (unit @)
376 ?~ a ~
413 ?~ a ~
377 [~ a]
414 [~ a]
378 > (a 2)
415 > (a 2)
379 [~ u=2]
416 [~ u=2]
417+```
380
418
381#### Discussion
419#### Discussion
382
420
@@ -384,4 +422,4 @@ Using a `unit` allows you to specify something that may not be there.
384
422
385See also: [`++bind`](../2b)
423See also: [`++bind`](../2b)
386
424
387−***
425+---
docs/reference/library/2a.umd+144−148
@@ -1,9 +1,13 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'4'
3+ title/'2a: Unit Logic'
4+ ==
5+
6+;>
4
7
5
8
6# 2a: unit logic
9# 2a: unit logic
10+
7### `++biff`
11### `++biff`
8
12
9Unit as argument
13Unit as argument
@@ -11,38 +15,37 @@ Unit as argument
11Applies a function `b` that produces a unit to the unwrapped value of ++unit
15Applies a function `b` that produces a unit to the unwrapped value of ++unit
12`a` (`u.a`). If `a` is empty, `~` is produced.
16`a` (`u.a`). If `a` is empty, `~` is produced.
13
17
14−Accepts
18+#### Accepts
15−-------
16
19
17`a` is a unit.
20`a` is a unit.
18
21
19`b` is a function that accepts a noun and produces a unit.
22`b` is a function that accepts a noun and produces a unit.
20
23
21−Produces
24+#### Produces
22−--------
23
25
24A unit.
26A unit.
25
27
26−Source
28+#### Source
27−------
28
29
30+```
29− ++ biff :: apply
31+ ++ biff
30− |* {a/(unit) b/$-(* (unit))}
32+ |* [a](unit) b]$-(* (unit))]
31 ?~ a ~
33 ?~ a ~
32 (b u.a)
34 (b u.a)
35+```
33
36
37+#### Examples
34
38
35−Examples
39+```
36−--------
37−
38− > (biff (some 5) |=(a/@ (some (add a 2))))
40+ > (biff (some 5) |=(a]@ (some (add a 2))))
39 [~ u=7]
41 [~ u=7]
40− > (biff ~ |=(a/@ (some (add a 2))))
41− ~
42
42
43+ > (biff ~ |=(a]@ (some (add a 2))))
44+ ~
45+```
43
46
44
47
45−***
48+---
46### `++bind`
49### `++bind`
47
50
48Non-unit function to unit, producing unit
51Non-unit function to unit, producing unit
@@ -51,39 +54,39 @@ Applies a function `b` to the value (`u.a`) of a ++unit `a`, producing
51a unit. Used when you want a function that does not accept or produce a
54a unit. Used when you want a function that does not accept or produce a
52unit to both accept and produce a unit.
55unit to both accept and produce a unit.
53
56
54−Accepts
57+#### Accepts
55−-------
56
58
57`a` is a unit.
59`a` is a unit.
58
60
59`b` is a function.
61`b` is a function.
60
62
61−Produces
63+#### Produces
62−--------
63
64
64A unit.
65A unit.
65
66
66−Source
67+#### Source
67−------
68
68
69+```
69− ++ bind :: argue
70+ ++ bind
70− |* {a/(unit) b/gate}
71+ |* [a=(unit) b=gate]
71 ?~ a ~
72 ?~ a ~
72 [~ u=(b u.a)]
73 [~ u=(b u.a)]
74+```
73
75
74
76
75−Examples
77+#### Examples
76−--------
77
78
79+```
78 > (bind ((unit @) [~ 97]) ,@t)
80 > (bind ((unit @) [~ 97]) ,@t)
79− [~ `a`]
81+ [~ u='a']
80− > =a |=(a/@ (add a 1))
81− > (bind ((unit @) [~ 2]) a)
82− [~ 3]
83
82
83+ > =a |=(a]@ (add a 1))
84+ > (bind ((unit @) [~ 2]) a)
85+ [~ u=3]
86+```
84
87
85
88
86−***
89+---
87### `++bond`
90### `++bond`
88
91
89Replace null
92Replace null
@@ -91,41 +94,40 @@ Replace null
91Replaces an empty ++unit `b` with the product of a called trap
94Replaces an empty ++unit `b` with the product of a called trap
92`a`. If the unit is not empty, then the original unit is produced.
95`a`. If the unit is not empty, then the original unit is produced.
93
96
94−Accepts
97+#### Accepts
95−-------
96
98
97`a` is a trap.
99`a` is a trap.
98
100
99`b` is a unit.
101`b` is a unit.
100
102
101−Produces
103+#### Produces
102−--------
103
104
104Either the product of `a` or the value inside of unit `b`.
105Either the product of `a` or the value inside of unit `b`.
105
106
106−Source
107+#### Source
107−------
108
108
109+```
109− ++ bond :: replace
110+ ++ bond
110− |* a/(trap)
111+ |* a=(trap)
111− |* b/(unit)
112+ |* b=(unit)
112 ?~ b $:a
113 ?~ b $:a
113 u.b
114 u.b
115+```
114
116
117+#### Examples
115
118
116−Examples
119+```
117−--------
118−
119 > (bex 10)
120 > (bex 10)
120 1.024
121 1.024
121 > ((bond |.((bex 10))) ~)
122 > ((bond |.((bex 10))) ~)
122 1.024
123 1.024
124+
123 > ((bond |.((bex 10))) (slaw %ud '123'))
125 > ((bond |.((bex 10))) (slaw %ud '123'))
124 123
126 123
127+```
125
128
126
129
127−
130+---
128−***
129### `++both`
131### `++both`
130
132
131Group unit values into pair
133Group unit values into pair
@@ -134,47 +136,45 @@ Produces `~` if either `a` or `b` are empty. Otherwise, produces a
134++unit whose value is a cell of the values of two input units `a` and
136++unit whose value is a cell of the values of two input units `a` and
135`b`.
137`b`.
136
138
137−Accepts
139+#### Accepts
138−-------
139
140
140`a` is a unit.
141`a` is a unit.
141
142
142`b` is a unit.
143`b` is a unit.
143
144
144−Produces
145+#### Produces
145−--------
146
146
147A unit of the two initial values.
147A unit of the two initial values.
148
148
149−Source
149+#### Source
150−------
151
150
151+```
152− ++ both :: all the above
152+ ++ both
153− |* {a/(unit) b/(unit)}
153+ |* [a=(unit) b=(unit)]
154 ?~ a ~
154 ?~ a ~
155 ?~ b ~
155 ?~ b ~
156 [~ u=[u.a u.b]]
156 [~ u=[u.a u.b]]
157+```
157
158
159+#### Examples
158
160
159−Examples
161+```
160−--------
161−
162 > (both (some 1) (some %b))
162 > (both (some 1) (some %b))
163 [~ u=[1 %b]]
163 [~ u=[1 %b]]
164+
164 > (both ~ (some %b))
165 > (both ~ (some %b))
165 ~
166 ~
167+```
166
168
167−
169+---
168−***
169### `++clap`
170### `++clap`
170
171
171Apply function to two units
172Apply function to two units
172
173
173−Applies a binary function `c`--which does not usually accept or produce a `++unit`--
174+Applies a binary function `c`--which does not usually accept or produce a
174−to the values of two units, `a` and `b`, producing a unit.
175+`++unit`-- to the values of two units, `a` and `b`, producing a unit.
175
176
176−Accepts
177+#### Accepts
177−-------
178
178
179`a` is a unit.
179`a` is a unit.
180
180
@@ -182,112 +182,109 @@ Accepts
182
182
183`c` is a function that performs a binary operation.
183`c` is a function that performs a binary operation.
184
184
185−Produces
185+#### Produces
186−--------
187
186
188A unit.
187A unit.
189
188
190−Source
189+#### Source
191−------
192
190
191+```
193 ++ clap :: combine
192 ++ clap :: combine
194− |* {a/(unit) b/(unit) c/_|=(^ +<-)}
193+ |* [a](unit) b=(unit) c=_|=(^ +<-)]
195 ?~ a b
194 ?~ a b
196 ?~ b a
195 ?~ b a
197 [~ u=(c u.a u.b)]
196 [~ u=(c u.a u.b)]
197+```
198
198
199+#### Examples
199
200
200−Examples
201+```
201−--------
202−
203 > =u ((unit @t) [~ 'a'])
202 > =u ((unit @t) [~ 'a'])
204 > =v ((unit @t) [~ 'b'])
203 > =v ((unit @t) [~ 'b'])
205 > (clap u v |=([a=@t b=@t] (welp (trip a) (trip b))))
204 > (clap u v |=([a=@t b=@t] (welp (trip a) (trip b))))
206− [~ u="ab"]
205+ [~ u="ab"]
206+
207 > =a ((unit @u) [~ 1])
207 > =a ((unit @u) [~ 1])
208 > =b ((unit @u) [~ 2])
208 > =b ((unit @u) [~ 2])
209 > =c |=([a=@ b=@] (add a b))
209 > =c |=([a=@ b=@] (add a b))
210+
210 > (clap a b c)
211 > (clap a b c)
211 [~ 3]
212 [~ 3]
212−
213+```
213
214
214
215
215−***
216+---
216### `++drop`
217### `++drop`
217
218
218Unit to list
219Unit to list
219
220
220Makes a ++list of the unwrapped value (`u.a`) of a `++unit` `a`.
221Makes a ++list of the unwrapped value (`u.a`) of a `++unit` `a`.
221
222
222−Accepts
223+#### Accepts
223−-------
224
224
225`a` is a unit.
225`a` is a unit.
226
226
227−Produces
227+#### Produces
228−--------
229
228
230A list.
229A list.
231
230
232−Source
231+#### Source
233−------
234
232
233+```
235 ++ drop :: enlist
234 ++ drop :: enlist
236− |* a/(unit)
235+ |* a=(unit)
237 ?~ a ~
236 ?~ a ~
238 [i=u.a t=~]
237 [i=u.a t=~]
238+```
239
239
240+#### Examples
240
241
241−Examples
242+```
242−--------
243−
244 > =a ((unit @) [~ 97])
243 > =a ((unit @) [~ 97])
245 > (drop a)
244 > (drop a)
246− [i=97 t=~]
245+ [i=97 t=~]
246+
247 > =a ((unit @) [~])
247 > =a ((unit @) [~])
248 > (drop a)
248 > (drop a)
249 ~
249 ~
250+```
250
251
251
252
252−
253+---
253−***
254### `++fall`
254### `++fall`
255
255
256Give unit a default value
256Give unit a default value
257
257
258Produces a default value `b` for a `++unit` `a` in cases where `a` is null.
258Produces a default value `b` for a `++unit` `a` in cases where `a` is null.
259
259
260−Accepts
260+#### Accepts
261−-------
262
261
263`a` is a unit.
262`a` is a unit.
264
263
265`b` is a noun that's used as the default value.
264`b` is a noun that's used as the default value.
266
265
267−Produces
266+#### Produces
268−--------
269
267
270Either a noun `b` or the unwrapped value of unit `a`.
268Either a noun `b` or the unwrapped value of unit `a`.
271
269
272−Source
270+#### Source
273−------
274
271
272+```
275 ++ fall :: default
273 ++ fall :: default
276− |* {a/(unit) b/*}
274+ |* [a=(unit) b=*]
277 ?~(a b u.a)
275 ?~(a b u.a)
276+```
278
277
278+#### Examples
279
279
280−Examples
280+```
281−--------
282−
283 > (fall ~ `a`)
281 > (fall ~ `a`)
284 `a`
282 `a`
285 > (fall [~ u=0] `a`)
283 > (fall [~ u=0] `a`)
286 0
284 0
285+```
287
286
288−
287+---
289−
290−***
291### `++lift`
288### `++lift`
292
289
293Curried bind
290Curried bind
@@ -296,38 +293,37 @@ Accepts a `++gate` `a` and produces a function that accepts `++unit`
296`b` to which it applies `a`. Used when you want a function that does not accept
293`b` to which it applies `a`. Used when you want a function that does not accept
297or produce a unit to both accept and produce a unit.
294or produce a unit to both accept and produce a unit.
298
295
299−Accepts
296+#### Accepts
300−-------
301
297
302`a` is a gate.
298`a` is a gate.
303
299
304`b` is a unit.
300`b` is a unit.
305
301
306−Produces
302+#### Produces
307−--------
308
303
309A unit.
304A unit.
310
305
311−Source
306+#### Source
312−------
313
307
308+```
314 ++ lift :: lift gate (fmap)
309 ++ lift :: lift gate (fmap)
315− |* a/gate :: flipped
310+ |* a=gate :: flipped
316− |* b/(unit) :: curried
311+ |* b=(unit) :: curried
317 (bind b a) :: bind
312 (bind b a) :: bind
313+```
318
314
315+#### Examples
319
316
320−Examples
317+```
321−--------
322−
323 > ((lift dec) `(unit @)`~)
318 > ((lift dec) `(unit @)`~)
324 ~
319 ~
320+
325 > ((lift dec) `(unit @)`[~ 20])
321 > ((lift dec) `(unit @)`[~ 20])
326 [~ 19]
322 [~ 19]
323+```
327
324
328
325
329−
326+---
330−***
331### `++mate`
327### `++mate`
332
328
333Choose
329Choose
@@ -338,120 +334,120 @@ If neither are empty, it asserts that both values are the same and
338produces that value. If the assertion fails, `++mate` crashes with
334produces that value. If the assertion fails, `++mate` crashes with
339`'mate'` in the stack trace.
335`'mate'` in the stack trace.
340
336
341−Accepts
337+#### Accepts
342−-------
343
338
344`a` is a unit.
339`a` is a unit.
345
340
346`b` is a unit.
341`b` is a unit.
347
342
348−Produces
343+#### Produces
349−--------
350
344
351A unit or crash.
345A unit or crash.
352
346
353−Source
347+#### Source
354−------
355
348
349+```
356 ++ mate :: choose
350 ++ mate :: choose
357− |* {a/(unit) b/(unit)}
351+ |* [a=(unit) b=(unit)]
358 ?~ b a
352 ?~ b a
359 ?~ a b
353 ?~ a b
360 ?.(=(u.a u.b) ~|('mate' !!) a)
354 ?.(=(u.a u.b) ~|('mate' !!) a)
355+```
361
356
357+#### Examples
362
358
363−Examples
359+```
364−--------
365−
366 > =a ((unit @) [~ 97])
360 > =a ((unit @) [~ 97])
367 > =b ((unit @) [~ 97])
361 > =b ((unit @) [~ 97])
368 > (mate a b)
362 > (mate a b)
369 [~ 97]
363 [~ 97]
364+
370 > =a ((unit @) [~ 97])
365 > =a ((unit @) [~ 97])
371 > =b ((unit @) [~])
366 > =b ((unit @) [~])
372 > (mate a b)
367 > (mate a b)
373 [~ 97]
368 [~ 97]
369+
374 > =a ((unit @) [~ 97])
370 > =a ((unit @) [~ 97])
375 > =b ((unit @) [~ 98])
371 > =b ((unit @) [~ 98])
376 > (mate a b)
372 > (mate a b)
377 ! 'mate'
373 ! 'mate'
378 ! exit
374 ! exit
375+```
379
376
380
377
381−
378+---
382−***
383### `++need`
379### `++need`
384
380
385Unwrap unit
381Unwrap unit
386
382
387Retrieve the value from a `++unit` and crash if the unit is null.
383Retrieve the value from a `++unit` and crash if the unit is null.
388
384
389−Accepts
385+#### Accepts
390−-------
391
386
392`a` is a unit.
387`a` is a unit.
393
388
394−Produces
389+#### Produces
395−--------
396
390
397Either the unwrapped value of `a` (`u.a`), or crash.
391Either the unwrapped value of `a` (`u.a`), or crash.
398
392
399−Source
393+#### Source
400−------
401
394
395+```
402 ++ need :: demand
396 ++ need :: demand
403− |* a/(unit)
397+ |* a](unit)
404 ?~ a ~|(%need !!)
398 ?~ a ~|(%need !!)
405 u.a
399 u.a
400+```
406
401
402+#### Examples
407
403
408−Examples
404+```
409−--------
410−
411 > =a ((unit [@t @t]) [~ ['a' 'b']])
405 > =a ((unit [@t @t]) [~ ['a' 'b']])
412 > (need a)
406 > (need a)
413 ['a' 'b']
407 ['a' 'b']
408+
414 > =a ((unit @ud) [~ 17])
409 > =a ((unit @ud) [~ 17])
415 > (need a)
410 > (need a)
416 17
411 17
412+
417 > =a ((unit @) [~])
413 > =a ((unit @) [~])
418 > (need a)
414 > (need a)
419 ! exit
415 ! exit
416+```
420
417
421
418
422−
419+---
423−***
424### `++some`
420### `++some`
425
421
426Wrap value in a unit
422Wrap value in a unit
427
423
428Takes any atom `a` and produces a [`++unit`]() with the value set to `a`.
424Takes any atom `a` and produces a [`++unit`]() with the value set to `a`.
429
425
430−Accepts
426+#### Accepts
431−-------
432
427
433`a` is a [noun]().
428`a` is a [noun]().
434
429
435−Produces
430+#### Produces
436−--------
437
431
438A unit.
432A unit.
439
433
440−Source
434+#### Source
441−------
442
435
436+```
443 ++ some :: lift (pure)
437 ++ some :: lift (pure)
444 |* a=*
438 |* a=*
445 [~ u=a]
439 [~ u=a]
440+```
446
441
447−Examples
442+#### Examples
448−--------
449
443
444+```
450 > (some [`a` `b`])
445 > (some [`a` `b`])
451 [~ u=[`a` `b`]]
446 [~ u=[`a` `b`]]
447+
452 > (some &)
448 > (some &)
453 [~ u=%.y]
449 [~ u=%.y]
450+```
454
451
455
452
456−
453+---
457−***
docs/reference/library/2b.umd+164−92
@@ -1,9 +1,12 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'5'
3+ title/'2b: List Logic'
4+ ==
4
5
6+;>
5
7
6# 2b: list logic
8# 2b: list logic
9+
7### `++fand`
10### `++fand`
8
11
9All indices in `list`
12All indices in `list`
@@ -23,7 +26,8 @@ A `list`.
23
26
24#### Source
27#### Source
25
28
29+```
26− ++ fand
30+ ++ fand
27 ~/ %fand
31 ~/ %fand
28 |= [nedl=(list) hstk=(list)]
32 |= [nedl=(list) hstk=(list)]
29 =| i=@ud
33 =| i=@ud
@@ -38,10 +42,11 @@ A `list`.
38 ^$(i +(i), hstk +.hstk, fnd [i fnd])
42 ^$(i +(i), hstk +.hstk, fnd [i fnd])
39 $(n t.n, h t.h)
43 $(n t.n, h t.h)
40 ^$(i +(i), hstk +.hstk)
44 ^$(i +(i), hstk +.hstk)
41−
45+```
42
46
43#### Examples
47#### Examples
44
48
49+```
45 > (fand ~[3] ~[1 2 3])
50 > (fand ~[3] ~[1 2 3])
46 ~[2]
51 ~[2]
47
52
@@ -53,10 +58,10 @@ A `list`.
53
58
54 > (fand "ba" "cbabab")
59 > (fand "ba" "cbabab")
55 ~[1 3]
60 ~[1 3]
61+```
56
62
57
63
58−
64+---
59−***
60### `++find`
65### `++find`
61
66
62First index in `list`
67First index in `list`
@@ -76,7 +81,8 @@ The `unit` of an atom.
76
81
77#### Source
82#### Source
78
83
84+```
79− ++ find
85+ ++ find
80 ~/ %find
86 ~/ %find
81 |= [nedl=(list) hstk=(list)]
87 |= [nedl=(list) hstk=(list)]
82 =| i=@ud
88 =| i=@ud
@@ -90,10 +96,11 @@ The `unit` of an atom.
90 `i
96 `i
91 $(n t.n, h t.h)
97 $(n t.n, h t.h)
92 ^$(i +(i), hstk +.hstk)
98 ^$(i +(i), hstk +.hstk)
93−
99+```
94
100
95#### Examples
101#### Examples
96
102
103+```
97 > (find [3]~ ~[1 2 3])
104 > (find [3]~ ~[1 2 3])
98 [~ u=2]
105 [~ u=2]
99
106
@@ -108,9 +115,9 @@ The `unit` of an atom.
108
115
109 > (find "bab" "cbabab")
116 > (find "bab" "cbabab")
110 [~ u=2]
117 [~ u=2]
118+```
111
119
112−
120+---
113−***
114### `++flop`
121### `++flop`
115
122
116Reverse
123Reverse
@@ -127,7 +134,8 @@ A `list`.
127
134
128#### Source
135#### Source
129
136
137+```
130− ++ flop
138+ ++ flop
131 ~/ %flop
139 ~/ %flop
132 |* a=(list)
140 |* a=(list)
133 => .(a (homo a))
141 => .(a (homo a))
@@ -136,19 +144,21 @@ A `list`.
136 |-
144 |-
137 ?~ a b
145 ?~ a b
138 $(a t.a, b [i.a b])
146 $(a t.a, b [i.a b])
139−
147+```
140
148
141
149
142#### Examples
150#### Examples
143
151
152+```
144 > =a [1 2 3 ~]
153 > =a [1 2 3 ~]
145 > (flop a)
154 > (flop a)
146 ~[3 2 1]
155 ~[3 2 1]
147
156
148 > (flop (flop a))
157 > (flop (flop a))
149 ~[1 2 3]
158 ~[1 2 3]
159+```
150
160
151−***
161+---
152### `++gulf`
162### `++gulf`
153
163
154List from range
164List from range
@@ -168,27 +178,31 @@ a `list`.
168
178
169#### Source
179#### Source
170
180
181+```
171− ++ gulf
182+ ++ gulf
172 |= [a=@ b=@]
183 |= [a=@ b=@]
173 ^- (list @)
184 ^- (list @)
174 ?:(=(a +(b)) ~ [a $(a +(a))])
185 ?:(=(a +(b)) ~ [a $(a +(a))])
186+```
175
187
176#### Examples
188#### Examples
177
189
190+```
178 > (gulf 1 6)
191 > (gulf 1 6)
179 ~[1 2 3 4 5 6]
192 ~[1 2 3 4 5 6]
180
193
181 > `(list @t)`(gulf 99 106)
194 > `(list @t)`(gulf 99 106)
182 <|c d e f g h i j|>
195 <|c d e f g h i j|>
196+```
183
197
184−***
198+---
185### `++homo`
199### `++homo`
186
200
187Homogenize
201Homogenize
188
202
189Produces a `list` whose type is a fork of all the contained types in the
203Produces a `list` whose type is a fork of all the contained types in the
190list `a`. Used when you want to make all the types of the elements of a list the
204list `a`. Used when you want to make all the types of the elements of a list the
191− same.
205+same.
192
206
193#### Accepts
207#### Accepts
194
208
@@ -200,16 +214,18 @@ a `list`.
200
214
201#### Source
215#### Source
202
216
217+```
203− ++ homo
218+ ++ homo
204 |* a=(list)
219 |* a=(list)
205 ^+ =< $
220 ^+ =< $
206 |% +- $ ?:(*? ~ [i=(snag 0 a) t=$])
221 |% +- $ ?:(*? ~ [i=(snag 0 a) t=$])
207 --
222 --
208 a
223 a
209−
224+```
210
225
211#### Examples
226#### Examples
212
227
228+```
213 > lyst
229 > lyst
214 [i=1 t=[i=97 t=[i=2 t=[i=98 t=[i=[~ u=10] t=~]]]]]
230 [i=1 t=[i=97 t=[i=2 t=[i=98 t=[i=[~ u=10] t=~]]]]]
215
231
@@ -222,10 +238,10 @@ a `list`.
222
238
223 > (homo a)
239 > (homo a)
224 ~[1 2 3]
240 ~[1 2 3]
241+```
225
242
226
243
227−
244+---
228−***
229### `++lent`
245### `++lent`
230
246
231List length
247List length
@@ -242,7 +258,8 @@ an atom.
242
258
243#### Source
259#### Source
244
260
261+```
245− ++ lent
262+ ++ lent
246 ~/ %lent
263 ~/ %lent
247 |= a=(list)
264 |= a=(list)
248 ^- @
265 ^- @
@@ -250,19 +267,20 @@ an atom.
250 |-
267 |-
251 ?~ a b
268 ?~ a b
252 $(a t.a, b +(b))
269 $(a t.a, b +(b))
253−
270+```
254
271
255#### Examples
272#### Examples
256
273
274+```
257 > (lent [1 2 3 4 ~]))
275 > (lent [1 2 3 4 ~]))
258 4
276 4
259
277
260 > (lent [1 'a' 2 'b' (some 10) ~])
278 > (lent [1 'a' 2 'b' (some 10) ~])
261 5
279 5
280+```
262
281
263
282
264−
283+---
265−***
266### `++levy`
284### `++levy`
267
285
268Logical "and" on list
286Logical "and" on list
@@ -281,6 +299,7 @@ A boolean.
281
299
282#### Source
300#### Source
283
301
302+```
284 ++ levy
303 ++ levy
285 ~/ %levy :: all of
304 ~/ %levy :: all of
286 |* [a=(list) b=$-(* ?)]
305 |* [a=(list) b=$-(* ?)]
@@ -288,10 +307,11 @@ A boolean.
288 ?~ a &
307 ?~ a &
289 ?. (b i.a) |
308 ?. (b i.a) |
290 $(a t.a)
309 $(a t.a)
291−
310+```
292
311
293#### Examples
312#### Examples
294
313
314+```
295 > =a |=(a=@ (lte a 1))
315 > =a |=(a=@ (lte a 1))
296 > (levy `(list @)`[0 1 2 1 ~] a)
316 > (levy `(list @)`[0 1 2 1 ~] a)
297 %.n
317 %.n
@@ -299,10 +319,11 @@ A boolean.
299 > =a |=(a=@ (lte a 3))
319 > =a |=(a=@ (lte a 3))
300 > (levy `(list @)`[0 1 2 1 ~] a)
320 > (levy `(list @)`[0 1 2 1 ~] a)
301 %.y
321 %.y
322+```
302
323
303
324
325+---
304
326
305−***
306### `++lien`
327### `++lien`
307
328
308Logical "or" on list
329Logical "or" on list
@@ -318,16 +339,19 @@ every element of `++list` `a`.
318
339
319#### Source
340#### Source
320
341
342+```
321− ++ lien
343+ ++ lien
322 ~/ %lien
344 ~/ %lien
323 |* [a=(list) b=$-(* ?)]
345 |* [a=(list) b=$-(* ?)]
324 |- ^- ?
346 |- ^- ?
325 ?~ a |
347 ?~ a |
326 ?: (b i.a) &
348 ?: (b i.a) &
327 $(a t.a)
349 $(a t.a)
350+```
328
351
329#### Examples
352#### Examples
330
353
354+```
331 > =a |=(a=@ (gte a 1))
355 > =a |=(a=@ (gte a 1))
332 > (lien `(list @)`[0 1 2 1 ~] a)
356 > (lien `(list @)`[0 1 2 1 ~] a)
333 %.y
357 %.y
@@ -335,10 +359,10 @@ every element of `++list` `a`.
335 > =a |=(a=@ (gte a 3))
359 > =a |=(a=@ (gte a 3))
336 > (lien `(list @)`[0 1 2 1 ~]) a)
360 > (lien `(list @)`[0 1 2 1 ~]) a)
337 %.n
361 %.n
362+```
338
363
339
364
340−
365+---
341−***
342### `++limo`
366### `++limo`
343
367
344List Constructor
368List Constructor
@@ -355,21 +379,24 @@ A `++list`.
355
379
356#### Source
380#### Source
357
381
382+```
358 ++ limo :: listify
383 ++ limo :: listify
359 |* a=*
384 |* a=*
360 ^+ =< $
385 ^+ =< $
361 |% +- $ ?~(a ~ ?:(_? i=-.a t=$ $(a +.a)))
386 |% +- $ ?~(a ~ ?:(_? i=-.a t=$ $(a +.a)))
362 --
387 --
363 a
388 a
389+```
364
390
365#### Examples
391#### Examples
366
392
393+```
367 > (limo [1 2 3 ~])
394 > (limo [1 2 3 ~])
368 [i=1 t=[i=2 t=[i=3 t=~]]]
395 [i=1 t=[i=2 t=[i=3 t=~]]]
396+```
369
397
370
398
371−
399+---
372−***
373### `++murn`
400### `++murn`
374
401
375Maybe transform
402Maybe transform
@@ -390,6 +417,7 @@ A unit.
390
417
391#### Source
418#### Source
392
419
420+```
393 ++ murn :: maybe transform
421 ++ murn :: maybe transform
394 ~/ %murn
422 ~/ %murn
395 |* [a=(list) b=$-(* (unit))]
423 |* [a=(list) b=$-(* (unit))]
@@ -399,16 +427,18 @@ A unit.
399 ?~ c
427 ?~ c
400 $(a t.a)
428 $(a t.a)
401 [i=u.c t=$(a t.a)]
429 [i=u.c t=$(a t.a)]
430+```
402
431
403#### Examples
432#### Examples
404
433
434+```
405 > =a |=(a=@ ?.((gte a 2) ~ (some (add a 10))))
435 > =a |=(a=@ ?.((gte a 2) ~ (some (add a 10))))
406 > (murn `(list @)`[0 1 2 3 ~] a)
436 > (murn `(list @)`[0 1 2 3 ~] a)
407 [i=12 t=[i=13 t=~]]
437 [i=12 t=[i=13 t=~]]
438+```
408
439
409
440
410−
441+---
411−***
412### `++oust`
442### `++oust`
413
443
414Remove
444Remove
@@ -426,22 +456,25 @@ A `++list`.
426
456
427#### Source
457#### Source
428
458
459+```
429 ++ oust :: remove
460 ++ oust :: remove
430 ~/ %oust
461 ~/ %oust
431 |* [[a=@ b=@] c=(list)]
462 |* [[a=@ b=@] c=(list)]
432 (weld (scag a c) (slag (add a b) c))
463 (weld (scag a c) (slag (add a b) c))
464+```
433
465
434#### Examples
466#### Examples
435
467
468+```
436 > (oust [4 5] "good day, urbit!")
469 > (oust [4 5] "good day, urbit!")
437 "good urbit!"
470 "good urbit!"
438
471
439 > (oust [2 2] `(list @)`[1 2 3 4 ~])
472 > (oust [2 2] `(list @)`[1 2 3 4 ~])
440 ~[1 2]
473 ~[1 2]
474+```
441
475
442
476
443−
477+---
444−***
445### `++reap`
478### `++reap`
446
479
447Replicate
480Replicate
@@ -460,15 +493,18 @@ A list.
460
493
461#### Source
494#### Source
462
495
496+```
463 ++ reap :: replicate
497 ++ reap :: replicate
464 ~/ %reap
498 ~/ %reap
465 |* [a=@ b=*]
499 |* [a=@ b=*]
466 |- ^- (list _b)
500 |- ^- (list _b)
467 ?~ a ~
501 ?~ a ~
468 [b $(a (dec a))]
502 [b $(a (dec a))]
503+```
469
504
470#### Examples
505#### Examples
471
506
507+```
472 > (reap 20 %a)
508 > (reap 20 %a)
473 ~[%a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a]
509 ~[%a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a %a]
474
510
@@ -477,10 +513,10 @@ A list.
477
513
478 > `@dr`(roll (reap 5 ~s1) add)
514 > `@dr`(roll (reap 5 ~s1) add)
479 ~s5
515 ~s5
516+```
480
517
481
518
482−
519+---
483−***
484### `++reel`
520### `++reel`
485
521
486Right fold
522Right fold
@@ -504,17 +540,19 @@ The accumulator, which is a noun.
504
540
505#### Source
541#### Source
506
542
543+```
507− ++ reel :: right fold
544+ ++ reel
508 ~/ %reel
545 ~/ %reel
509 |* [a=(list) b=_|=([* *] +<+)]
546 |* [a=(list) b=_|=([* *] +<+)]
510 |- ^+ +<+.b
547 |- ^+ +<+.b
511 ?~ a
548 ?~ a
512 +<+.b
549 +<+.b
513 (b i.a $(a t.a))
550 (b i.a $(a t.a))
514−
551+```
515
552
516#### Examples
553#### Examples
517
554
555+```
518 > =sum =|([p=@ q=@] |.((add p q)))
556 > =sum =|([p=@ q=@] |.((add p q)))
519 > (reel (limo [1 2 3 4 5 ~]) sum)
557 > (reel (limo [1 2 3 4 5 ~]) sum)
520 15
558 15
@@ -526,10 +564,10 @@ The accumulator, which is a noun.
526 > (reel (limo [3 6 1 ~]) a)
564 > (reel (limo [3 6 1 ~]) a)
527 ! subtract-underflow
565 ! subtract-underflow
528 ! exit
566 ! exit
567+```
529
568
530
569
531−
570+---
532−***
533### `++roll`
571### `++roll`
534
572
535Left fold
573Left fold
@@ -553,6 +591,7 @@ The accumulator, which is a noun.
553
591
554#### Source
592#### Source
555
593
594+```
556 ++ roll :: left fold
595 ++ roll :: left fold
557 ~/ %roll
596 ~/ %roll
558 |* [a=(list) b=_|=([* *] +<+)]
597 |* [a=(list) b=_|=([* *] +<+)]
@@ -560,22 +599,26 @@ The accumulator, which is a noun.
560 ?~ a
599 ?~ a
561 +<+.b
600 +<+.b
562 $(a t.a, b b(+<+ (b i.a +<+.b)))
601 $(a t.a, b b(+<+ (b i.a +<+.b)))
602+```
563
603
564#### Examples
604#### Examples
565
605
606+```
566 > =sum =|([p=@ q=@] |.((add p q)))
607 > =sum =|([p=@ q=@] |.((add p q)))
567 > (roll (limo [1 2 3 4 5 ~]) sum)
608 > (roll (limo [1 2 3 4 5 ~]) sum)
568 q=15
609 q=15
610+
569 > =a =|([p=@ q=@] |.((sub p q)))
611 > =a =|([p=@ q=@] |.((sub p q)))
570 > (roll (limo [6 3 1 ~]) a)
612 > (roll (limo [6 3 1 ~]) a)
571 ! subtract-underflow
613 ! subtract-underflow
572 ! exit
614 ! exit
615+
573 > (roll (limo [1 3 6 ~]) a)
616 > (roll (limo [1 3 6 ~]) a)
574 q=4
617 q=4
618+```
575
619
576
620
577−
621+---
578−***
579### `++scag`
622### `++scag`
580
623
581Prefix
624Prefix
@@ -595,24 +638,27 @@ A list of the same type as `b`.
595
638
596#### Source
639#### Source
597
640
641+```
598 ++ scag :: prefix
642 ++ scag :: prefix
599 ~/ %scag
643 ~/ %scag
600 |* [a=@ b=(list)]
644 |* [a=@ b=(list)]
601 |- ^+ b
645 |- ^+ b
602 ?: |(?=(~ b) =(0 a)) ~
646 ?: |(?=(~ b) =(0 a)) ~
603 [i.b $(b t.b, a (dec a))]
647 [i.b $(b t.b, a (dec a))]
648+```
604
649
605#### Examples
650#### Examples
606
651
652+```
607 > (scag 2 `(list @)`[1 2 3 4 ~])
653 > (scag 2 `(list @)`[1 2 3 4 ~])
608 [i=0 t=~[1]]
654 [i=0 t=~[1]]
609
655
610 > (scag 10 `(list @)`[1 2 3 4 ~])
656 > (scag 10 `(list @)`[1 2 3 4 ~])
611 [i=1 t=~[2 3 4]]
657 [i=1 t=~[2 3 4]]
658+```
612
659
613
660
614−
661+---
615−***
616### `++skid`
662### `++skid`
617
663
618Separate
664Separate
@@ -635,6 +681,7 @@ A cell of two lists.
635
681
636#### Source
682#### Source
637
683
684+```
638 ++ skid :: separate
685 ++ skid :: separate
639 ~/ %skid
686 ~/ %skid
640 |* [a=(list) b=$-(* ?)]
687 |* [a=(list) b=$-(* ?)]
@@ -642,18 +689,19 @@ A cell of two lists.
642 ?~ a [~ ~]
689 ?~ a [~ ~]
643 =+ c=$(a t.a)
690 =+ c=$(a t.a)
644 ?:((b i.a) [[i.a p.c] q.c] [p.c [i.a q.c]])
691 ?:((b i.a) [[i.a p.c] q.c] [p.c [i.a q.c]])
645−
692+```
646
693
647
694
648#### Examples
695#### Examples
649
696
697+```
650 > =a |=(a=@ (gth a 1))
698 > =a |=(a=@ (gth a 1))
651 > (skid `(list @)`[0 1 2 3 ~]) a)
699 > (skid `(list @)`[0 1 2 3 ~]) a)
652 (skid `(list @)`[0 1 2 3 ~]) a)
700 (skid `(list @)`[0 1 2 3 ~]) a)
701+```
653
702
654
703
655−
704+---
656−***
657### `++skim`
705### `++skim`
658
706
659Suffix
707Suffix
@@ -674,6 +722,7 @@ A flag.
674
722
675#### Source
723#### Source
676
724
725+```
677 ++ skim :: only
726 ++ skim :: only
678 ~/ %skim
727 ~/ %skim
679 |* [a=(list) b=$-(* ?)]
728 |* [a=(list) b=$-(* ?)]
@@ -681,17 +730,17 @@ A flag.
681 ^+ a
730 ^+ a
682 ?~ a ~
731 ?~ a ~
683 ?:((b i.a) [i.a $(a t.a)] $(a t.a))
732 ?:((b i.a) [i.a $(a t.a)] $(a t.a))
684−
733+```
685
734
686#### Examples
735#### Examples
687
736
737+```
688 > =a |=(a=@ (gth a 1))
738 > =a |=(a=@ (gth a 1))
689 > (skim `(list @)`[0 1 2 3 ~] a)
739 > (skim `(list @)`[0 1 2 3 ~] a)
690 [i=2 t=~[3]]
740 [i=2 t=~[3]]
741+```
691
742
692−
743+---
693−
694−***
695### `++skip`
744### `++skip`
696
745
697Except
746Except
@@ -712,6 +761,7 @@ A list of the same type as `a`.
712
761
713#### Source
762#### Source
714
763
764+```
715 ++ skip :: except
765 ++ skip :: except
716 ~/ %skip
766 ~/ %skip
717 |* [a=(list) b=$-(* ?)]
767 |* [a=(list) b=$-(* ?)]
@@ -719,17 +769,18 @@ A list of the same type as `a`.
719 ^+ a
769 ^+ a
720 ?~ a ~
770 ?~ a ~
721 ?:((b i.a) $(a t.a) [i.a $(a t.a)])
771 ?:((b i.a) $(a t.a) [i.a $(a t.a)])
722−
772+```
723
773
724#### Examples
774#### Examples
725
775
776+```
726 > =a |=(a=@ (gth a 1))
777 > =a |=(a=@ (gth a 1))
727 > (skip `(l)`[0 1 2 3 ~]) a)
778 > (skip `(l)`[0 1 2 3 ~]) a)
728 [i=0 t=[i=1 t=~]]
779 [i=0 t=[i=1 t=~]]
780+```
729
781
730
782
731−
783+---
732−***
733### `++slag`
784### `++slag`
734
785
735Suffix
786Suffix
@@ -747,6 +798,7 @@ A list of the same type as `b`.
747
798
748#### Source
799#### Source
749
800
801+```
750 ++ slag :: suffix
802 ++ slag :: suffix
751 ~/ %slag
803 ~/ %slag
752 |* [a=@ b=(list)]
804 |* [a=@ b=(list)]
@@ -754,18 +806,19 @@ A list of the same type as `b`.
754 ?: =(0 a) b
806 ?: =(0 a) b
755 ?~ b ~
807 ?~ b ~
756 $(b t.b, a (dec a))
808 $(b t.b, a (dec a))
757−
809+```
758
810
759#### Examples
811#### Examples
760
812
813+```
761 > (slag 2 (limo [1 2 3 4 ~]))
814 > (slag 2 (limo [1 2 3 4 ~]))
762 [i=3 t=[i=4 t=~]]
815 [i=3 t=[i=4 t=~]]
763 > (slag 1 (limo [1 2 3 4 ~]))
816 > (slag 1 (limo [1 2 3 4 ~]))
764 [i=2 t=[i=3 t=[i=4 t=~]]]
817 [i=2 t=[i=3 t=[i=4 t=~]]]
818+```
765
819
766
820
767−
821+---
768−***
769### `++snag`
822### `++snag`
770
823
771Index
824Index
@@ -783,6 +836,7 @@ Produces an element of `b`, or crashes if no element exists at that index.
783
836
784#### Source
837#### Source
785
838
839+```
786 ++ snag :: index
840 ++ snag :: index
787 ~/ %snag
841 ~/ %snag
788 |* [a=@ b=(list)]
842 |* [a=@ b=(list)]
@@ -791,18 +845,19 @@ Produces an element of `b`, or crashes if no element exists at that index.
791 ~|('snag-fail' !!)
845 ~|('snag-fail' !!)
792 ?: =(0 a) i.b
846 ?: =(0 a) i.b
793 $(b t.b, a (dec a))
847 $(b t.b, a (dec a))
794−
848+```
795
849
796#### Examples
850#### Examples
797
851
852+```
798 > (snag 2 "asdf")
853 > (snag 2 "asdf")
799 ~~d
854 ~~d
800 > (snag 0 `(list @ud)`~[1 2 3 4])
855 > (snag 0 `(list @ud)`~[1 2 3 4])
801 1
856 1
857+```
802
858
803
859
804−
860+---
805−***
806### `++sort`
861### `++sort`
807
862
808Quicksort
863Quicksort
@@ -821,6 +876,7 @@ A list
821
876
822#### Source
877#### Source
823
878
879+```
824 ++ sort !. :: quicksort
880 ++ sort !. :: quicksort
825 ~/ %sort
881 ~/ %sort
826 |* [a=(list) b=$-([* *] ?)]
882 |* [a=(list) b=$-([* *] ?)]
@@ -831,17 +887,18 @@ A list
831 $(a (skim t.a |=(c/_i.a (b c i.a))))
887 $(a (skim t.a |=(c/_i.a (b c i.a))))
832 ^+ t.a
888 ^+ t.a
833 [i.a $(a (skim t.a |=(c/_i.a !(b c i.a))))]
889 [i.a $(a (skim t.a |=(c/_i.a !(b c i.a))))]
834−
890+```
835
891
836#### Examples
892#### Examples
837
893
894+```
838 > =a =|([p/@ q/@] |.((gth p q)))
895 > =a =|([p/@ q/@] |.((gth p q)))
839 > (sort (limo [0 1 2 3 ~]) a)
896 > (sort (limo [0 1 2 3 ~]) a)
840 ~[3 2 1 0]
897 ~[3 2 1 0]
898+```
841
899
842
900
843−
901+---
844−***
845### `++spin`
902### `++spin`
846
903
847Gate to list, with state
904Gate to list, with state
@@ -866,6 +923,7 @@ A list.
866
923
867#### Source
924#### Source
868
925
926+```
869 ++ spin
927 ++ spin
870 ~/ %spin
928 ~/ %spin
871 |* [a=(list) b=* c=_|=(^ [** +<+])]
929 |* [a=(list) b=* c=_|=(^ [** +<+])]
@@ -876,11 +934,11 @@ A list.
876 [(flop acc) b]
934 [(flop acc) b]
877 =^ res b (c i.a b)
935 =^ res b (c i.a b)
878 $(acc [res acc], a t.a)
936 $(acc [res acc], a t.a)
879−
937+```
880
938
881#### Examples
939#### Examples
882
940
883−
941+```
884 > %^ spin (limo ~[4 5 6]) :: trivial example -- does nothing with the state
942 > %^ spin (limo ~[4 5 6]) :: trivial example -- does nothing with the state
885 |=([n=@ a=@] [n a])
943 |=([n=@ a=@] [n a])
886 0
944 0
@@ -895,6 +953,7 @@ A list.
895 |=([n=@ rng=_og] (rads:rng 10))
953 |=([n=@ rng=_og] (rads:rng 10))
896 ~(. og eny)
954 ~(. og eny)
897 ~[5 5 9 4 1 7 9 9 9 6]
955 ~[5 5 9 4 1 7 9 9 9 6]
956+```
898
957
899#### Discussion
958#### Discussion
900
959
@@ -904,7 +963,7 @@ is the continuation of the RNG.
904
963
905
964
906
965
907−***
966+---
908### `++spun`
967### `++spun`
909
968
910Gate to list, with state
969Gate to list, with state
@@ -913,7 +972,7 @@ Accepts a `list` `a` and a gate `b`. `c` is internal state, initially
913derived by *bunting* the tail of the sample of gate `b`, instead of
972derived by *bunting* the tail of the sample of gate `b`, instead of
914being passed in explicitly as in `++spin`. Produces a list with the
973being passed in explicitly as in `++spin`. Produces a list with the
915gate applied to each element of the original list. `b` is called with a tuple --
974gate 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
917produce a tuple of the transformed element and the (potentially modified)
976produce a tuple of the transformed element and the (potentially modified)
918state `c`.
977state `c`.
919
978
@@ -929,26 +988,28 @@ A list.
929
988
930#### Source
989#### Source
931
990
991+```
932 ++ spun
992 ++ spun
933 ~/ %spun
993 ~/ %spun
934 |* [a=(list) b=_|=(^ [** +<+])]
994 |* [a=(list) b=_|=(^ [** +<+])]
935 p:(spin a +<+.b b)
995 p:(spin a +<+.b b)
936−
996+```
937
997
938#### Examples
998#### Examples
939
999
1000+```
940 > %+ spun (limo ~[4 5 6]) :: `p` as the index and `q` as the list element
1001 > %+ spun (limo ~[4 5 6]) :: `p` as the index and `q` as the list element
941 |=([n=@ a=@] [`(pair)`[a n] +(a)])
1002 |=([n=@ a=@] [`(pair)`[a n] +(a)])
942 ~[[p=0 q=4] [p=1 q=5] [p=2 q=6]]
1003 ~[[p=0 q=4] [p=1 q=5] [p=2 q=6]]
943
1004
944− > =l (limo ~[7 8 9])
1005+ > =l (limo ~[7 8 9])
945 > %+ spun (limo ~[4 5 6]) :: joins two lists into a list of pairs
1006 > %+ spun (limo ~[4 5 6]) :: joins two lists into a list of pairs
946 |=([n=@ a=@] [`(pair)`[(snag a l) n] +(a)])
1007 |=([n=@ a=@] [`(pair)`[(snag a l) n] +(a)])
947 ~[[p=7 q=4] [p=8 q=5] [p=9 q=6]]
1008 ~[[p=7 q=4] [p=8 q=5] [p=9 q=6]]
1009+```
948
1010
949
1011
950−
1012+---
951−***
952### `++swag`
1013### `++swag`
953
1014
954Infix
1015Infix
@@ -966,22 +1027,24 @@ A list of the same type as `c`.
966
1027
967#### Source
1028#### Source
968
1029
1030+```
969− ++ swag
1031+ ++ swag
970 |* [[a=@ a=@] c=(list)]
1032 |* [[a=@ a=@] c=(list)]
971 (scag +<-> (slag +<-< c))
1033 (scag +<-> (slag +<-< c))
972−
1034+```
973
1035
974#### Examples
1036#### Examples
975
1037
1038+```
976 > (swag [2 5] "roly poly")
1039 > (swag [2 5] "roly poly")
977 "ly po"
1040 "ly po"
978
1041
979 > (swag [2 2] (limo [1 2 3 4 ~]))
1042 > (swag [2 2] (limo [1 2 3 4 ~]))
980 [i=3 t=[i=4 t=~]]
1043 [i=3 t=[i=4 t=~]]
1044+```
981
1045
982
1046
983−
1047+---
984−***
985### `++turn`
1048### `++turn`
986
1049
987Gate to list
1050Gate to list
@@ -999,28 +1062,31 @@ A list.
999
1062
1000#### Source
1063#### Source
1001
1064
1065+```
1002− ++ turn
1066+ ++ turn
1003 ~/ %turn
1067 ~/ %turn
1004 |* [a=(list) b=gate]
1068 |* [a=(list) b=gate]
1005 |-
1069 |-
1006 ?~ a ~
1070 ?~ a ~
1007 [i=(b i.a) t=$(a t.a)]
1071 [i=(b i.a) t=$(a t.a)]
1008−
1072+```
1009
1073
1010#### Examples
1074#### Examples
1011
1075
1076+```
1012 > (turn (limo [104 111 111 110 ~]) @t)
1077 > (turn (limo [104 111 111 110 ~]) @t)
1013 <|h o o n|>
1078 <|h o o n|>
1014
1079
1015 > =a |=(a=@ (add a 4))
1080 > =a |=(a=@ (add a 4))
1016 > (turn (limo [1 2 3 4 ~]) a)
1081 > (turn (limo [1 2 3 4 ~]) a)
1017 ~[5 6 7 8]
1082 ~[5 6 7 8]
1083+```
1018
1084
1019#### Discussion
1085#### Discussion
1020
1086
1021`turn` is Hoon's version of 'map' in Haskell.
1087`turn` is Hoon's version of 'map' in Haskell.
1022
1088
1023−***
1089+---
1024### `++weld`
1090### `++weld`
1025
1091
1026Concatenate
1092Concatenate
@@ -1033,26 +1099,28 @@ Concatenate two `++list`s `a` and `b`.
1033
1099
1034#### Source
1100#### Source
1035
1101
1102+```
1036− ++ weld
1103+ ++ weld
1037 ~/ %weld
1104 ~/ %weld
1038 |* [a=(list) b=(list)]
1105 |* [a=(list) b=(list)]
1039 => .(a ^.(homo a), b ^.(homo b))
1106 => .(a ^.(homo a), b ^.(homo b))
1040 |- ^+ b
1107 |- ^+ b
1041 ?~ a b
1108 ?~ a b
1042 [i.a $(a t.a)]
1109 [i.a $(a t.a)]
1043−
1110+```
1044
1111
1045#### Examples
1112#### Examples
1046
1113
1114+```
1047 > (weld "urb" "it")
1115 > (weld "urb" "it")
1048 ~[~~u ~~r ~~b ~~i ~~t]
1116 ~[~~u ~~r ~~b ~~i ~~t]
1049
1117
1050 > (weld (limo [1 2 ~]) (limo [3 4 ~]))
1118 > (weld (limo [1 2 ~]) (limo [3 4 ~]))
1051 ~[1 2 3 4]
1119 ~[1 2 3 4]
1120+```
1052
1121
1053
1122
1054−
1123+---
1055−***
1056### `++welp`
1124### `++welp`
1057
1125
1058Perfect weld
1126Perfect weld
@@ -1072,7 +1140,8 @@ A list.
1072
1140
1073#### Source
1141#### Source
1074
1142
1143+```
1075− ++ welp
1144+ ++ welp
1076 =| [* *]
1145 =| [* *]
1077 |%
1146 |%
1078 +- $
1147 +- $
@@ -1080,10 +1149,11 @@ A list.
1080 +<-(. +<+)
1149 +<-(. +<+)
1081 +<-(+ $(+<- +<->))
1150 +<-(+ $(+<- +<->))
1082 --
1151 --
1083−
1152+```
1084
1153
1085#### Examples
1154#### Examples
1086
1155
1156+```
1087 > (welp "foo" "bar")
1157 > (welp "foo" "bar")
1088 "foobar"
1158 "foobar"
1089
1159
@@ -1096,10 +1166,10 @@ A list.
1096
1166
1097 > (welp [sa+1 so+2 ~] si=3)
1167 > (welp [sa+1 so+2 ~] si=3)
1098 [[%sa 1] [%so 2] si=3]
1168 [[%sa 1] [%so 2] si=3]
1169+```
1099
1170
1100
1171
1101−
1172+---
1102−***
1103### `++zing`
1173### `++zing`
1104
1174
1105Cons
1175Cons
@@ -1117,7 +1187,8 @@ A list.
1117
1187
1118#### Source
1188#### Source
1119
1189
1190+```
1120− ++ zing
1191+ ++ zing
1121 =| *
1192 =| *
1122 |%
1193 |%
1123 +- $
1194 +- $
@@ -1125,16 +1196,17 @@ A list.
1125 +<
1196 +<
1126 (welp +<- $(+< +<+))
1197 (welp +<- $(+< +<+))
1127 --
1198 --
1128−
1199+```
1129
1200
1130
1201
1131#### Examples
1202#### Examples
1132
1203
1204+```
1133 > (zing (limo [(limo ['a' 'b' 'c' ~]) (limo ['e' 'f' 'g' ~]) (limo ['h' 'i' 'j' ~]) ~]))
1205 > (zing (limo [(limo ['a' 'b' 'c' ~]) (limo ['e' 'f' 'g' ~]) (limo ['h' 'i' 'j' ~]) ~]))
1134 ~['a' 'b' 'c' 'e' 'f' 'g' 'h' 'i' 'j']
1206 ~['a' 'b' 'c' 'e' 'f' 'g' 'h' 'i' 'j']
1135
1207
1136 > (zing (limo [(limo [1 'a' 2 'b' ~]) (limo [3 'c' 4 'd' ~]) ~]))
1208 > (zing (limo [(limo [1 'a' 2 'b' ~]) (limo [3 'c' 4 'd' ~]) ~]))
1137 ~[1 97 2 98 3 99 4 100]
1209 ~[1 97 2 98 3 99 4 100]
1210+```
1138
1211
1139−
1212+---
1140−***
docs/reference/library/2c.umd+143−68
@@ -1,9 +1,12 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'6'
3+ title/'2c: Bit Arithmetic'
4+ ==
4
5
6+;>
5
7
6# 2c: bit arithmetic
8# 2c: bit arithmetic
9+
7### `++bex`
10### `++bex`
8
11
9Binary exponent
12Binary exponent
@@ -20,15 +23,18 @@ An atom.
20
23
21#### Source
24#### Source
22
25
26+```
23− ++ bex
27+ ++ bex
24 ~/ %bex
28 ~/ %bex
25 |= a=@
29 |= a=@
26 ^- @
30 ^- @
27 ?: =(0 a) 1
31 ?: =(0 a) 1
28 (mul 2 $(a (dec a)))
32 (mul 2 $(a (dec a)))
33+```
29
34
30#### Examples
35#### Examples
31
36
37+```
32 > (bex 4)
38 > (bex 4)
33 16
39 16
34
40
@@ -37,9 +43,9 @@ An atom.
37
43
38 > (bex 0)
44 > (bex 0)
39 1
45 1
46+```
40
47
41−***
48+---
42−
43### `++can`
49### `++can`
44
50
45Assemble
51Assemble
@@ -60,22 +66,25 @@ An atom.
60
66
61#### Source
67#### Source
62
68
69+```
63− ++ can
70+ ++ can
64 ~/ %can
71 ~/ %can
65 |= [a=bloq b=(list [p=@ q=@])]
72 |= [a=bloq b=(list [p=@ q=@])]
66 ^- @
73 ^- @
67 ?~ b 0
74 ?~ b 0
68 (add (end a p.i.b q.i.b) (lsh a p.i.b $(b t.b)))
75 (add (end a p.i.b q.i.b) (lsh a p.i.b $(b t.b)))
76+```
69
77
70#### Examples
78#### Examples
71
79
80+```
72 > `@ub`21 :: @ub is the binary aura
81 > `@ub`21 :: @ub is the binary aura
73− 0b1.0101
82+ 0b1.0101
74
83
75− > `@ub`(can 3 ~[[1 21]])
84+ > `@ub`(can 3 ~[[1 21]])
76 0b1.0101
85 0b1.0101
77
86
78− > `@ub`(can 3 ~[[1 1]])
87+ > `@ub`(can 3 ~[[1 1]])
79 0b1
88 0b1
80
89
81 > `@ub`(can 0 ~[[1 255]])
90 > `@ub`(can 0 ~[[1 255]])
@@ -92,9 +101,9 @@ An atom.
92
101
93 > `@ux`(can 3 ~[[1 'a'] [2 'bc']])
102 > `@ux`(can 3 ~[[1 'a'] [2 'bc']])
94 0x63.6261
103 0x63.6261
104+```
95
105
96−
106+---
97−***
98### `++cat`
107### `++cat`
99
108
100Concatenate
109Concatenate
@@ -116,14 +125,16 @@ An atom.
116
125
117#### Source
126#### Source
118
127
128+```
119− ++ cat
129+ ++ cat
120 ~/ %cat
130 ~/ %cat
121 |= [a=bloq b=@ c=@]
131 |= [a=bloq b=@ c=@]
122 (add (lsh a (met a b) c) b)
132 (add (lsh a (met a b) c) b)
123−
133+```
124
134
125#### Examples
135#### Examples
126
136
137+```
127 > `@ub`(cat 3 1 0) :: @ub is the binary aura
138 > `@ub`(cat 3 1 0) :: @ub is the binary aura
128 0b1
139 0b1
129
140
@@ -153,9 +164,9 @@ An atom.
153
164
154 > (cat 2 256 255)
165 > (cat 2 256 255)
155 1.044.736
166 1.044.736
167+```
156
168
157−
169+---
158−***
159### `++cut`
170### `++cut`
160
171
161Slice
172Slice
@@ -179,13 +190,16 @@ An atom.
179
190
180#### Source
191#### Source
181
192
193+```
182− ++ cut
194+ ++ cut
183 ~/ %cut
195 ~/ %cut
184 |= [a=bloq [b=@u c=@u] d=@]
196 |= [a=bloq [b=@u c=@u] d=@]
185 (end a c (rsh a b d))
197 (end a c (rsh a b d))
198+```
186
199
187#### Examples
200#### Examples
188
201
202+```
189 > (cut 0 [1 1] 2)
203 > (cut 0 [1 1] 2)
190 1
204 1
191
205
@@ -209,10 +223,10 @@ An atom.
209
223
210 > `@ub`(cut 0 [3 6] 0b1111.0000.1101)
224 > `@ub`(cut 0 [3 6] 0b1111.0000.1101)
211 0b10.0001
225 0b10.0001
226+```
212
227
213
228
214−
229+---
215−***
216### `++end`
230### `++end`
217
231
218Tail
232Tail
@@ -234,14 +248,16 @@ An atom.
234
248
235#### Source
249#### Source
236
250
251+```
237− ++ end
252+ ++ end
238 ~/ %end
253 ~/ %end
239 |= [a=bloq b=@u c=@]
254 |= [a=bloq b=@u c=@]
240 (mod c (bex (mul (bex a) b)))
255 (mod c (bex (mul (bex a) b)))
241−
256+```
242
257
243#### Examples
258#### Examples
244
259
260+```
245 > (end 2 2 255)
261 > (end 2 2 255)
246 255
262 255
247
263
@@ -274,10 +290,10 @@ An atom.
274
290
275 > `@t`(end 3 2 'abc') :: @t is the cord aura
291 > `@t`(end 3 2 'abc') :: @t is the cord aura
276 'ab'
292 'ab'
293+```
277
294
278
295
279−
296+---
280−***
281### `++fil`
297### `++fil`
282
298
283Fill bloqstream
299Fill bloqstream
@@ -298,7 +314,8 @@ An atom.
298
314
299#### Source
315#### Source
300
316
317+```
301− ++ fil
318+ ++ fil
302 |= [a=bloq b=@u c=@]
319 |= [a=bloq b=@u c=@]
303 =+ n=0
320 =+ n=0
304 =+ d=c
321 =+ d=c
@@ -306,10 +323,11 @@ An atom.
306 ?: =(n b)
323 ?: =(n b)
307 (rsh a 1 d)
324 (rsh a 1 d)
308 $(d (add c (lsh a 1 d)), n +(n))
325 $(d (add c (lsh a 1 d)), n +(n))
309−
326+```
310
327
311#### Examples
328#### Examples
312
329
330+```
313 > `@t`(fil 3 5 %a) :: @t is the cord (string) aura
331 > `@t`(fil 3 5 %a) :: @t is the cord (string) aura
314 'aaaaa'
332 'aaaaa'
315
333
@@ -324,10 +342,10 @@ An atom.
324
342
325 > `@ub`(fil 2 6 1) :: @ub is the binary aura
343 > `@ub`(fil 2 6 1) :: @ub is the binary aura
326 0b1.0001.0001.0001.0001.0001
344 0b1.0001.0001.0001.0001.0001
345+```
327
346
328
347
329−
348+---
330−***
331### `++lsh`
349### `++lsh`
332
350
333Left-shift
351Left-shift
@@ -348,14 +366,16 @@ An atom.
348
366
349#### Source
367#### Source
350
368
369+```
351− ++ lsh
370+ ++ lsh
352 ~/ %lsh
371 ~/ %lsh
353 |= [a=bloq b=@u c=@]
372 |= [a=bloq b=@u c=@]
354 (mul (bex (mul (bex a) b)) c)
373 (mul (bex (mul (bex a) b)) c)
355−
374+```
356
375
357#### Examples
376#### Examples
358
377
378+```
359 > `@ub`1 :: @ub is the binary aura
379 > `@ub`1 :: @ub is the binary aura
360 0b1
380 0b1
361
381
@@ -373,10 +393,10 @@ An atom.
373
393
374 > (lsh 3 1 255)
394 > (lsh 3 1 255)
375 65.280
395 65.280
396+```
376
397
377
398
378−
399+---
379−***
380### `++met`
400### `++met`
381
401
382Measure
402Measure
@@ -391,7 +411,8 @@ Computes the number of blocks of size `a` in `b`, producing an atom.
391
411
392#### Source
412#### Source
393
413
414+```
394− ++ met
415+ ++ met
395 ~/ %met
416 ~/ %met
396 |= [a=bloq b=@]
417 |= [a=bloq b=@]
397 ^- @
418 ^- @
@@ -399,9 +420,11 @@ Computes the number of blocks of size `a` in `b`, producing an atom.
399 |-
420 |-
400 ?: =(0 b) c
421 ?: =(0 b) c
401 $(b (rsh a 1 b), c +(c))
422 $(b (rsh a 1 b), c +(c))
423+```
402
424
403#### Examples
425#### Examples
404
426
427+```
405 > (met 0 1)
428 > (met 0 1)
406 1
429 1
407
430
@@ -416,10 +439,10 @@ Computes the number of blocks of size `a` in `b`, producing an atom.
416
439
417 > (met 3 'abcde')
440 > (met 3 'abcde')
418 5
441 5
442+```
419
443
420
444
421−
445+---
422−***
423### `++rap`
446### `++rap`
424
447
425Assemble non-zero
448Assemble non-zero
@@ -438,16 +461,19 @@ An atom.
438
461
439#### Source
462#### Source
440
463
464+```
441− ++ rap
465+ ++ rap
442 ~/ %rap
466 ~/ %rap
443 |= [a=bloq b=(list @)]
467 |= [a=bloq b=(list @)]
444 ^- @
468 ^- @
445 =+ ~
469 =+ ~
446 ?~ b 0
470 ?~ b 0
447 (cat a i.b $(b t.b))
471 (cat a i.b $(b t.b))
472+```
448
473
449#### Examples
474#### Examples
450
475
476+```
451 > `@ub`(rap 2 [1 2 3 4 ~]) :: @ub is the binary aura
477 > `@ub`(rap 2 [1 2 3 4 ~]) :: @ub is the binary aura
452 0b100.0011.0010.0001
478 0b100.0011.0010.0001
453
479
@@ -471,12 +497,13 @@ An atom.
471
497
472 > `@ub`11
498 > `@ub`11
473 0b1011
499 0b1011
500+```
474
501
475#### Discussion
502#### Discussion
476
503
477Any element of the value `0` is not included in concatenation.
504Any element of the value `0` is not included in concatenation.
478
505
479−***
506+---
480### `++rep`
507### `++rep`
481
508
482Assemble single
509Assemble single
@@ -495,7 +522,8 @@ An atom.
495
522
496#### Source
523#### Source
497
524
525+```
498− ++ rep
526+ ++ rep
499 ~/ %rep
527 ~/ %rep
500 |= [a=bloq b=(list @)]
528 |= [a=bloq b=(list @)]
501 ^- @
529 ^- @
@@ -503,9 +531,11 @@ An atom.
503 |-
531 |-
504 ?~ b 0
532 ?~ b 0
505 (add (lsh a c (end a 1 i.b)) $(c +(c), b t.b))
533 (add (lsh a c (end a 1 i.b)) $(c +(c), b t.b))
534+```
506
535
507#### Examples
536#### Examples
508
537
538+```
509 > `@ub`(rep 2 [1 2 3 4 ~]) :: @ub is the binary aura
539 > `@ub`(rep 2 [1 2 3 4 ~]) :: @ub is the binary aura
510 0b100.0011.0010.0001
540 0b100.0011.0010.0001
511
541
@@ -535,10 +565,10 @@ An atom.
535
565
536 > `@ub`(rep 3 [12 166 8 34 ~])
566 > `@ub`(rep 3 [12 166 8 34 ~])
537 0b10.0010.0000.1000.1010.0110.0000.1100
567 0b10.0010.0000.1000.1010.0110.0000.1100
568+```
538
569
539
570
540−
571+---
541−***
542### `++rip`
572### `++rip`
543
573
544Disassemble
574Disassemble
@@ -557,15 +587,18 @@ A list of atoms.
557
587
558#### Source
588#### Source
559
589
590+```
560− ++ rip
591+ ++ rip
561 ~/ %rip
592 ~/ %rip
562 |= [a=bloq b=@]
593 |= [a=bloq b=@]
563 ^- (list @)
594 ^- (list @)
564 ?: =(0 b) ~
595 ?: =(0 b) ~
565 [(end a 1 b) $(b (rsh a 1 b))]
596 [(end a 1 b) $(b (rsh a 1 b))]
597+```
566
598
567#### Examples
599#### Examples
568
600
601+```
569 > `@ub`155 :: @ub is the binary aura
602 > `@ub`155 :: @ub is the binary aura
570 0b1001.1011
603 0b1001.1011
571
604
@@ -592,10 +625,10 @@ A list of atoms.
592
625
593 > (rip 3 256)
626 > (rip 3 256)
594 ~[0 1]
627 ~[0 1]
628+```
595
629
596
630
597−
631+---
598−***
599### `++rsh`
632### `++rsh`
600
633
601Right-shift
634Right-shift
@@ -616,13 +649,16 @@ An atom.
616
649
617#### Source
650#### Source
618
651
652+```
619− ++ rsh
653+ ++ rsh
620 ~/ %rsh
654 ~/ %rsh
621 |= [a=bloq b=@u c=@]
655 |= [a=bloq b=@u c=@]
622 (div c (bex (mul (bex a) b)))
656 (div c (bex (mul (bex a) b)))
657+```
623
658
624#### Examples
659#### Examples
625
660
661+```
626 > `@ub`145 :: @ub is the binary aura
662 > `@ub`145 :: @ub is the binary aura
627 0b1001.0001
663 0b1001.0001
628
664
@@ -655,10 +691,10 @@ An atom.
655
691
656 > `@ux`(rsh 3 1 'abc')
692 > `@ux`(rsh 3 1 'abc')
657 0x6362
693 0x6362
694+```
658
695
659
696
660−
697+---
661−***
662### `++swp`
698### `++swp`
663
699
664Reverse block order
700Reverse block order
@@ -679,10 +715,13 @@ An atom
679
715
680#### Source
716#### Source
681
717
718+```
682− ++ swp |=([a=bloq b=@] (rep a (flop (rip a b))))
719+ ++ swp |=([a=bloq b=@] (rep a (flop (rip a b))))
720+```
683
721
684#### Examples
722#### Examples
685
723
724+```
686 > `@ub`24 :: @ub is the binary aura
725 > `@ub`24 :: @ub is the binary aura
687 0b1.1000
726 0b1.1000
688
727
@@ -697,10 +736,10 @@ An atom
697
736
698 > (swp 0 128)
737 > (swp 0 128)
699 1
738 1
739+```
700
740
701
741
702−
742+---
703−***
704### `++xeb`
743### `++xeb`
705
744
706Binary logarithm
745Binary logarithm
@@ -717,14 +756,17 @@ An atom.
717
756
718#### Source
757#### Source
719
758
759+```
720− ++ xeb
760+ ++ xeb
721 ~/ %xeb
761 ~/ %xeb
722 |= a=@
762 |= a=@
723 ^- @
763 ^- @
724 (met 0 a)
764 (met 0 a)
765+```
725
766
726#### Examples
767#### Examples
727
768
769+```
728 > (xeb 31)
770 > (xeb 31)
729 5
771 5
730
772
@@ -742,11 +784,11 @@ An atom.
742
784
743 > (xeb 2)
785 > (xeb 2)
744 2
786 2
787+```
745
788
746
789
747−
790+---
748−***
749−### `++fe`
791+### `++fe`
750
792
751Modulo bloq
793Modulo bloq
752
794
@@ -758,9 +800,11 @@ Core that contains arms for `bloq` and modular integer operations.
758
800
759#### Source
801#### Source
760
802
803+```
761 |_ a=bloq
804 |_ a=bloq
805+```
762
806
763−****
807+---
764### `++dif`
808### `++dif`
765
809
766Produces the difference between two atoms in the modular basis
810Produces the difference between two atoms in the modular basis
@@ -780,10 +824,13 @@ A `@s`
780
824
781#### Source
825#### Source
782
826
827+```
783 ++ dif |=([b=@ c=@] (sit (sub (add out (sit b)) (sit c))))
828 ++ dif |=([b=@ c=@] (sit (sub (add out (sit b)) (sit c))))
829+```
784
830
785#### Examples
831#### Examples
786
832
833+```
787 > (~(dif fe 3) 63 64)
834 > (~(dif fe 3) 63 64)
788 255
835 255
789
836
@@ -807,8 +854,9 @@ A `@s`
807
854
808 > (~(dif fe 2) 63 64)
855 > (~(dif fe 2) 63 64)
809 15
856 15
857+```
810
858
811−***
859+---
812### `++inv`
860### `++inv`
813
861
814Inverse
862Inverse
@@ -825,10 +873,13 @@ An atom.
825
873
826#### Source
874#### Source
827
875
876+```
828− ++ inv |=(b=@ (sub (dec out) (sit b)))
877+ ++ inv |=(b=@ (sub (dec out) (sit b)))
878+```
829
879
830#### Examples
880#### Examples
831
881
882+```
832 > (~(inv fe 3) 255)
883 > (~(inv fe 3) 255)
833 0
884 0
834
885
@@ -846,8 +897,9 @@ An atom.
846
897
847 > (~(inv fe 3) 55)
898 > (~(inv fe 3) 55)
848 200
899 200
900+```
849
901
850−***
902+---
851### `++net`
903### `++net`
852
904
853Flip endianness
905Flip endianness
@@ -864,7 +916,8 @@ An atom.
864
916
865#### Source
917#### Source
866
918
919+```
867− ++ net |= b=@ ^- @
920+ ++ net |= b=@ ^- @
868 => .(b (sit b))
921 => .(b (sit b))
869 ?: (lte a 3)
922 ?: (lte a 3)
870 b
923 b
@@ -872,9 +925,11 @@ An atom.
872 %+ con
925 %+ con
873 (lsh c 1 $(a c, b (cut c [0 1] b)))
926 (lsh c 1 $(a c, b (cut c [0 1] b)))
874 $(a c, b (cut c [1 1] b))
927 $(a c, b (cut c [1 1] b))
928+```
875
929
876#### Examples
930#### Examples
877
931
932+```
878 > (~(net fe 3) 64)
933 > (~(net fe 3) 64)
879 64
934 64
880
935
@@ -931,8 +986,9 @@ An atom.
931
986
932 > (~(net fe 6) 5)
987 > (~(net fe 6) 5)
933 360.287.970.189.639.680
988 360.287.970.189.639.680
989+```
934
990
935−***
991+---
936### `++out`
992### `++out`
937
993
938Max integer value
994Max integer value
@@ -949,10 +1005,13 @@ An atom.
949
1005
950#### Source
1006#### Source
951
1007
1008+```
952 ++ out (bex (bex a))
1009 ++ out (bex (bex a))
1010+```
953
1011
954#### Examples
1012#### Examples
955
1013
1014+```
956 > ~(out fe 0)
1015 > ~(out fe 0)
957 2
1016 2
958
1017
@@ -976,8 +1035,9 @@ An atom.
976 462.881.473.913.110.540.827.237.163.350.510.684.586.298.239.947.245.938.479
1035 462.881.473.913.110.540.827.237.163.350.510.684.586.298.239.947.245.938.479
977 .716.304.835.356.329.624.224.137.216
1036 .716.304.835.356.329.624.224.137.216
978 \/ \/
1037 \/ \/
1038+```
979
1039
980−***
1040+---
981### `++rol`
1041### `++rol`
982
1042
983Roll left
1043Roll left
@@ -1000,14 +1060,17 @@ An atom.
1000
1060
1001#### Source
1061#### Source
1002
1062
1063+```
1003− ++ rol |= [b=bloq c=@ d=@] ^- @
1064+ ++ rol |= [b=bloq c=@ d=@] ^- @
1004 =+ e=(sit d)
1065 =+ e=(sit d)
1005 =+ f=(bex (sub a b))
1066 =+ f=(bex (sub a b))
1006 =+ g=(mod c f)
1067 =+ g=(mod c f)
1007 (sit (con (lsh b g e) (rsh b (sub f g) e)))
1068 (sit (con (lsh b g e) (rsh b (sub f g) e)))
1069+```
1008
1070
1009#### Examples
1071#### Examples
1010
1072
1073+```
1011 > `@ux`(~(rol fe 6) 4 3 0xabac.dedf.1213)
1074 > `@ux`(~(rol fe 6) 4 3 0xabac.dedf.1213)
1012 0x1213.0000.abac.dedf
1075 0x1213.0000.abac.dedf
1013
1076
@@ -1022,8 +1085,9 @@ An atom.
1022
1085
1023 > `@t`(~(rol fe 5) 3 0 'dfgh')
1086 > `@t`(~(rol fe 5) 3 0 'dfgh')
1024 'dfgh'
1087 'dfgh'
1088+```
1025
1089
1026−***
1090+---
1027### `++ror`
1091### `++ror`
1028
1092
1029Roll right
1093Roll right
@@ -1046,15 +1110,17 @@ An atom.
1046
1110
1047#### Source
1111#### Source
1048
1112
1113+```
1049− ++ ror |= [b=bloq c=@ d=@] ^- @
1114+ ++ ror |= [b=bloq c=@ d=@] ^- @
1050 =+ e=(sit d)
1115 =+ e=(sit d)
1051 =+ f=(bex (sub a b))
1116 =+ f=(bex (sub a b))
1052 =+ g=(mod c f)
1117 =+ g=(mod c f)
1053 (sit (con (rsh b g e) (lsh b (sub f g) e)))
1118 (sit (con (rsh b g e) (lsh b (sub f g) e)))
1054−
1119+```
1055
1120
1056#### Examples
1121#### Examples
1057
1122
1123+```
1058 > `@ux`(~(ror fe 6) 4 1 0xabac.dedf.1213)
1124 > `@ux`(~(ror fe 6) 4 1 0xabac.dedf.1213)
1059 0x1213.0000.abac.dedf
1125 0x1213.0000.abac.dedf
1060
1126
@@ -1072,8 +1138,9 @@ An atom.
1072
1138
1073 > `@t`(~(rol fe 5) 3 2 'hijk')
1139 > `@t`(~(rol fe 5) 3 2 'hijk')
1074 'jkhi'
1140 'jkhi'
1141+```
1075
1142
1076−***
1143+---
1077### `++sit`
1144### `++sit`
1078
1145
1079Enforce modulo
1146Enforce modulo
@@ -1092,10 +1159,13 @@ An atom.
1092
1159
1093#### Source
1160#### Source
1094
1161
1162+```
1095− ++ sit |=(b=@ (end a 1 b))
1163+ ++ sit |=(b=@ (end a 1 b))
1164+```
1096
1165
1097#### Examples
1166#### Examples
1098
1167
1168+```
1099 > (~(sit fe 3) 255)
1169 > (~(sit fe 3) 255)
1100 255
1170 255
1101
1171
@@ -1128,8 +1198,9 @@ An atom.
1128
1198
1129 > (~(sit fe 0) 1)
1199 > (~(sit fe 0) 1)
1130 1
1200 1
1201+```
1131
1202
1132−***
1203+---
1133
1204
1134### `++sum`
1205### `++sum`
1135
1206
@@ -1151,10 +1222,13 @@ An atom.
1151
1222
1152#### Source
1223#### Source
1153
1224
1225+```
1154− ++ sum |=([b=@ c=@] (sit (add b c)))
1226+ ++ sum |=([b=@ c=@] (sit (add b c)))
1227+```
1155
1228
1156#### Examples
1229#### Examples
1157
1230
1231+```
1158 > (~(sum fe 3) 10 250)
1232 > (~(sum fe 3) 10 250)
1159 4
1233 4
1160
1234
@@ -1175,5 +1249,6 @@ An atom.
1175
1249
1176 > (~(sum fe 4) 10.000 100.000)
1250 > (~(sum fe 4) 10.000 100.000)
1177 44.464
1251 44.464
1252+```
1178
1253
1179−***
1254+---
docs/reference/library/2d.umd+51−23
@@ -1,9 +1,12 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'7'
3+ title/'2d: Bit Logic'
4+ ==
4
5
6+;>
5
7
6# 2d: bit logic
8# 2d: bit logic
9+
7### `++con`
10### `++con`
8
11
9Binary OR
12Binary OR
@@ -22,7 +25,8 @@ An atom.
22
25
23#### Source
26#### Source
24
27
28+```
25− ++ con
29+ ++ con
26 ~/ %con
30 ~/ %con
27 |= [a=@ b=@]
31 |= [a=@ b=@]
28 =+ [c=0 d=0]
32 =+ [c=0 d=0]
@@ -38,9 +42,11 @@ An atom.
38 =(0 (end 0 1 b))
42 =(0 (end 0 1 b))
39 ==
43 ==
40 ==
44 ==
45+```
41
46
42#### Examples
47#### Examples
43
48
49+```
44 > (con 0b0 0b1)
50 > (con 0b0 0b1)
45 1
51 1
46
52
@@ -51,7 +57,7 @@ An atom.
51 0
57 0
52
58
53 > `@ub`(con 0b1111.0000 0b1.0011)
59 > `@ub`(con 0b1111.0000 0b1.0011)
54− 0b1111.0011
60+ 0b1111.0011
55
61
56 > (con 4 4)
62 > (con 4 4)
57 4
63 4
@@ -70,7 +76,7 @@ An atom.
70
76
71 > (con 534 987)
77 > (con 534 987)
72 991
78 991
73−
79+```
74
80
75#### Discussion
81#### Discussion
76
82
@@ -80,11 +86,13 @@ sample. If either bit is 1, the corresponding product bit is set
80to 1. Otherwise, the corresponding product bit is set to 0.
86to 1. Otherwise, the corresponding product bit is set to 0.
81
87
82Take the example of `(con 8 12)`. It's easy to see how this operation works when
88Take 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.
84
90
91+```
85 0b1000 :: 8 (sample)
92 0b1000 :: 8 (sample)
86 0b1100 :: 12 (sample)
93 0b1100 :: 12 (sample)
87 0b1100 :: 12 (product)
94 0b1100 :: 12 (product)
95+```
88
96
89Note that the names `con` (conjunction) for OR and `dis` (disjunction) for AND
97Note that the names `con` (conjunction) for OR and `dis` (disjunction) for AND
90are given to opposite operators in Hoon when compared to other computing
98are 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
93bitwise AND is the logical conjunction.
101bitwise AND is the logical conjunction.
94
102
95
103
96−***
104+---
97### `++dis`
105### `++dis`
98
106
99Binary AND
107Binary AND
@@ -112,7 +120,8 @@ An atom.
112
120
113#### Source
121#### Source
114
122
123+```
115− ++ dis
124+ ++ dis
116 ~/ %dis
125 ~/ %dis
117 |= [a=@ b=@]
126 |= [a=@ b=@]
118 =| [c=@ d=@]
127 =| [c=@ d=@]
@@ -128,9 +137,11 @@ An atom.
128 =(0 (end 0 1 b))
137 =(0 (end 0 1 b))
129 ==
138 ==
130 ==
139 ==
140+```
131
141
132#### Examples
142#### Examples
133
143
144+```
134 > `@ub`9
145 > `@ub`9
135 0b1001
146 0b1001
136
147
@@ -154,7 +165,7 @@ An atom.
154
165
155 > (dis 534 987)
166 > (dis 534 987)
156 530
167 530
157−
168+```
158
169
159#### Discussion
170#### Discussion
160
171
@@ -166,9 +177,11 @@ corresponding product bit is set to 0.
166Take the example of `(dis 8 12)`. It's easy to see how this operation works when
177Take the example of `(dis 8 12)`. It's easy to see how this operation works when
167its samples and its product are stacked.
178its samples and its product are stacked.
168
179
180+```
169− 0b1000 :: 8 (sample)
181+ 0b1000 :: 8 (sample)
170− 0b1100 :: 12 (sample)
182+ 0b1100 :: 12 (sample)
171− 0b1000 :: 8 (product)
183+ 0b1000 :: 8 (product)
184+```
172
185
173Note that the names `dis` (disjunction) for AND and `con` (conjuction) for OR
186Note that the names `dis` (disjunction) for AND and `con` (conjuction) for OR
174are given to opposite operators in Hoon when compared to other computing
187are 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,
176where `0` is false and `1` is true, bitwise OR is the logical disjunction and
189where `0` is false and `1` is true, bitwise OR is the logical disjunction and
177bitwise AND is the logical conjunction.
190bitwise AND is the logical conjunction.
178
191
179−***
192+---
180### `++mix`
193### `++mix`
181
194
182Binary XOR
195Binary XOR
@@ -195,7 +208,8 @@ An atom.
195
208
196#### Source
209#### Source
197
210
211+```
198− ++ mix
212+ ++ mix
199 ~/ %mix
213 ~/ %mix
200 |= [a=@ b=@]
214 |= [a=@ b=@]
201 ^- @
215 ^- @
@@ -208,9 +222,11 @@ An atom.
208 c +(c)
222 c +(c)
209 d (add d (lsh 0 c =((end 0 1 a) (end 0 1 b))))
223 d (add d (lsh 0 c =((end 0 1 a) (end 0 1 b))))
210 ==
224 ==
225+```
211
226
212#### Examples
227#### Examples
213
228
229+```
214 > `@ub`2
230 > `@ub`2
215 0b10
231 0b10
216
232
@@ -240,6 +256,7 @@ An atom.
240
256
241 > (mix 534 987)
257 > (mix 534 987)
242 461
258 461
259+```
243
260
244#### Discussion
261#### Discussion
245
262
@@ -251,11 +268,13 @@ bit is set to 1. Otherwise, the corresponding product bit is set to 0.
251Take the example of `(mix 8 12)`. It's easy to see how this operation works when
268Take the example of `(mix 8 12)`. It's easy to see how this operation works when
252its samples and its product are stacked.
269its samples and its product are stacked.
253
270
271+```
254− 0b1000 :: 8 (sample)
272+ 0b1000 :: 8 (sample)
255− 0b1100 :: 12 (sample)
273+ 0b1100 :: 12 (sample)
256− 0b100 :: 4 (product)
274+ 0b100 :: 4 (product)
275+```
257
276
258−***
277+---
259### `++not`
278### `++not`
260
279
261Binary NOT
280Binary NOT
@@ -277,12 +296,14 @@ An atom.
277
296
278#### Source
297#### Source
279
298
299+```
280− ++ not |= [a=bloq b=@ c=@]
300+ ++ not |= [a=bloq b=@ c=@]
281 (mix c (dec (bex (mul b (bex a)))))
301 (mix c (dec (bex (mul b (bex a)))))
282−
302+```
283
303
284#### Examples
304#### Examples
285
305
306+```
286 > `@ub`24
307 > `@ub`24
287 0b1.1000
308 0b1.1000
288
309
@@ -300,6 +321,7 @@ An atom.
300
321
301 > (not 1 1 (not 1 1 10))
322 > (not 1 1 (not 1 1 10))
302 10
323 10
324+```
303
325
304#### Discussion
326#### Discussion
305
327
@@ -312,37 +334,43 @@ their [block size](../1c). Decimal `7`, for example, is `0b111` in binary, and
312has one implicit zero in the context of a block of size `2`, which has a
334has one implicit zero in the context of a block of size `2`, which has a
313bitwidth of 4. Let's try `not` on `7` with a single block of size `2`.
335bitwidth of 4. Let's try `not` on `7` with a single block of size `2`.
314
336
337+```
315 > `@ub`(not 2 1 0b111)
338 > `@ub`(not 2 1 0b111)
316 0b1000
339 0b1000
317
340
318 > `@u`0b1000
341 > `@u`0b1000
319 8
342 8
343+```
320
344
321This happened because `0b111` is considered as `0b0111` by the `not` operator
345This happened because `0b111` is considered as `0b0111` by the `not` operator
322when dealing with a single block of size `2`. The NOT of `7`, then, is `0b1000`,
346when 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.
324
348
325When we pass `not` a single block of size `3`, there is a bitwidth of 8 to
349When we pass `not` a single block of size `3`, there is a bitwidth of 8 to
326fill with binary information. So the remaining leading digits of `0b111` are,
350fill with binary information. So the remaining leading digits of `0b111` are,
327again, treated as `0`.
351again, treated as `0`.
328
352
353+```
329 > `@ub`(not 3 1 0b111)
354 > `@ub`(not 3 1 0b111)
330 0b1111.1000
355 0b1111.1000
331
356
332 > `@u`0b1111.1000
357 > `@u`0b1111.1000
333 248
358 248
359+```
334
360
335This works when going to a smaller block size, too.
361This works when going to a smaller block size, too.
336
362
363+```
337 > `@ub`(not 1 1 0b1011)
364 > `@ub`(not 1 1 0b1011)
338 0b100
365 0b100
339
366
340 > `@u`0b100
367 > `@u`0b100
341 4
368 4
369+```
342
370
343What's happening here may not be readily apparent. But we're only flipping the
371What's happening here may not be readily apparent. But we're only flipping the
344last block of size `1` (bitwidth 2) of the binary `0b111`. That is, we leave
372last block of size `1` (bitwidth 2) of the binary `0b111`. That is, we leave
345the "0b1" piece just the same and manipulate the "11" that the number ends with.
373the "0b1" piece just the same and manipulate the "11" that the number ends with.
346
374
347
375
348−***
376+---
docs/reference/library/2e.umd+34−20
@@ -1,9 +1,12 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'8'
3+ title/'2e: Insecure Hashing'
4+ ==
4
5
6+;>
5
7
6# 2e: insecure hashing
8# 2e: insecure hashing
9+
7### `++fnv`
10### `++fnv`
8
11
9FNV scrambler
12FNV scrambler
@@ -22,10 +25,13 @@ An atom.
22
25
23#### Source
26#### Source
24
27
28+```
25− ++ fnv |=(a=@ (end 5 1 (mul 16.777.619 a)))
29+ ++ fnv |=(a=@ (end 5 1 (mul 16.777.619 a)))
30+```
26
31
27#### Examples
32#### Examples
28
33
34+```
29 > (fnv 10.000)
35 > (fnv 10.000)
30 272.465.456
36 272.465.456
31
37
@@ -34,10 +40,10 @@ An atom.
34
40
35 > (fnv 1)
41 > (fnv 1)
36 16.777.619
42 16.777.619
43+```
37
44
38
45
39−
46+---
40−***
41### `++mug`
47### `++mug`
42
48
43FNV-1a scrambler
49FNV-1a scrambler
@@ -55,7 +61,8 @@ An atom.
55
61
56#### Source
62#### Source
57
63
64+```
58− ++ mug
65+ ++ mug
59 ~/ %mug
66 ~/ %mug
60 |= a=*
67 |= a=*
61 ?^ a
68 ?^ a
@@ -75,10 +82,11 @@ An atom.
75 ?. =(0 f) f
82 ?. =(0 f) f
76 ^$(b +(b))
83 ^$(b +(b))
77 $(c (fnv (mix c (cut 3 [d 1] a))), d +(d))
84 $(c (fnv (mix c (cut 3 [d 1] a))), d +(d))
78−
85+```
79
86
80#### Examples
87#### Examples
81
88
89+```
82 > (mug 10.000)
90 > (mug 10.000)
83 178.152.889
91 178.152.889
84
92
@@ -93,10 +101,10 @@ An atom.
93
101
94 > (mug [1 2 3 4 5 ~])
102 > (mug [1 2 3 4 5 ~])
95 1.067.931.605
103 1.067.931.605
104+```
96
105
97
106
98−
107+---
99−***
100### `++muk`
108### `++muk`
101
109
102Standard MurmurHash3
110Standard MurmurHash3
@@ -119,7 +127,9 @@ in [blocks](../2c) of size 3, and `c` as the key, producing an atom.
119An atom.
127An atom.
120
128
121#### Source
129#### Source
130+
131+```
122− ++ muk
132+ ++ muk
123 ~% %muk ..muk ~
133 ~% %muk ..muk ~
124 =+ ~(. fe 5)
134 =+ ~(. fe 5)
125 |= [syd=@ len=@ key=@]
135 |= [syd=@ len=@ key=@]
@@ -133,7 +143,7 @@ An atom.
133 =/ i nblocks
143 =/ i nblocks
134 =. h1 =/ hi h1 |-
144 =. h1 =/ hi h1 |-
135 ?: =(0 i) hi :: negative array index
145 ?: =(0 i) hi :: negative array index
136− =/ k1 (snag (sub nblocks i) blocks)
146+ =/ k1 (snag (sub nblocks i) blocks)
137 =. k1 (sit (mul k1 c1))
147 =. k1 (sit (mul k1 c1))
138 =. k1 (rol 0 15 k1)
148 =. k1 (rol 0 15 k1)
139 =. k1 (sit (mul k1 c2))
149 =. k1 (sit (mul k1 c2))
@@ -176,10 +186,11 @@ An atom.
176 =. h (mix h (rsh 0 16 h))
186 =. h (mix h (rsh 0 16 h))
177 h
187 h
178 --
188 --
179−
189+```
180
190
181#### Examples
191#### Examples
182
192
193+```
183 > (muk 6 1 3)
194 > (muk 6 1 3)
184 3.427.677.118
195 3.427.677.118
185
196
@@ -205,12 +216,12 @@ An atom.
205 > e
216 > e
206 44.228
217 44.228
207
218
208− > (muk e 11 10.000)
219+ > (muk e 11 10.000)
209 246.077.549
220 246.077.549
221+```
210
222
211
223
212−
224+---
213−***
214### `++mum`
225### `++mum`
215
226
21631-bit MurmurHash3 scrambler
22731-bit MurmurHash3 scrambler
@@ -228,20 +239,23 @@ An atom.
228
239
229#### Source
240#### Source
230
241
242+```
231− ++ mum
243+ ++ mum
232 ~/ %mum
244 ~/ %mum
233 |= a=*
245 |= a=*
234 |^ (trim ?@(a a (mix $(a -.a) (mix 0x7fff.ffff $(a +.a)))))
246 |^ (trim ?@(a a (mix $(a -.a) (mix 0x7fff.ffff $(a +.a)))))
235− ++ trim
247+ ++ trim
236 |= key=@
248 |= key=@
237 =+ syd=0xcafe.babe
249 =+ syd=0xcafe.babe
238 |- ^- @
250 |- ^- @
239 =+ haz=(muk syd (met 3 key) key)
251 =+ haz=(muk syd (met 3 key) key)
240 =+ ham=(mix (rsh 0 31 haz) (end 0 31 haz))
252 =+ ham=(mix (rsh 0 31 haz) (end 0 31 haz))
241 ?.(=(0 ham) ham $(syd +(syd)))
253 ?.(=(0 ham) ham $(syd +(syd)))
254+```
242
255
243#### Examples
256#### Examples
244
257
258+```
245 > (mum 10.000)
259 > (mum 10.000)
246 795.713.195
260 795.713.195
247
261
@@ -259,7 +273,7 @@ An atom.
259
273
260 > (mum [1 2 3 4 5 ~])
274 > (mum [1 2 3 4 5 ~])
261 1.719.833.228
275 1.719.833.228
276+```
262
277
263
278
264−
279+---
265−***
docs/reference/library/2f.umd+462−26
@@ -1,9 +1,13 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'9'
3+ title/'2f: Noun Ordering'
4+ ==
5+
6+;>
4
7
5
8
6# 2f: noun ordering
9# 2f: noun ordering
10+
7### `++aor`
11### `++aor`
8
12
9Alphabetical order
13Alphabetical order
@@ -22,7 +26,8 @@ A flag.
22
26
23#### Source
27#### Source
24
28
29+```
25− ++ aor
30+ ++ aor
26 ~/ %aor
31 ~/ %aor
27 |= [a=* b=*]
32 |= [a=* b=*]
28 ^- ?
33 ^- ?
@@ -38,9 +43,11 @@ A flag.
38 ?: =(c d)
43 ?: =(c d)
39 $(a (rsh 3 1 a), b (rsh 3 1 b))
44 $(a (rsh 3 1 a), b (rsh 3 1 b))
40 (lth c d)
45 (lth c d)
46+```
41
47
42#### Examples
48#### Examples
43
49
50+```
44 > (aor 'a' 'b')
51 > (aor 'a' 'b')
45 %.y
52 %.y
46
53
@@ -67,10 +74,10 @@ A flag.
67
74
68 > (aor 10 9)
75 > (aor 10 9)
69 %.n
76 %.n
77+```
70
78
71
79
72−
80+---
73−***
74### `++dor`
81### `++dor`
75
82
76Numeric order
83Numeric order
@@ -89,7 +96,8 @@ A flag.
89
96
90#### Source
97#### Source
91
98
99+```
92− ++ dor
100+ ++ dor
93 ~/ %dor
101 ~/ %dor
94 |= [a=* b=*]
102 |= [a=* b=*]
95 ^- ?
103 ^- ?
@@ -101,10 +109,11 @@ A flag.
101 $(a -.a, b -.b)
109 $(a -.a, b -.b)
102 ?. ?=(@ b) &
110 ?. ?=(@ b) &
103 (lth a b)
111 (lth a b)
104−
112+```
105
113
106#### Examples
114#### Examples
107
115
116+```
108 > (dor 1 2)
117 > (dor 1 2)
109 %.y
118 %.y
110
119
@@ -122,6 +131,7 @@ A flag.
122
131
123 > (dor ~[99 101 10.999] `(list @)`~[99 100 10.000])
132 > (dor ~[99 101 10.999] `(list @)`~[99 100 10.000])
124 %.n
133 %.n
134+```
125
135
126#### Discussion
136#### Discussion
127
137
@@ -133,7 +143,7 @@ If one sample is a cell and the other is an atom, the cell sample is treated as
133"greater."
143"greater."
134
144
135
145
136−***
146+---
137### `++gor`
147### `++gor`
138
148
139Hash order
149Hash order
@@ -156,7 +166,8 @@ A flag.
156
166
157#### Source
167#### Source
158
168
169+```
159− ++ gor
170+ ++ gor
160 ~/ %gor
171 ~/ %gor
161 |= [a=* b=*]
172 |= [a=* b=*]
162 ^- ?
173 ^- ?
@@ -164,10 +175,11 @@ A flag.
164 ?: =(c d)
175 ?: =(c d)
165 (dor a b)
176 (dor a b)
166 (lth c d)
177 (lth c d)
167−
178+```
168
179
169#### Examples
180#### Examples
170
181
182+```
171 > (gor 'd' 'c')
183 > (gor 'd' 'c')
172 %.y
184 %.y
173
185
@@ -183,7 +195,7 @@ A flag.
183 > `@ud`'c'
195 > `@ud`'c'
184 99
196 99
185
197
186− > (mug 'd')
198+ > (mug 'd')
187 1.628.185.714
199 1.628.185.714
188
200
189 > (mug 'c')
201 > (mug 'c')
@@ -200,6 +212,7 @@ A flag.
200
212
201 > (gor (some 10) `(list @)`[1 2 3 ~])
213 > (gor (some 10) `(list @)`[1 2 3 ~])
202 %.n
214 %.n
215+```
203
216
204#### Discussion
217#### Discussion
205
218
@@ -207,7 +220,7 @@ A flag.
207vertical order. `map`s only look at the keys (the head of the key-value pair
220vertical order. `map`s only look at the keys (the head of the key-value pair
208elements) for ordering.
221elements) for ordering.
209
222
210−***
223+---
211### `++hor`
224### `++hor`
212
225
213Horizontal hash order
226Horizontal hash order
@@ -234,7 +247,8 @@ A flag.
234
247
235#### Source
248#### Source
236
249
250+```
237− ++ hor
251+ ++ hor
238 ~/ %hor
252 ~/ %hor
239 |= [a=* b=*]
253 |= [a=* b=*]
240 ^- ?
254 ^- ?
@@ -245,10 +259,11 @@ A flag.
245 ?: =(-.a -.b)
259 ?: =(-.a -.b)
246 (gor +.a +.b)
260 (gor +.a +.b)
247 (gor -.a -.b)
261 (gor -.a -.b)
248−
262+```
249
263
250#### Examples
264#### Examples
251
265
266+```
252 > (hor . 1)
267 > (hor . 1)
253 %.n
268 %.n
254
269
@@ -281,7 +296,7 @@ A flag.
281
296
282 > (hor `(list @)`[50 500 5.000 ~] 1)
297 > (hor `(list @)`[50 500 5.000 ~] 1)
283 %.n
298 %.n
284−
299+```
285
300
286#### Discussion
301#### Discussion
287
302
@@ -289,7 +304,7 @@ Sets (+set, +in) use `hor` for their horizontal order and `vor` for their
289vertical order. See [`apt:in`](../2h) to see how a set verifies its correctness.
304vertical order. See [`apt:in`](../2h) to see how a set verifies its correctness.
290`vor` is used to verify.
305`vor` is used to verify.
291
306
292−***
307+---
293### `++lor`
308### `++lor`
294
309
295Leg order
310Leg order
@@ -309,7 +324,8 @@ A flag.
309
324
310#### Source
325#### Source
311
326
327+```
312− ++ lor
328+ ++ lor
313 ~/ %lor
329 ~/ %lor
314 |= [a=* b=*]
330 |= [a=* b=*]
315 ^- ?
331 ^- ?
@@ -320,17 +336,18 @@ A flag.
320 ?: =(-.a -.b)
336 ?: =(-.a -.b)
321 $(a +.a, b +.b)
337 $(a +.a, b +.b)
322 $(a -.a, b -.b)
338 $(a -.a, b -.b)
323−
339+```
324
340
325#### Examples
341#### Examples
326
342
343+```
327 > (lor 1 2)
344 > (lor 1 2)
328 %.y
345 %.y
329
346
330 > (lor 2 1)
347 > (lor 2 1)
331 %.n
348 %.n
332
349
333− > (lor 9 [1 2])
350+ > (lor 9 [1 2])
334 %.y
351 %.y
335
352
336 > (lor `(list @)`[1 2 3 ~] `(list @)`[1 2 3 4 ~])
353 > (lor `(list @)`[1 2 3 ~] `(list @)`[1 2 3 4 ~])
@@ -350,13 +367,13 @@ A flag.
350
367
351 > (lor [1 2 3] [1 2])
368 > (lor [1 2 3] [1 2])
352 !! exit
369 !! exit
353−
370+```
354
371
355#### Discussion
372#### Discussion
356
373
357`lor` is no longer used internally.
374`lor` is no longer used internally.
358
375
359−***
376+---
360### `++vor`
377### `++vor`
361
378
362Vertical order
379Vertical order
@@ -380,7 +397,8 @@ A flag.
380
397
381#### Source
398#### Source
382
399
400+```
383− ++ vor
401+ ++ vor
384 ~/ %vor
402 ~/ %vor
385 |= [a=* b=*]
403 |= [a=* b=*]
386 ^- ?
404 ^- ?
@@ -388,10 +406,11 @@ A flag.
388 ?: =(c d)
406 ?: =(c d)
389 (dor a b)
407 (dor a b)
390 (lth c d)
408 (lth c d)
391−
409+```
392
410
393#### Examples
411#### Examples
394
412
413+```
395 > (vor 'f' 'g')
414 > (vor 'f' 'g')
396 %.y
415 %.y
397
416
@@ -406,7 +425,7 @@ A flag.
406
425
407 > (vor 43.326 41.106)
426 > (vor 43.326 41.106)
408 %.n
427 %.n
409−
428+```
410
429
411#### Discussion
430#### Discussion
412
431
@@ -419,4 +438,421 @@ correlation with single-`mug`ged `hor`. Vertical order becomes uncorrelated
419with horizontal order.
438with horizontal order.
420
439
421
440
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/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'10'
3+ title/'2g: Unsigned Powers'
4+ ==
4
5
6+;>
5
7
6# 2g: unsigned powers
8# 2g: unsigned powers
9+
7### `++pow`
10### `++pow`
8
11
9Computes `a` raised to the power of `b`, producing an atom.
12Computes `a` raised to the power of `b`, producing an atom.
@@ -20,7 +23,8 @@ An atom.
20
23
21#### Source
24#### Source
22
25
26+```
23− ++ pow
27+ ++ pow
24 ~/ %pow
28 ~/ %pow
25 |= [a=@ b=@]
29 |= [a=@ b=@]
26 ?: =(b 0) 1
30 ?: =(b 0) 1
@@ -28,9 +32,11 @@ An atom.
28 =+ c=$(b (div b 2))
32 =+ c=$(b (div b 2))
29 =+ d=(mul c c)
33 =+ d=(mul c c)
30 ?~ (dis b 1) d (mul d a)
34 ?~ (dis b 1) d (mul d a)
35+```
31
36
32#### Examples
37#### Examples
33
38
39+```
34 > (pow 2 6)
40 > (pow 2 6)
35 64
41 64
36
42
@@ -45,10 +51,9 @@ An atom.
45
51
46 > `@ux`(pow 0x1b 2)
52 > `@ux`(pow 0x1b 2)
47 0x2d9
53 0x2d9
54+```
48
55
49−
56+---
50−
51−***
52### `++sqt`
57### `++sqt`
53
58
54Computes the square root of `a` and its remainder.
59Computes the square root of `a` and its remainder.
@@ -62,7 +67,9 @@ Computes the square root of `a` and its remainder.
62A cell of atoms.
67A cell of atoms.
63
68
64#### Source
69#### Source
70+
71+```
65− ++ sqt
72+ ++ sqt
66 ~/ %sqt
73 ~/ %sqt
67 |= a=@ ^- [p=@ q=@]
74 |= a=@ ^- [p=@ q=@]
68 ?~ a [0 0]
75 ?~ a [0 0]
@@ -76,9 +83,11 @@ A cell of atoms.
76 ?: (lte t a)
83 ?: (lte t a)
77 $(r s, q (dec q))
84 $(r s, q (dec q))
78 $(q (dec q))
85 $(q (dec q))
86+```
79
87
80#### Examples
88#### Examples
81
89
90+```
82 > (sqt 4)
91 > (sqt 4)
83 [p=2 q=0]
92 [p=2 q=0]
84
93
@@ -93,7 +102,7 @@ A cell of atoms.
93
102
94 > `@ux`(sqt 0b1101)
103 > `@ux`(sqt 0b1101)
95 ! exit
104 ! exit
105+```
96
106
97
107
98−
108+---
99−***
docs/reference/library/2h.umd+106−56
@@ -1,7 +1,9 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'11'
3+ title/'2h: Set Logic'
4+ ==
4
5
6+;>
5
7
6# 2h: set logic
8# 2h: set logic
7
9
@@ -18,14 +20,18 @@ A `set`.
18
20
19#### Source
21#### Source
20
22
23+```
21− ++ in
24+ ++ in
22 ~/ %in
25 ~/ %in
23 |_ a=(set)
26 |_ a=(set)
27+```
24
28
25#### Examples
29#### Examples
26
30
31+```
27 > ~(. in (sy "asd"))
32 > ~(. in (sy "asd"))
28 <13.evb [nlr(^$1{@tD $1}) <414.fvk 101.jzo 1.ypj %164>]>
33 <13.evb [nlr(^$1{@tD $1}) <414.fvk 101.jzo 1.ypj %164>]>
34+```
29
35
30### `+-all:in`
36### `+-all:in`
31
37
@@ -46,16 +52,19 @@ A flag.
46
52
47#### Source
53#### Source
48
54
55+```
49− +- all
56+ +- all
50 ~/ %all
57 ~/ %all
51 |* b=$-(* ?)
58 |* b=$-(* ?)
52 |- ^- ?
59 |- ^- ?
53 ?~ a
60 ?~ a
54 &
61 &
55 ?&((b n.a) $(a l.a) $(a r.a))
62 ?&((b n.a) $(a l.a) $(a r.a))
63+```
56
64
57#### Examples
65#### Examples
58
66
67+```
59 > =b (sy `(list [@t *])`[['a' 1] ['b' [2 3]] ~])
68 > =b (sy `(list [@t *])`[['a' 1] ['b' [2 3]] ~])
60 > (~(all in b) |=(a=* ?@(+.a & |)))
69 > (~(all in b) |=(a=* ?@(+.a & |)))
61 %.n
70 %.n
@@ -63,8 +72,9 @@ A flag.
63 > =b (sy `(list @t)`['john' 'bonita' 'daniel' 'madeleine' ~])
72 > =b (sy `(list @t)`['john' 'bonita' 'daniel' 'madeleine' ~])
64 > (~(all in b) |=(a=@t (gte a 100)))
73 > (~(all in b) |=(a=@t (gte a 100)))
65 %.y
74 %.y
75+```
66
76
67−***
77+---
68### `+-any:in`
78### `+-any:in`
69
79
70Logical OR
80Logical OR
@@ -84,17 +94,19 @@ A flag.
84
94
85#### Source
95#### Source
86
96
97+```
87− +- any
98+ +- any
88 ~/ %any
99 ~/ %any
89 |* b=$-(* ?)
100 |* b=$-(* ?)
90 |- ^- ?
101 |- ^- ?
91 ?~ a
102 ?~ a
92 |
103 |
93 ?|((b n.a) $(a l.a) $(a r.a))
104 ?|((b n.a) $(a l.a) $(a r.a))
94−
105+```
95
106
96#### Examples
107#### Examples
97
108
109+```
98 > =b (sy `(list [@t *])`[['a' 1] ['b' [2 3]] ~])
110 > =b (sy `(list [@t *])`[['a' 1] ['b' [2 3]] ~])
99 > (~(any in b) |=(a/* ?@(+.a & |)))
111 > (~(any in b) |=(a/* ?@(+.a & |)))
100 %.y
112 %.y
@@ -102,8 +114,9 @@ A flag.
102 > =b (sy `(list @t)`['john' 'bonita' 'daniel' 'madeleine' ~])
114 > =b (sy `(list @t)`['john' 'bonita' 'daniel' 'madeleine' ~])
103 > (~(any in b) |=(a=@t (lte a 100)))
115 > (~(any in b) |=(a=@t (lte a 100)))
104 %.n
116 %.n
117+```
105
118
106−***
119+---
107#### `+-apt:in`
120#### `+-apt:in`
108
121
109Check correctness
122Check correctness
@@ -121,7 +134,8 @@ A flag.
121
134
122#### Source
135#### Source
123
136
137+```
124− +- apt
138+ +- apt
125 =| [l=(unit) r=(unit)]
139 =| [l=(unit) r=(unit)]
126 |- ^- ?
140 |- ^- ?
127 ?~ a &
141 ?~ a &
@@ -130,9 +144,11 @@ A flag.
130 ?~(l.a & ?&((vor n.a n.l.a) $(a l.a, l `n.a)))
144 ?~(l.a & ?&((vor n.a n.l.a) $(a l.a, l `n.a)))
131 ?~(r.a & ?&((vor n.a n.r.a) $(a r.a, r `n.a)))
145 ?~(r.a & ?&((vor n.a n.r.a) $(a r.a, r `n.a)))
132 ==
146 ==
147+```
133
148
134#### Examples
149#### Examples
135
150
151+```
136 > ~(apt in ~)
152 > ~(apt in ~)
137 %.y
153 %.y
138
154
@@ -147,13 +163,13 @@ A flag.
147 [n=7 l={5 4} r={1 3 2}]
163 [n=7 l={5 4} r={1 3 2}]
148 > ~(apt in z)
164 > ~(apt in z)
149 %.n
165 %.n
150−
166+```
151
167
152#### Discussion
168#### Discussion
153
169
154See section [`2f`](../2f) for more information on noun ordering.
170See section [`2f`](../2f) for more information on noun ordering.
155
171
156−***
172+---
157### `+-bif:in`
173### `+-bif:in`
158
174
159Bifurcate
175Bifurcate
@@ -172,7 +188,8 @@ A cell of two sets.
172
188
173#### Source
189#### Source
174
190
191+```
175− +- bif
192+ +- bif
176 ~/ %bif
193 ~/ %bif
177 |* b=*
194 |* b=*
178 ^+ [l=a r=a]
195 ^+ [l=a r=a]
@@ -189,10 +206,11 @@ A cell of two sets.
189 =+ c=$(a r.a)
206 =+ c=$(a r.a)
190 ?> ?=(^ c)
207 ?> ?=(^ c)
191 [n.c [n.a l.a l.c] r.c]
208 [n.c [n.a l.a l.c] r.c]
192−
209+```
193
210
194#### Examples
211#### Examples
195
212
213+```
196 > =a (sy `(list @)`[1 2 3 4 5 6 ~])
214 > =a (sy `(list @)`[1 2 3 4 5 6 ~])
197 > a
215 > a
198 [n=6 l={5 4} r={1 3 2}]
216 [n=6 l={5 4} r={1 3 2}]
@@ -202,8 +220,9 @@ A cell of two sets.
202
220
203 > (~(bif in a) 100)
221 > (~(bif in a) 100)
204 [l=[n=6 l=[n=4 l={5} r={}] r=[n=2 l={1 3} r={}]] r=~]
222 [l=[n=6 l=[n=4 l={5} r={}] r=[n=2 l={1 3} r={}]] r=~]
223+```
205
224
206−***
225+---
207### `+-del:in`
226### `+-del:in`
208
227
209Remove noun
228Remove noun
@@ -222,7 +241,8 @@ A set.
222
241
223#### Source
242#### Source
224
243
244+```
225− +- del
245+ +- del
226 ~/ %del
246 ~/ %del
227 |* b=*
247 |* b=*
228 |- ^+ a
248 |- ^+ a
@@ -238,11 +258,12 @@ A set.
238 ?: (vor n.l.a n.r.a)
258 ?: (vor n.l.a n.r.a)
239 [n.l.a l.l.a $(l.a r.l.a)]
259 [n.l.a l.l.a $(l.a r.l.a)]
240 [n.r.a $(r.a l.r.a) r.r.a]
260 [n.r.a $(r.a l.r.a) r.r.a]
241−
261+```
242
262
243
263
244#### Examples
264#### Examples
245
265
266+```
246 > =b (sy `(list @t)`['a' 'b' 'c' ~])
267 > =b (sy `(list @t)`['a' 'b' 'c' ~])
247 > (~(del in b) 'a')
268 > (~(del in b) 'a')
248 [n='b' l=[n='c' l={} r={}] r=~]
269 [n='b' l=[n='c' l={} r={}] r=~]
@@ -253,9 +274,9 @@ A set.
253
274
254 > (~(del in b) 'susan')
275 > (~(del in b) 'susan')
255 [n='madeleine' l=[n='daniel' l={} r={'bonita'}] r=[n='john' l={} r={}]]
276 [n='madeleine' l=[n='daniel' l={} r={'bonita'}] r=[n='john' l={} r={}]]
277+```
256
278
257−
279+---
258−***
259### `+-dif:in`
280### `+-dif:in`
260
281
261Difference
282Difference
@@ -275,7 +296,8 @@ A set.
275
296
276#### Source
297#### Source
277
298
299+```
278− +- dif
300+ +- dif
279 ~/ %dif
301 ~/ %dif
280 |* b=_a
302 |* b=_a
281 |- ^+ a
303 |- ^+ a
@@ -290,11 +312,11 @@ A set.
290 ?: (vor n.d n.e)
312 ?: (vor n.d n.e)
291 [n.d l.d $(d r.d)]
313 [n.d l.d $(d r.d)]
292 [n.e $(e l.e) r.e]
314 [n.e $(e l.e) r.e]
293−
315+```
294
316
295#### Examples
317#### Examples
296
318
297−
319+```
298 > =c (sy 1 2 3 ~)
320 > =c (sy 1 2 3 ~)
299 > =d (sy 2 3 4 ~)
321 > =d (sy 2 3 4 ~)
300 > (~(dif in c) d)
322 > (~(dif in c) d)
@@ -308,8 +330,9 @@ A set.
308
330
309 > `(set @ud)`(~(dif in d) c)
331 > `(set @ud)`(~(dif in d) c)
310 {4}
332 {4}
333+```
311
334
312−***
335+---
313### `+-dig:in`
336### `+-dig:in`
314
337
315Address b in a
338Address b in a
@@ -328,7 +351,8 @@ The `unit` of an atom.
328
351
329#### Source
352#### Source
330
353
354+```
331− +- dig
355+ +- dig
332 |= b=*
356 |= b=*
333 =+ c=1
357 =+ c=1
334 |- ^- (unit @)
358 |- ^- (unit @)
@@ -337,11 +361,12 @@ The `unit` of an atom.
337 ?: (hor b n.a)
361 ?: (hor b n.a)
338 $(a l.a, c (peg c 6))
362 $(a l.a, c (peg c 6))
339 $(a r.a, c (peg c 7))
363 $(a r.a, c (peg c 7))
340−
364+```
341
365
342
366
343#### Examples
367#### Examples
344
368
369+```
345 > =a (sy `(list @)`[1 2 3 4 5 6 7 ~])
370 > =a (sy `(list @)`[1 2 3 4 5 6 7 ~])
346 > `(set @)`a
371 > `(set @)`a
347 {5 4 7 6 1 3 2}
372 {5 4 7 6 1 3 2}
@@ -357,12 +382,13 @@ The `unit` of an atom.
357
382
358 > (~(dig in a) 6)
383 > (~(dig in a) 6)
359 [~ u=2]
384 [~ u=2]
385+```
360
386
361#### Discussion
387#### Discussion
362
388
363For more on the tree addressing system, see section [1b](../1b).
389For more on the tree addressing system, see section [1b](../1b).
364
390
365−***
391+---
366### `+-gas:in`
392### `+-gas:in`
367
393
368Concatenate
394Concatenate
@@ -381,17 +407,19 @@ A `set`.
381
407
382#### Source
408#### Source
383
409
410+```
384− +- gas
411+ +- gas
385 ~/ %gas
412 ~/ %gas
386 |= b=(list _?>(?=(^ a) n.a))
413 |= b=(list _?>(?=(^ a) n.a))
387 |- ^+ a
414 |- ^+ a
388 ?~ b
415 ?~ b
389 a
416 a
390 $(b t.b, a (put i.b))
417 $(b t.b, a (put i.b))
391−
418+```
392
419
393#### Examples
420#### Examples
394
421
422+```
395 > =b `(set @t)`(sy `(list @t)`['bonita' 'madeleine' 'rudolf' 'john' ~])
423 > =b `(set @t)`(sy `(list @t)`['bonita' 'madeleine' 'rudolf' 'john' ~])
396 > b
424 > b
397 {'bonita' 'madeleine' 'rudolf' 'john'}
425 {'bonita' 'madeleine' 'rudolf' 'john'}
@@ -402,13 +430,14 @@ A `set`.
402 > =s (sy `(list @t)`['a' 'b' 'c' 'd' 'e' ~])
430 > =s (sy `(list @t)`['a' 'b' 'c' 'd' 'e' ~])
403 > (~(gas in s) `(list @t)`['1' '2' '3' ~])
431 > (~(gas in s) `(list @t)`['1' '2' '3' ~])
404 [n='e' l=[n='1' l={} r={'3' '2'}] r=[n='b' l={'d' 'a' 'c'} r={}]]
432 [n='e' l=[n='1' l={} r={'3' '2'}] r=[n='b' l={'d' 'a' 'c'} r={}]]
433+```
405
434
406−***
435+---
407### `+-has:in`
436### `+-has:in`
408
437
409b in a?
438b in a?
410
439
411−Checks if `b` is an element of `a`, producing a boolean.
440+Checks if `b` is an element of `a`, producing a flag.
412
441
413#### Accepts
442#### Accepts
414
443
@@ -418,11 +447,12 @@ Checks if `b` is an element of `a`, producing a boolean.
418
447
419#### Produces
448#### Produces
420
449
421−A boolean.
450+A flag.
422
451
423#### Source
452#### Source
424
453
454+```
425− +- has
455+ +- has
426 ~/ %has
456 ~/ %has
427 |* b=*
457 |* b=*
428 |- ^- ?
458 |- ^- ?
@@ -433,19 +463,20 @@ A boolean.
433 ?: (hor b n.a)
463 ?: (hor b n.a)
434 $(a l.a)
464 $(a l.a)
435 $(a r.a)
465 $(a r.a)
436− ::
466+```
437−
438
467
439#### Examples
468#### Examples
440
469
470+```
441 > =a (~(gas in `(set @t)`~) `(list @t)`['a' 'b' 'c' ~])
471 > =a (~(gas in `(set @t)`~) `(list @t)`['a' 'b' 'c' ~])
442 > (~(has in a) 'a')
472 > (~(has in a) 'a')
443 %.y
473 %.y
444
474
445 > (~(has in a) 'z')
475 > (~(has in a) 'z')
446 %.n
476 %.n
477+```
447
478
448−***
479+---
449### `+-int:in`
480### `+-int:in`
450
481
451Intersection
482Intersection
@@ -465,7 +496,8 @@ A `set`.
465
496
466#### Source
497#### Source
467
498
499+```
468− +- int
500+ +- int
469 ~/ %int
501 ~/ %int
470 |* b=_a
502 |* b=_a
471 |- ^+ a
503 |- ^+ a
@@ -480,12 +512,12 @@ A `set`.
480 ?: (hor n.b n.a)
512 ?: (hor n.b n.a)
481 %- uni(a $(a l.a, b [n.b l.b ~])) $(b r.b)
513 %- uni(a $(a l.a, b [n.b l.b ~])) $(b r.b)
482 %- uni(a $(a r.a, b [n.b ~ r.b])) $(b l.b)
514 %- uni(a $(a r.a, b [n.b ~ r.b])) $(b l.b)
483− ::
515+```
484−
485
516
486
517
487#### Examples
518#### Examples
488
519
520+```
489 > (~(int in `(set @t)`(sy "acmo")) `(set @t)`(sy "ham"))
521 > (~(int in `(set @t)`(sy "acmo")) `(set @t)`(sy "ham"))
490 [n='m' l={'a'} r={}]
522 [n='m' l={'a'} r={}]
491
523
@@ -494,8 +526,9 @@ A `set`.
494
526
495 > (~(int in `(set @t)`(sy "ac")) `(set @t)`(sy "ha"))
527 > (~(int in `(set @t)`(sy "ac")) `(set @t)`(sy "ha"))
496 [n='a' l={} r={}]
528 [n='a' l={} r={}]
529+```
497
530
498−***
531+---
499### `+-put:in`
532### `+-put:in`
500
533
501Put b in a
534Put b in a
@@ -514,7 +547,8 @@ A `set`.
514
547
515#### Source
548#### Source
516
549
550+```
517− +- put
551+ +- put
518 ~/ %put
552 ~/ %put
519 |* b=*
553 |* b=*
520 |- ^+ a
554 |- ^+ a
@@ -533,10 +567,11 @@ A `set`.
533 ?: (vor n.a n.c)
567 ?: (vor n.a n.c)
534 [n.a l.a c]
568 [n.a l.a c]
535 [n.c [n.a l.a l.c] r.c]
569 [n.c [n.a l.a l.c] r.c]
536−
570+```
537
571
538#### Examples
572#### Examples
539
573
574+```
540 > =a (~(gas in `(set @t)`~) `(list @t)`['a' 'b' 'c' ~])
575 > =a (~(gas in `(set @t)`~) `(list @t)`['a' 'b' 'c' ~])
541 > =b (~(put in a) 'd')
576 > =b (~(put in a) 'd')
542 > `(set @t)`b
577 > `(set @t)`b
@@ -544,8 +579,9 @@ A `set`.
544
579
545 > -.l.+.b
580 > -.l.+.b
546 n='d'
581 n='d'
582+```
547
583
548−***
584+---
549### `+-rep:in`
585### `+-rep:in`
550
586
551Accumulate
587Accumulate
@@ -564,22 +600,26 @@ A noun.
564
600
565#### Source
601#### Source
566
602
603+```
567 +- rep :: replace by product
604 +- rep :: replace by product
568 |* b=_|=([* *] +<+)
605 |* b=_|=([* *] +<+)
569 |-
606 |-
570 ?~ a +<+.b
607 ?~ a +<+.b
571 $(a r.a, +<+.b $(a l.a, +<+.b (b n.a +<+.b)))
608 $(a r.a, +<+.b $(a l.a, +<+.b (b n.a +<+.b)))
609+```
572
610
573#### Examples
611#### Examples
574
612
613+```
575 > =a (~(gas in *(set @)) [1 2 3 ~])
614 > =a (~(gas in *(set @)) [1 2 3 ~])
576 > `(set @)`a
615 > `(set @)`a
577 {1 3 2}
616 {1 3 2}
578
617
579 > (~(rep in a) |=([a=@ b=@] (add a b)))
618 > (~(rep in a) |=([a=@ b=@] (add a b)))
580 b=6
619 b=6
620+```
581
621
582−***
622+---
583### `+-run:in`
623### `+-run:in`
584
624
585Apply gate to set
625Apply gate to set
@@ -599,7 +639,8 @@ A set.
599
639
600#### Source
640#### Source
601
641
642+```
602− +- run
643+ +- run
603 ~/ %run
644 ~/ %run
604 |* b=gate
645 |* b=gate
605 =| c=(set _?>(?=(^ a) (b n.a)))
646 =| c=(set _?>(?=(^ a) (b n.a)))
@@ -607,18 +648,20 @@ A set.
607 =. c (~(put in c) (b n.a))
648 =. c (~(put in c) (b n.a))
608 =. c $(a l.a, c c)
649 =. c $(a l.a, c c)
609 $(a r.a, c c)
650 $(a r.a, c c)
610−
651+```
611
652
612#### Examples
653#### Examples
613
654
655+```
614 > =s (sy ~["a" "A" "b" "c"])
656 > =s (sy ~["a" "A" "b" "c"])
615 > `(set tape)`s
657 > `(set tape)`s
616 {"A" "a" "c" "b"}
658 {"A" "a" "c" "b"}
617
659
618 > (~(run in s) cuss)
660 > (~(run in s) cuss)
619 {"A" "C" "B"}
661 {"A" "C" "B"}
662+```
620
663
621−***
664+---
622### `+-tap:in`
665### `+-tap:in`
623
666
624Set to list
667Set to list
@@ -635,26 +678,29 @@ A list.
635
678
636#### Source
679#### Source
637
680
681+```
638− +- tap
682+ +- tap
639 ~/ %tap
683 ~/ %tap
640 |= b=(list _?>(?=(^ a) n.a))
684 |= b=(list _?>(?=(^ a) n.a))
641 ^+ b
685 ^+ b
642 ?~ a
686 ?~ a
643 b
687 b
644 $(a r.a b [n.a $(a l.a)])
688 $(a r.a b [n.a $(a l.a)])
645−
689+```
646
690
647
691
648#### Examples
692#### Examples
649
693
694+```
650 > =s (sy `(list @t)`['a' 'b' 'c' 'd' 'e' ~])
695 > =s (sy `(list @t)`['a' 'b' 'c' 'd' 'e' ~])
651 > s
696 > s
652 [n='e' l={} r={'d' 'a' 'c' 'b'}]
697 [n='e' l={} r={'d' 'a' 'c' 'b'}]
653
698
654 > ~(tap in s)
699 > ~(tap in s)
655 ~['b' 'c' 'a' 'd' 'e']
700 ~['b' 'c' 'a' 'd' 'e']
701+```
656
702
657−***
703+---
658### `+-uni:in`
704### `+-uni:in`
659
705
660Union
706Union
@@ -674,7 +720,8 @@ A set.
674
720
675#### Source
721#### Source
676
722
723+```
677− +- uni
724+ +- uni
678 ~/ %uni
725 ~/ %uni
679 |* b=_a
726 |* b=_a
680 ?: =(a b) a
727 ?: =(a b) a
@@ -695,11 +742,12 @@ A set.
695 $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
742 $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
696 $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
743 $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
697 ::
744 ::
698−
745+```
699
746
700
747
701#### Examples
748#### Examples
702
749
750+```
703 > (~(uni in `(set @t)`(sy "ac")) `(set @)`(sy "ha"))
751 > (~(uni in `(set @t)`(sy "ac")) `(set @)`(sy "ha"))
704 [n='c' l={'a'} r={'h'}]
752 [n='c' l={'a'} r={'h'}]
705
753
@@ -711,8 +759,9 @@ A set.
711
759
712 > (~(uni in `(set @t)`(sy "acmo")) `(set @t)`(sy "lep"))
760 > (~(uni in `(set @t)`(sy "acmo")) `(set @t)`(sy "lep"))
713 [n='e' l={} r={'a' 'c' 'm' 'l' 'o' 'p'}]
761 [n='e' l={} r={'a' 'c' 'm' 'l' 'o' 'p'}]
762+```
714
763
715−***
764+---
716### `+-wyt:in`
765### `+-wyt:in`
717
766
718Set size
767Set size
@@ -729,15 +778,17 @@ An atom.
729
778
730#### Source
779#### Source
731
780
781+```
732 +- wyt :: size of set
782 +- wyt :: size of set
733 |- ^- @
783 |- ^- @
734 ?~(a 0 +((add $(a l.a) $(a r.a))))
784 ?~(a 0 +((add $(a l.a) $(a r.a))))
735 --
785 --
736−
786+```
737
787
738
788
739#### Examples
789#### Examples
740
790
791+```
741 > =a (~(put in (~(put in (sy)) 'a')) 'b')
792 > =a (~(put in (~(put in (sy)) 'a')) 'b')
742 > ~(wyt in a)
793 > ~(wyt in a)
743 2
794 2
@@ -745,7 +796,6 @@ An atom.
745 > =b (sy `(list @t)`['john' 'bonita' 'daniel' 'madeleine' ~])
796 > =b (sy `(list @t)`['john' 'bonita' 'daniel' 'madeleine' ~])
746 > ~(wyt in b)
797 > ~(wyt in b)
747 4
798 4
799+```
748
800
749−
801+---
750−***
751−
docs/reference/library/2i.umd+146−62
@@ -1,9 +1,12 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'12'
3+ title/'2i: Map Logic'
4+ ==
4
5
6+;>
5
7
6# 2i: map logic
8# 2i: map logic
9+
7### `++by`
10### `++by`
8
11
9Map operations
12Map operations
@@ -17,13 +20,16 @@ contained arms inherit its sample map, `a`.
17
20
18#### Source
21#### Source
19
22
23+```
20− ++ by
24+ ++ by
21 ~/ %by
25 ~/ %by
22− =| a=(tree (pair))
26+ =| a=(tree (pair))
23 =* node ?>(?=(^ a) n.a)
27 =* node ?>(?=(^ a) n.a)
28+```
24
29
25#### Examples
30#### Examples
26
31
32+```
27 > ~(. by (my [%a 1] [%b 2] ~))
33 > ~(. by (my [%a 1] [%b 2] ~))
28 < 27.zjr
34 < 27.zjr
29 { a
35 { a
@@ -36,8 +42,9 @@ contained arms inherit its sample map, `a`.
36 )
42 )
37 <119.wim 31.ohr 1.jmk $143>
43 <119.wim 31.ohr 1.jmk $143>
38 }
44 }
45+```
39
46
40−***
47+---
41### `+-all:by`
48### `+-all:by`
42
49
43Logical AND
50Logical AND
@@ -57,16 +64,19 @@ A flag.
57
64
58#### Source
65#### Source
59
66
67+```
60− +- all
68+ +- all
61 ~/ %all
69 ~/ %all
62 |* b=$-(* ?)
70 |* b=$-(* ?)
63 |- ^- ?
71 |- ^- ?
64 ?~ a
72 ?~ a
65 &
73 &
66 ?&((b q.n.a) $(a l.a) $(a r.a))
74 ?&((b q.n.a) $(a l.a) $(a r.a))
75+```
67
76
68#### Examples
77#### Examples
69
78
79+```
70 > =b (my [['a' 1] ['b' [2 3]] ~])
80 > =b (my [['a' 1] ['b' [2 3]] ~])
71 > (~(all by b) |=(a=* ?@(a & |)))
81 > (~(all by b) |=(a=* ?@(a & |)))
72 %.n
82 %.n
@@ -77,8 +87,9 @@ A flag.
77
87
78 > (~(all by a) |=(a=@ (lte a 4)))
88 > (~(all by a) |=(a=@ (lte a 4)))
79 %.n
89 %.n
90+```
80
91
81−***
92+---
82### `+-any:by`
93### `+-any:by`
83
94
84Logical OR
95Logical OR
@@ -98,16 +109,19 @@ A flag.
98
109
99#### Source
110#### Source
100
111
112+```
101− +- any
113+ +- any
102 ~/ %any
114 ~/ %any
103 |* b=$-(* ?)
115 |* b=$-(* ?)
104 |- ^- ?
116 |- ^- ?
105 ?~ a
117 ?~ a
106 |
118 |
107 ?|((b q.n.a) $(a l.a) $(a r.a))
119 ?|((b q.n.a) $(a l.a) $(a r.a))
120+```
108
121
109#### Examples
122#### Examples
110
123
124+```
111 > =b (my [['a' 1] ['b' [2 3]] ~])
125 > =b (my [['a' 1] ['b' [2 3]] ~])
112 > (~(any by b) |=(a=* ?@(a & |)))
126 > (~(any by b) |=(a=* ?@(a & |)))
113 %.y
127 %.y
@@ -115,8 +129,9 @@ A flag.
115 > =a (my [['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~])
129 > =a (my [['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~])
116 > (~(any by a) |=(a=@ (lte a 4)))
130 > (~(any by a) |=(a=@ (lte a 4)))
117 %.y
131 %.y
132+```
118
133
119−***
134+---
120###`+-apt:by`
135###`+-apt:by`
121
136
122Check correctness
137Check correctness
@@ -134,7 +149,8 @@ A flag.
134
149
135#### Source
150#### Source
136
151
152+```
137− +- apt
153+ +- apt
138 =| [l=(unit) r=(unit)]
154 =| [l=(unit) r=(unit)]
139 |- ^- ?
155 |- ^- ?
140 ?~ a &
156 ?~ a &
@@ -143,9 +159,11 @@ A flag.
143 ?~(l.a & ?&((vor p.n.a p.n.l.a) $(a l.a, l `p.n.a)))
159 ?~(l.a & ?&((vor p.n.a p.n.l.a) $(a l.a, l `p.n.a)))
144 ?~(r.a & ?&((vor p.n.a p.n.r.a) $(a r.a, r `p.n.a)))
160 ?~(r.a & ?&((vor p.n.a p.n.r.a) $(a r.a, r `p.n.a)))
145 ==
161 ==
162+```
146
163
147#### Examples
164#### Examples
148
165
166+```
149 > =a (my [['a' 1] ['b' [2 3]] ~])
167 > =a (my [['a' 1] ['b' [2 3]] ~])
150 > ~(apt by a)
168 > ~(apt by a)
151 %.y
169 %.y
@@ -157,6 +175,7 @@ A flag.
157
175
158 > ~(apt by z)
176 > ~(apt by z)
159 %.n
177 %.n
178+```
160
179
161#### Discussion
180#### Discussion
162
181
@@ -182,7 +201,8 @@ A cell of two maps.
182
201
183#### Source
202#### Source
184
203
204+```
185− +- bif
205+ +- bif
186 ~/ %bif
206 ~/ %bif
187 |* [b=* c=*]
207 |* [b=* c=*]
188 ^+ [l=a r=a]
208 ^+ [l=a r=a]
@@ -201,14 +221,16 @@ A cell of two maps.
201 =+ d=$(a r.a)
221 =+ d=$(a r.a)
202 ?> ?=(^ d)
222 ?> ?=(^ d)
203 [n.d [n.a l.a l.d] r.d]
223 [n.d [n.a l.a l.d] r.d]
224+```
204
225
205#### Examples
226#### Examples
206
227
228+```
207 > =a (my [['a' 1] ['b' 2] ['c' 3] ~])
229 > =a (my [['a' 1] ['b' 2] ['c' 3] ~])
208
230
209 > (~(bif by a) ['b' 2])
231 > (~(bif by a) ['b' 2])
210 [l=[n=[p='c' q=3] l=[n=[p='a' q=1] l={} r={}] r=~] r=~]
232 [l=[n=[p='c' q=3] l=[n=[p='a' q=1] l={} r={}] r=~] r=~]
211−
233+```
212
234
213###`+-def:by`
235###`+-def:by`
214
236
@@ -226,15 +248,17 @@ A map.
226
248
227#### Source
249#### Source
228
250
251+```
229− +- def
252+ +- def
230 |* b=_a
253 |* b=_a
231 ^- (map _p:node (pair (unit _q:node) (unit _q:node)))
254 ^- (map _p:node (pair (unit _q:node) (unit _q:node)))
232 !!
255 !!
256+```
233
257
234#### Examples
258#### Examples
235
259
236−***
260+---
237−###`+-dep`
261+###`+-dep:by`
238
262
239Difference as patch
263Difference as patch
240
264
@@ -251,7 +275,8 @@ A cell of maps.
251
275
252#### Source
276#### Source
253
277
278+```
254− +- dep
279+ +- dep
255 |* b=_a
280 |* b=_a
256 ^+ [p=a q=a]
281 ^+ [p=a q=a]
257 =+ c=~(tap by (def b))
282 =+ c=~(tap by (def b))
@@ -263,12 +288,13 @@ A cell of maps.
263 d ?~(q.q.i.c d (~(put by d) p.i.c u.q.q.i.c))
288 d ?~(q.q.i.c d (~(put by d) p.i.c u.q.q.i.c))
264 e ?~(p.q.i.c e (~(put by e) p.i.c u.p.q.i.c))
289 e ?~(p.q.i.c e (~(put by e) p.i.c u.p.q.i.c))
265 ==
290 ==
291+```
266
292
267#### Examples
293#### Examples
268
294
269
295
270
296
271−***
297+---
272### `+-del:by`
298### `+-del:by`
273
299
274Delete
300Delete
@@ -287,7 +313,8 @@ A map.
287
313
288#### Source
314#### Source
289
315
316+```
290− +- del
317+ +- del
291 ~/ %del
318 ~/ %del
292 |* b=*
319 |* b=*
293 |- ^+ a
320 |- ^+ a
@@ -303,14 +330,17 @@ A map.
303 ?: (vor p.n.l.a p.n.r.a)
330 ?: (vor p.n.l.a p.n.r.a)
304 [n.l.a l.l.a $(l.a r.l.a)]
331 [n.l.a l.l.a $(l.a r.l.a)]
305 [n.r.a $(r.a l.r.a) r.r.a]
332 [n.r.a $(r.a l.r.a) r.r.a]
333+```
306
334
307#### Examples
335#### Examples
308
336
337+```
309 > =b (my [['a' 1] ['b' [2 3]] ~])
338 > =b (my [['a' 1] ['b' [2 3]] ~])
310 > (~(del by b) 'a')
339 > (~(del by b) 'a')
311 [n=[p='b' q=[2 3]] l=~ r=~]
340 [n=[p='b' q=[2 3]] l=~ r=~]
341+```
312
342
313−***
343+---
314### `+-dig:by`
344### `+-dig:by`
315
345
316Address of key
346Address of key
@@ -329,7 +359,8 @@ A unit.
329
359
330#### Source
360#### Source
331
361
362+```
332− +- dig
363+ +- dig
333 |= b=*
364 |= b=*
334 =+ c=1
365 =+ c=1
335 |- ^- (unit @)
366 |- ^- (unit @)
@@ -338,15 +369,17 @@ A unit.
338 ?: (gor b p.n.a)
369 ?: (gor b p.n.a)
339 $(a l.a, c (peg c 6))
370 $(a l.a, c (peg c 6))
340 $(a r.a, c (peg c 7))
371 $(a r.a, c (peg c 7))
341−
372+```
342
373
343#### Examples
374#### Examples
344
375
376+```
345− > =b (my [['a' 1] ['b' [2 3]] ~])
377+ > =b (my [['a' 1] ['b' [2 3]] ~])
346 > (~(dig by b) 'b')
378 > (~(dig by b) 'b')
347 [~ u=2]
379 [~ u=2]
380+```
348
381
349−***
382+---
350### `+-gas:by`
383### `+-gas:by`
351
384
352Concatenate
385Concatenate
@@ -365,7 +398,8 @@ A map.
365
398
366#### Source
399#### Source
367
400
401+```
368− +- gas
402+ +- gas
369 ~/ %gas
403 ~/ %gas
370 |* b=(list [p=* q=*])
404 |* b=(list [p=* q=*])
371 => .(b `(list _?>(?=(^ a) n.a))`b)
405 => .(b `(list _?>(?=(^ a) n.a))`b)
@@ -373,16 +407,19 @@ A map.
373 ?~ b
407 ?~ b
374 a
408 a
375 $(b t.b, a (put p.i.b q.i.b))
409 $(b t.b, a (put p.i.b q.i.b))
410+```
376
411
377#### Examples
412#### Examples
378
413
414+```
379 > =a (my [['a' 1] ['b' 2] ~])
415 > =a (my [['a' 1] ['b' 2] ~])
380 > =b [['c' 3] ['d' 4] ~]
416 > =b [['c' 3] ['d' 4] ~]
381
417
382 > (~(gas by a) b)
418 > (~(gas by a) b)
383 [n=[p='b' q=2] l=[n=[p='d' q=4] l={} r={[p='a' q=1] [p='c' q=3]}] r=~]
419 [n=[p='b' q=2] l=[n=[p='d' q=4] l={} r={[p='a' q=1] [p='c' q=3]}] r=~]
420+```
384
421
385−***
422+---
386### `+-get:by`
423### `+-get:by`
387
424
388Grab unit value
425Grab unit value
@@ -401,7 +438,8 @@ A unit.
401
438
402#### Source
439#### Source
403
440
441+```
404− +- get
442+ +- get
405 ~/ %get
443 ~/ %get
406 |= b=*
444 |= b=*
407 ^- [$@(~ [~ u=_?>(?=(^ a) q.n.a)])]
445 ^- [$@(~ [~ u=_?>(?=(^ a) q.n.a)])]
@@ -413,10 +451,12 @@ A unit.
413 ?: (gor b p.n.a)
451 ?: (gor b p.n.a)
414 $(a l.a)
452 $(a l.a)
415 $(a r.a)
453 $(a r.a)
454+```
416
455
417#### Examples
456#### Examples
418
457
458+```
419− > =b (my [['a' 1] ['b' [2 3]] ~])
459+ > =b (my [['a' 1] ['b' [2 3]] ~])
420 > (~(get by b) 'b')
460 > (~(get by b) 'b')
421 [~ u=[2 3]]
461 [~ u=[2 3]]
422
462
@@ -424,9 +464,9 @@ A unit.
424 > =m (my [['a' 1] ['b' 2] ~])
464 > =m (my [['a' 1] ['b' 2] ~])
425 > (~(get by m) 'a')
465 > (~(get by m) 'a')
426 [~ u=1]
466 [~ u=1]
467+```
427
468
428−
469+---
429−***
430### `+-got:by`
470### `+-got:by`
431
471
432Assert
472Assert
@@ -446,12 +486,15 @@ A noun.
446
486
447#### Source
487#### Source
448
488
489+```
449 +- got
490 +- got
450 |* b=*
491 |* b=*
451 (need (get b))
492 (need (get b))
493+```
452
494
453#### Examples
495#### Examples
454
496
497+```
455 > =m (my [['a' 1] ['b' 2] ~])
498 > =m (my [['a' 1] ['b' 2] ~])
456 > m
499 > m
457 [n=[p='b' q=2] l={[p='a' q=1]} r={}]
500 [n=[p='b' q=2] l={[p='a' q=1]} r={}]
@@ -461,9 +504,9 @@ A noun.
461
504
462 > (~(got by m) 'c')
505 > (~(got by m) 'c')
463 ! exit
506 ! exit
507+```
464
508
465−
509+---
466−***
467### `+-has:by`
510### `+-has:by`
468
511
469Key existence check
512Key existence check
@@ -482,21 +525,25 @@ A flag.
482
525
483#### Source
526#### Source
484
527
528+```
485− +- has
529+ +- has
486 ~/ %has
530 ~/ %has
487 |* b=*
531 |* b=*
488 !=(~ (get b))
532 !=(~ (get b))
533+```
489
534
490#### Examples
535#### Examples
491
536
537+```
492 > =b (my [['a' 1] ['b' [2 3]] ~])
538 > =b (my [['a' 1] ['b' [2 3]] ~])
493 > (~(has by b) 'b')
539 > (~(has by b) 'b')
494 %.y
540 %.y
495
541
496 > (~(has by b) 'c')
542 > (~(has by b) 'c')
497 %.n
543 %.n
544+```
498
545
499−***
546+---
500### `+-int:by`
547### `+-int:by`
501
548
502Intersection
549Intersection
@@ -517,7 +564,8 @@ A map.
517
564
518#### Source
565#### Source
519
566
567+```
520− +- int
568+ +- int
521 ~/ %int
569 ~/ %int
522 |* b=_a
570 |* b=_a
523 |- ^+ a
571 |- ^+ a
@@ -536,9 +584,11 @@ A map.
536 ?: (gor p.n.a p.n.b)
584 ?: (gor p.n.a p.n.b)
537 %- uni(a $(b l.b, a [n.a l.a ~])) $(a r.a)
585 %- uni(a $(b l.b, a [n.a l.a ~])) $(a r.a)
538 %- uni(a $(b r.b, a [n.a ~ r.a])) $(a l.a)
586 %- uni(a $(b r.b, a [n.a ~ r.a])) $(a l.a)
587+```
539
588
540#### Examples
589#### Examples
541
590
591+```
542 > =n (my [['a' 1] ['c' 3] ~])
592 > =n (my [['a' 1] ['c' 3] ~])
543 > =m (my [['a' 1] ['b' 2] ~])
593 > =m (my [['a' 1] ['b' 2] ~])
544
594
@@ -560,9 +610,9 @@ A map.
560 > =o (my [['c' 3] ['d' 4] ~])
610 > =o (my [['c' 3] ['d' 4] ~])
561 > (~(int by m) o)
611 > (~(int by m) o)
562 ~
612 ~
613+```
563
614
564−
615+---
565−***
566### `+-mar:by`
616### `+-mar:by`
567
617
568Assert and add
618Assert and add
@@ -586,14 +636,17 @@ A map.
586
636
587#### Assert and Add
637#### Assert and Add
588
638
639+```
589− +- mar
640+ +- mar
590 |* [b=_?>(?=(^ a) p.n.a) c=(unit ,_?>(?=(^ a) q.n.a))]
641 |* [b=_?>(?=(^ a) p.n.a) c=(unit ,_?>(?=(^ a) q.n.a))]
591 ?~ c
642 ?~ c
592 (del b)
643 (del b)
593 (put b u.c)
644 (put b u.c)
645+```
594
646
595#### Examples
647#### Examples
596
648
649+```
597 > =m (my [['a' 1] ['b' 2] ~])
650 > =m (my [['a' 1] ['b' 2] ~])
598 > (~(mar by m) 'c' (some 3))
651 > (~(mar by m) 'c' (some 3))
599 [n=[p='b' q=2] l=[n=[p='c' q=3] l=[n=[p='a' q=1] l={} r={}] r=~] r=~]
652 [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.
603
656
604 > (~(mar by m) 'b' ~)
657 > (~(mar by m) 'b' ~)
605 [n=[p='a' q=1] l=~ r=~]
658 [n=[p='a' q=1] l=~ r=~]
659+```
606
660
607−***
661+---
608### `+-put:by`
662### `+-put:by`
609
663
610Add key-value pair
664Add key-value pair
@@ -625,7 +679,8 @@ A map.
625
679
626#### Source
680#### Source
627
681
682+```
628− +- put
683+ +- put
629 ~/ %put
684 ~/ %put
630 |* [b=* c=*]
685 |* [b=* c=*]
631 |- ^+ a
686 |- ^+ a
@@ -646,9 +701,11 @@ A map.
646 ?: (vor p.n.a p.n.d)
701 ?: (vor p.n.a p.n.d)
647 [n.a l.a d]
702 [n.a l.a d]
648 [n.d [n.a l.a l.d] r.d]
703 [n.d [n.a l.a l.d] r.d]
704+```
649
705
650#### Examples
706#### Examples
651
707
708+```
652 > =m (my [['a' 1] ['b' 2] ~])
709 > =m (my [['a' 1] ['b' 2] ~])
653 > (~(put by ~) 'c' 3)
710 > (~(put by ~) 'c' 3)
654 [n=[p='b' q=2] l=[n=[p='c' q=3] l={[p='a' q=1]} r={}] r=~]
711 [n=[p='b' q=2] l=[n=[p='c' q=3] l={[p='a' q=1]} r={}] r=~]
@@ -662,9 +719,9 @@ A map.
662
719
663 > (put:by m 'a' 2)
720 > (put:by m 'a' 2)
664 {[p=[[98 2] [[97 1] 0 0] 0] q=[97 2]]}
721 {[p=[[98 2] [[97 1] 0 0] 0] q=[97 2]]}
722+```
665
723
666−
724+---
667−***
668### `+-rep:by`
725### `+-rep:by`
669
726
670Replace by product
727Replace by product
@@ -683,20 +740,23 @@ A noun.
683
740
684#### Source
741#### Source
685
742
743+```
686− +- rep
744+ +- rep
687 |* b=_|=([* *] +<+)
745 |* b=_|=([* *] +<+)
688 |-
746 |-
689 ?~ a +<+.b
747 ?~ a +<+.b
690 $(a r.a, +<+.b $(a l.a, +<+.b (b n.a +<+.b)))
748 $(a r.a, +<+.b $(a l.a, +<+.b (b n.a +<+.b)))
749+```
691
750
692#### Examples
751#### Examples
693
752
753+```
694 > =m (my [['a' 1] ['b' 2] ~])
754 > =m (my [['a' 1] ['b' 2] ~])
695 > (~(rep by m) |=(a=(pair * *) p.a))
755 > (~(rep by m) |=(a=(pair * *) p.a))
696 q=[97 1]
756 q=[97 1]
757+```
697
758
698−
759+---
699−***
700### `+-rib:by`
760### `+-rib:by`
701
761
702Replace values with accumulator
762Replace values with accumulator
@@ -715,7 +775,8 @@ A cell of nouns.
715
775
716#### Source
776#### Source
717
777
778+```
718− +- rib
779+ +- rib
719 |* [b=* c=gate]
780 |* [b=* c=gate]
720 |- ^+ [b a]
781 |- ^+ [b a]
721 ?~ a [b ~]
782 ?~ a [b ~]
@@ -724,15 +785,18 @@ A cell of nouns.
724 =+ e=$(a l.a, b -.d)
785 =+ e=$(a l.a, b -.d)
725 =+ f=$(a r.a, b -.e)
786 =+ f=$(a r.a, b -.e)
726 [-.f [n.a +.e +.f]]
787 [-.f [n.a +.e +.f]]
788+```
727
789
728#### Examples
790#### Examples
729
791
792+```
730 > =m (my [['a' 1] ['b' 2] ~])
793 > =m (my [['a' 1] ['b' 2] ~])
731 > (~(rib by m) [1 2] (con by m))
794 > (~(rib by m) [1 2] (con by m))
732
795
733 > (~(rep by m) [1 2] |=(a=(pair * *) p.a))
796 > (~(rep by m) [1 2] |=(a=(pair * *) p.a))
797+```
734
798
735−***
799+---
736### `+-run:by`
800### `+-run:by`
737
801
738Transform values
802Transform values
@@ -751,14 +815,17 @@ A map.
751
815
752#### Source
816#### Source
753
817
818+```
754− +- run
819+ +- run
755 |* b=gate
820 |* b=gate
756 |-
821 |-
757 ?~ a a
822 ?~ a a
758 [n=[p=p.n.a q=(b q.n.a)] l=$(a l.a) r=$(a r.a)]
823 [n=[p=p.n.a q=(b q.n.a)] l=$(a l.a) r=$(a r.a)]
824+```
759
825
760#### Examples
826#### Examples
761
827
828+```
762 > =m (my [['a' 1] ['b' 2] ~])
829 > =m (my [['a' 1] ['b' 2] ~])
763
830
764 > ^+(m (~(run by m) dec))
831 > ^+(m (~(run by m) dec))
@@ -766,9 +833,9 @@ A map.
766
833
767 > `(map @tas @t)`(~(run by m) (cury scot %ux))
834 > `(map @tas @t)`(~(run by m) (cury scot %ux))
768 {[p=%a q='0x1'] [p=%b q='0x2']}
835 {[p=%a q='0x1'] [p=%b q='0x2']}
836+```
769
837
770−
838+---
771−***
772### `+-rut:by`
839### `+-rut:by`
773
840
774Transform nodes
841Transform nodes
@@ -787,17 +854,21 @@ A map.
787
854
788#### Source
855#### Source
789
856
857+```
790 +- rut
858 +- rut
791 |* b=gate
859 |* b=gate
792 |-
860 |-
793 ?~ a a
861 ?~ a a
794 [n=[p=p.n.a q=(b p.n.a q.n.a)] l=$(a l.a) r=$(a r.a)]
862 [n=[p=p.n.a q=(b p.n.a q.n.a)] l=$(a l.a) r=$(a r.a)]
863+```
795
864
796#### Examples
865#### Examples
797
866
867+```
798 > =m (my [['a' 1] ['b' 2] ~])
868 > =m (my [['a' 1] ['b' 2] ~])
869+```
799
870
800−***
871+---
801### `+-tap:by`
872### `+-tap:by`
802
873
803Listify pairs
874Listify pairs
@@ -817,7 +888,8 @@ A list.
817
888
818#### Source
889#### Source
819
890
891+```
820− +- tap
892+ +- tap
821 =< $
893 =< $
822 ~/ %tap
894 ~/ %tap
823 =| b=(list _?>(?=(^ a) n.a))
895 =| b=(list _?>(?=(^ a) n.a))
@@ -825,9 +897,11 @@ A list.
825 ?~ a
897 ?~ a
826 b
898 b
827 $(a r.a, b [n.a $(a l.a)])
899 $(a r.a, b [n.a $(a l.a)])
900+```
828
901
829#### Examples
902#### Examples
830
903
904+```
831 > =m (my [['a' 1] ['b' 2] ~])
905 > =m (my [['a' 1] ['b' 2] ~])
832 [n=[p='b' q=2] l={[p='a' q=1]} r={}]
906 [n=[p='b' q=2] l={[p='a' q=1]} r={}]
833 > `*`m
907 > `*`m
@@ -837,8 +911,9 @@ A list.
837 ~[[p='b' q=2] [p='a' q=1]]
911 ~[[p='b' q=2] [p='a' q=1]]
838 > `*`~(tap by m)
912 > `*`~(tap by m)
839 [[98 2] [97 1] 0]
913 [[98 2] [97 1] 0]
914+```
840
915
841−***
916+---
842### `+-uni:by`
917### `+-uni:by`
843
918
844Union
919Union
@@ -858,7 +933,8 @@ A map.
858
933
859#### Source
934#### Source
860
935
936+```
861− +- uni
937+ +- uni
862 ~/ %uni
938 ~/ %uni
863 |* b=_a
939 |* b=_a
864 |- ^+ a
940 |- ^+ a
@@ -877,9 +953,11 @@ A map.
877 ?: (gor p.n.a p.n.b)
953 ?: (gor p.n.a p.n.b)
878 $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
954 $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
879 $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
955 $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
956+```
880
957
881#### Examples
958#### Examples
882
959
960+```
883 > =m (my [['a' 1] ['b' 2] ~])
961 > =m (my [['a' 1] ['b' 2] ~])
884
962
885 > =o (my [['c' 3] ['d' 4] ~])
963 > =o (my [['c' 3] ['d' 4] ~])
@@ -894,9 +972,9 @@ A map.
894 {[p='a' q=1] [p='c' q=3]}
972 {[p='a' q=1] [p='c' q=3]}
895 > (~(uni by o) n)
973 > (~(uni by o) n)
896 {[p='d' q=4] [p='a' q=1] [p='c' q=3]}
974 {[p='d' q=4] [p='a' q=1] [p='c' q=3]}
975+```
897
976
898−
977+---
899−***
900### `+-urn:by`
978### `+-urn:by`
901
979
902Turn (with key)
980Turn (with key)
@@ -916,15 +994,17 @@ A noun.
916
994
917#### Source
995#### Source
918
996
997+```
919− +- urn
998+ +- urn
920 |* b=$-({* *} *)
999 |* b=$-({* *} *)
921 |-
1000 |-
922 ?~ a ~
1001 ?~ a ~
923 [n=[p=p.n.a q=(b p.n.a q.n.a)] l=$(a l.a) r=$(a r.a)
1002 [n=[p=p.n.a q=(b p.n.a q.n.a)] l=$(a l.a) r=$(a r.a)
924−
1003+```
925
1004
926#### Examples
1005#### Examples
927
1006
1007+```
928 > m
1008 > m
929 {[p='a' q=1] [p='b' q=2]}
1009 {[p='a' q=1] [p='b' q=2]}
930
1010
@@ -936,8 +1016,9 @@ A noun.
936
1016
937 > (~(urn by m) |=(a=(pair * *) p.a))
1017 > (~(urn by m) |=(a=(pair * *) p.a))
938 {[p='a' q=97] [p='b' q=98]}
1018 {[p='a' q=97] [p='b' q=98]}
1019+```
939
1020
940−***
1021+---
941
1022
942### `+-wyt:by`
1023### `+-wyt:by`
943
1024
@@ -955,12 +1036,15 @@ An atom.
955
1036
956#### Source
1037#### Source
957
1038
1039+```
958− +- wyt
1040+ +- wyt
959 |- ^- @
1041 |- ^- @
960 ?~(a 0 +((add $(a l.a) $(a r.a))))
1042 ?~(a 0 +((add $(a l.a) $(a r.a))))
1043+```
961
1044
962#### Examples
1045#### Examples
963
1046
1047+```
964 > =m (my [['a' 1] ['b' 2] ~])
1048 > =m (my [['a' 1] ['b' 2] ~])
965
1049
966 > =o (my [['c' 3] ['d' 4] ~])
1050 > =o (my [['c' 3] ['d' 4] ~])
@@ -973,6 +1057,6 @@ An atom.
973
1057
974 > ~(wyt by (~(uni by m) o))
1058 > ~(wyt by (~(uni by m) o))
975 4
1059 4
1060+```
976
1061
977−
1062+---
978−***
docs/reference/library/2j.umd+85−34
@@ -1,64 +1,84 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'13'
3+ title/'2j: Jar and Jug Logic'
4+ ==
4
5
6+;>
5
7
6# 2j: jar and jug logic
8# 2j: jar and jug logic
9+
7### `++ja`
10### `++ja`
8
11
9Jar engine
12Jar engine
10
13
14+```
11− |_ a/(jar)
15+ |_ a=(jar)
16+```
12
17
13A container arm for `++jar` operation arms. A `++jar` is a `++map` of
18A container arm for `++jar` operation arms. A `++jar` is a `++map` of
14`++list`s. The contained arms inherit the sample jar.
19`++list`s. The contained arms inherit the sample jar.
15
20
16`a` is a jar.
21`a` is a jar.
17
22
23+```
18 > ~(. ja (mo (limo a/"ho" b/"he" ~)))
24 > ~(. ja (mo (limo a/"ho" b/"he" ~)))
19 <2.dgz [nlr([p={%a %b} q=""]) <414.fvk 101.jzo 1.ypj %164>]>
25 <2.dgz [nlr([p={%a %b} q=""]) <414.fvk 101.jzo 1.ypj %164>]>
26+```
20
27
21−------------------------------------------------------------------------
28+---
22−
23### `+-get:ja`
29### `+-get:ja`
24
30
25Grab value by key
31Grab value by key
26
32
33+```
27 +- get :: gets list by key
34 +- get :: gets list by key
28− |* b/*
35+ |* b=*
29 =+ c=(~(get by a) b)
36 =+ c=(~(get by a) b)
30 ?~(c ~ u.c)
37 ?~(c ~ u.c)
31− ::
38+```
32
39
33−Produces a list retrieved from jar `a` using the key `b`.
40+#### Accepts
34
41
35`a` is a `++jar`.
42`a` is a `++jar`.
36
43
37`b` is a key of the same type as the keys in `a`.
44`b` is a key of the same type as the keys in `a`.
38
45
46+#### Produces
47+
48+A list retrieved from jar `a` using the key `b`.
49+
50+Examples
51+
52+```
39 > =l (mo `(list ,[@t (list ,@)])`[['a' `(list ,@)`[1 2 3 ~]] ['b' `(list ,@)`[4 5 6 ~]] ~])
53 > =l (mo `(list ,[@t (list ,@)])`[['a' `(list ,@)`[1 2 3 ~]] ['b' `(list ,@)`[4 5 6 ~]] ~])
40 > l
54 > 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+
42 > (~(get ja l) 'a')
57 > (~(get ja l) 'a')
43 ~[1 2 3]
58 ~[1 2 3]
59+
44 > (~(get ja l) 'b')
60 > (~(get ja l) 'b')
45 ~[4 5 6]
61 ~[4 5 6]
62+
46 > (~(get ja l) 'c')
63 > (~(get ja l) 'c')
47 ~
64 ~
65+```
48
66
49−------------------------------------------------------------------------
67+---
50−
51### `+-add:ja`
68### `+-add:ja`
52
69
53Prepend to list
70Prepend to list
54
71
72+#### Source
73+
74+```
55 +- add :: adds key-list pair
75 +- add :: adds key-list pair
56− |* {b/* c/*}
76+ |* [b=* c=*]
57 =+ d=(get b)
77 =+ d=(get b)
58 (~(put by a) b [c d])
78 (~(put by a) b [c d])
79+```
59
80
60−Produces jar `a` with value `c` prepended to the list located at key
81+#### Accepts
61−`b`.
62
82
63`a` is a jar.
83`a` is a jar.
64
84
@@ -66,41 +86,57 @@ Produces jar `a` with value `c` prepended to the list located at key
66
86
67`c` is a value of the same type as the values in `a`.
87`c` is a value of the same type as the values in `a`.
68
88
89+#### Examples
90+
91+```
69 > =l (mo `(list ,[@t (list ,@)])`[['a' `(list ,@)`[1 2 3 ~]] ['b' `(list ,@)`[4 5 6 ~]] ~])
92 > =l (mo `(list ,[@t (list ,@)])`[['a' `(list ,@)`[1 2 3 ~]] ['b' `(list ,@)`[4 5 6 ~]] ~])
70 > l
93 > l
71 {[p='a' q=~[1 2 3]] [p='b' q=~[4 5 6]]}
94 {[p='a' q=~[1 2 3]] [p='b' q=~[4 5 6]]}
95+
72 > (~(add ja l) 'b' 7)
96 > (~(add ja l) 'b' 7)
73 {[p='a' q=~[1 2 3]] [p='b' q=~[7 4 5 6]]}
97 {[p='a' q=~[1 2 3]] [p='b' q=~[7 4 5 6]]}
98+
74 > (~(add ja l) 'a' 100)
99 > (~(add ja l) 'a' 100)
75 {[p='a' q=~[100 1 2 3]] [p='b' q=~[4 5 6]]}
100 {[p='a' q=~[100 1 2 3]] [p='b' q=~[4 5 6]]}
101+
76 > (~(add ja l) 'c' 7)
102 > (~(add ja l) 'c' 7)
77 {[p='a' q=~[1 2 3]] [p='c' q=~[7]] [p='b' q=~[4 5 6]]}
103 {[p='a' q=~[1 2 3]] [p='c' q=~[7]] [p='b' q=~[4 5 6]]}
104+
78 > (~(add ja l) 'c' `(list ,@)`[7 8 9 ~])
105 > (~(add ja l) 'c' `(list ,@)`[7 8 9 ~])
79 ! type-fail
106 ! type-fail
80 ! exit
107 ! exit
108+```
81
109
82**
110**
83### `++ju`
111### `++ju`
84
112
85Jug operations
113Jug operations
86
114
115+```
87 ++ ju :: jug engine
116 ++ ju :: jug engine
88− |/ a/(jug)
117+ |/ a=(jug)
118+```
89
119
90Container arm for jug operation arms. A `++jug` is a `++map` of
120Container arm for jug operation arms. A `++jug` is a `++map` of
91`++sets`. The contained arms inherit its sample jug, `a`.
121`++sets`. The contained arms inherit its sample jug, `a`.
92
122
93`a` is a jug.
123`a` is a jug.
94
124
125+```
95− > ~(. ju (mo (limo a/(sa "ho") b/(sa "he") ~)))
126+ > ~(. ju (mo (limo a=(sa "ho") b=(sa "he") ~)))
96 <2.dgz [nlr([p={%a %b} q={nlr(^$1{@tD $1}) nlr(^$3{@tD $3})}]) <414.fvk 101.jzo 1.ypj %164>]>
127 <2.dgz [nlr([p={%a %b} q={nlr(^$1{@tD $1}) nlr(^$3{@tD $3})}]) <414.fvk 101.jzo 1.ypj %164>]>
128+```
97
129
98### `+-del:ju`
130### `+-del:ju`
99
131
100Remove
132Remove
101
133
134+
135+#### Source
136+
137+```
102 +- del :: del key-set pair
138 +- del :: del key-set pair
103− |* {b/* c/*}
139+ |* [b=* c=*]
104 ^+ a
140 ^+ a
105 =+ d=(get b)
141 =+ d=(get b)
106 =+ e=(~(del in d) c)
142 =+ e=(~(del in d) c)
@@ -108,7 +144,7 @@ Remove
108 (~(del by a) b)
144 (~(del by a) b)
109 (~(put by a) b e)
145 (~(put by a) b e)
110 ::
146 ::
111−
147+```
112
148
113Produces jug `a` with value `c` removed from set located at key `b`.
149Produces jug `a` with value `c` removed from set located at key `b`.
114
150
@@ -119,24 +155,30 @@ Produces jug `a` with value `c` removed from set located at key `b`.
119`c` is the value of the same type of the keys in `a` that is to be
155`c` is the value of the same type of the keys in `a` that is to be
120removed.
156removed.
121
157
158+```
122 > s
159 > 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+
124 > (~(del ju s) 'a' 1)
162 > (~(del ju s) 'a' 1)
125 {[p='a' q={3 2}] [p='b' q={5 4 6}]}
163 {[p='a' q={3 2}] [p='b' q={5 4 6}]}
164+
126 > (~(del ju s) 'c' 7)
165 > (~(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+```
128
168
129−------------------------------------------------------------------------
169+---
130
170
131### `+-get:ju`
171### `+-get:ju`
132
172
133Retrieve set
173Retrieve set
134
174
175+```
135 +- get :: gets set by key
176 +- get :: gets set by key
136− |* b/*
177+ |* b=*
137 =+ c=(~(get by a) b)
178 =+ c=(~(get by a) b)
138 ?~(c ~ u.c)
179 ?~(c ~ u.c)
139 ::
180 ::
181+```
140
182
141Produces a set retrieved from jar `a` using key `b`.
183Produces a set retrieved from jar `a` using key `b`.
142
184
@@ -144,6 +186,7 @@ Produces a set retrieved from jar `a` using key `b`.
144
186
145`b` is a key of the same type as the keys in `a`.
187`b` is a key of the same type as the keys in `a`.
146
188
189+```
147 > s
190 > s
148 {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
191 {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
149 > (~(get ju s) 'a')
192 > (~(get ju s) 'a')
@@ -152,19 +195,20 @@ Produces a set retrieved from jar `a` using key `b`.
152 {5 4 6}
195 {5 4 6}
153 > (~(get ju s) 'c')
196 > (~(get ju s) 'c')
154 ~
197 ~
198+```
155
199
156−------------------------------------------------------------------------
200+---
157−
158### `+-has:ju`
201### `+-has:ju`
159
202
160Check contents
203Check contents
161
204
205+```
162 +- has :: existence check
206 +- has :: existence check
163− |* {b/* c/*}
207+ |* [b=* c=*]
164 ^- ?
208 ^- ?
165 (~(has in (get b)) c)
209 (~(has in (get b)) c)
166 ::
210 ::
167−
211+```
168
212
169Computes whether a value `c` exists within the set located at key `b`
213Computes whether a value `c` exists within the set located at key `b`
170with jar `a`. Produces a loobean.
214with jar `a`. Produces a loobean.
@@ -175,6 +219,7 @@ with jar `a`. Produces a loobean.
175
219
176`c` is a value as a noun.
220`c` is a value as a noun.
177
221
222+```
178 > s
223 > s
179 {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
224 {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
180 > (~(has ju s) 'a' 3)
225 > (~(has ju s) 'a' 3)
@@ -189,18 +234,20 @@ with jar `a`. Produces a loobean.
189 ! exit
234 ! exit
190 > (~(has ju s) 'c' 7)
235 > (~(has ju s) 'c' 7)
191 %.n
236 %.n
192−
237+```
193−------------------------------------------------------------------------
238+---
194
239
195### `+-put:ju`
240### `+-put:ju`
196
241
197Add key-set pair
242Add key-set pair
198
243
199− +- put :: add key-set pair
244+```
245+ +- put
200− |* {b/* c/*}
246+ |* {b=* c=*}
201 ^+ a
247 ^+ a
202 =+ d=(get b)
248 =+ d=(get b)
203 (~(put by a) b (~(put in d) c))
249 (~(put by a) b (~(put in d) c))
250+```
204
251
205Produces jar `a` with `c` added to the set value located at key `b`.
252Produces jar `a` with `c` added to the set value located at key `b`.
206
253
@@ -210,15 +257,19 @@ Produces jar `a` with `c` added to the set value located at key `b`.
210
257
211`c` is a value.
258`c` is a value.
212
259
260+```
213 > s
261 > 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+
215 > (~(put ju s) 'a' 7)
264 > (~(put ju s) 'a' 7)
216 {[p='a' q={7 1 3 2}] [p='b' q={5 4 6}]}
265 {[p='a' q={7 1 3 2}] [p='b' q={5 4 6}]}
266+
217 > (~(put ju s) 'a' 1)
267 > (~(put ju s) 'a' 1)
218 {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
268 {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
269+
219 > (~(put ju s) 'c' 7)
270 > (~(put ju s) 'c' 7)
220 {[p='a' q={1 3 2}] [p='c' q={7}] [p='b' q={5 4 6}]}
271 {[p='a' q={1 3 2}] [p='c' q={7}] [p='b' q={5 4 6}]}
272+```
221
273
222
274
223−
275+---
224−***
docs/reference/library/2k.umd+200−140
@@ -1,46 +1,57 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'14'
3+ title/'2k: Queue Logic'
4+ ==
5+
6+;>
4
7
5
8
6# 2k: queue logic
9# 2k: queue logic
10+
7### `++to`
11### `++to`
8
12
13+
9Queue operations
14Queue operations
10
15
11−Container arm for queue operation arms. The contained arms inherit its
16+Container arm for queue operation arms. The contained arms inherit `a`, its
12−sample `++qeu` `a`.
17+sample queue.
13
18
14−Accepts
19+#### Accepts
15−-------
16
20
17−`a` is a queue, ++qeu.
21+`a` is a tree.
18
22
19−Source
23+#### Source
20−------
21
24
22− ++ to :: queue engine
25+```
23− |/ a/(qeu)
26+ ++ to
27+ |_ a=(tree)
28+```
24
29
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+---
25### `+-bal:to`
38### `+-bal:to`
26
39
27Balance
40Balance
28
41
29Vertically rebalances queue `a`.
42Vertically rebalances queue `a`.
30
43
31−Accepts
44+#### Accepts
32−-------
33
45
34`a` is a queue.
46`a` is a queue.
35
47
36−Produces
48+#### Produces
37−--------
38
49
39A queue.
50A queue.
40
51
41−Source
52+#### Source
42−------
43
53
54+```
44 +- bal
55 +- bal
45 |- ^+ a
56 |- ^+ a
46 ?~ a ~
57 ?~ a ~
@@ -49,128 +60,128 @@ Source
49 ?. |(?=($~ r.a) (vor n.a n.r.a))
60 ?. |(?=($~ r.a) (vor n.a n.r.a))
50 $(a [n.r.a $(a [n.a l.a l.r.a]) r.r.a])
61 $(a [n.r.a $(a [n.a l.a l.r.a]) r.r.a])
51 a
62 a
52− ::
63+```
53−
54
64
55−Examples
65+#### Examples
56−--------
57
66
67+```
58 > `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~]
68 > `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~]
59 {"a" "b" "c" "d" "e" "f" "g"}
69 {"a" "b" "c" "d" "e" "f" "g"}
70+
60 > `*`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~]
71 > `*`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~]
61 [[97 0] 0 [98 0] 0 [99 0] 0 [100 0] 0 [101 0] 0 [102 0] 0 [103 0] 0 0]
72 [[97 0] 0 [98 0] 0 [99 0] 0 [100 0] 0 [101 0] 0 [102 0] 0 [103 0] 0 0]
73+
62 > ~(bal to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~])
74 > ~(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+
64 > `*`~(bal to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~])
77 > `*`~(bal to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~])
65 [[100 0] [[99 0] [[98 0] [[97 0] 0 0] 0] 0] [101 0] 0 [102 0] 0 [103 0] 0 0]
78 [[100 0] [[99 0] [[98 0] [[97 0] 0 0] 0] 0] [101 0] 0 [102 0] 0 [103 0] 0 0]
79+```
66
80
67−------------------------------------------------------------------------
81+---
68−
69### `+-dep:to`
82### `+-dep:to`
70
83
71Maximum Depth
84Maximum Depth
72
85
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`.
74
87
75−Accepts
88+#### Accepts
76−-------
77
89
78`a` is a queue.
90`a` is a queue.
79
91
80−Produces
92+#### Produces
81−--------
82
93
83An atom.
94An atom.
84
95
85−Source
96+#### Source
86−------
87
97
88− +- dep :: max depth of queue
98+```
99+ +- dep
89 |- ^- @
100 |- ^- @
90 ?~ a 0
101 ?~ a 0
91 +((max $(a l.a) $(a r.a)))
102 +((max $(a l.a) $(a r.a)))
92− ::
103+```
93
104
105+#### Examples
94
106
95−Examples
107+```
96−--------
97−
98 > =a (~(gas to `(qeu @)`~) `(list @)`[1 2 3 4 5 6 7 ~])
108 > =a (~(gas to `(qeu @)`~) `(list @)`[1 2 3 4 5 6 7 ~])
99 > ~(dep to a)
109 > ~(dep to a)
100 4
110 4
111+
101 > =a (~(gas to `(qeu @)`~) `(list @)`[1 2 3 4 ~])
112 > =a (~(gas to `(qeu @)`~) `(list @)`[1 2 3 4 ~])
102 > ~(dep to a)
113 > ~(dep to a)
103 3
114 3
115+
104 > =a (~(gas to `(qeu @)`~) `(list @)`[1 2 ~])
116 > =a (~(gas to `(qeu @)`~) `(list @)`[1 2 ~])
105 > ~(dep to a)
117 > ~(dep to a)
106 2
118 2
119+
107 > ~(dep to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~])
120 > ~(dep to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~])
108 7
121 7
122+
109 > ~(dep to ~(bal to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~]))
123 > ~(dep to ~(bal to `(qeu tape)`["a" ~ "b" ~ "c" ~ "d" ~ "e" ~ "f" ~ "g" ~ ~]))
110 4
124 4
125+```
111
126
112−------------------------------------------------------------------------
127+---
113−
114−### `+-gas`
128+### `+-gas:to`
115
129
116Push list
130Push list
117
131
118−Push all elements of `++list` `b` into the `++queue`.
132+Push all elements of list `b` into the queue `a`.
119
133
120−Accepts
134+#### Accepts
121−-------
122
135
123`a` is a queue.
136`a` is a queue.
124
137
125`b` is a list.
138`b` is a list.
126
139
127−Produces
140+#### Produces
128−--------
129
141
130A queue.
142A queue.
131
143
132−Source
144+#### Source
133−------
134
145
135− +- gas :: insert list to queue
146+```
147+ +- gas
136− |= b=(list ,_?>(?=(^ a) n.a))
148+ |= b=(list _?>(?=(^ a) n.a))
137− |- ^+ a
149+ |- ^+ a
138− ?~(b a $(b t.b, a (put(+< a) i.b)))
150+ ?~(b a $(b t.b, a (put i.b)))
139− ::
151+```
140
152
141−Examples
142−--------
143
153
144− > (~(gas to `(qeu ,@)`~) `(list ,@)`[1 2 3 ~])
154+#### Examples
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}
150
155
151−------------------------------------------------------------------------
156+```
157+ > `(qeu)`(~(gas to `(qeu @)`~) [1 2 3 ~])
158+ {3 2 1}
152
159
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+---
153### `+-get:to`
166### `+-get:to`
154
167
155−Pop
168+Head-tail pair
156
169
157−Produces the head and tail `++queue` of `a`.
170+Produces the head and tail queue of `a`.
158
171
159−Accepts
172+#### Accepts
160−-------
161
173
162`a` is a queue.
174`a` is a queue.
163
175
164−Produces
176+#### Produces
165−--------
166
177
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`.
168
179
169−Source
180+#### Source
170−------
171
181
172− +- get :: head-tail pair
182+```
183+ +- get
173− |- ^+ ?>(?=(^ a) [p=n.a q=*(qeu _n.a)])
184+ |- ^+ ?>(?=(^ a) [p=n.a q=*(tree _n.a)])
174 ?~ a
185 ?~ a
175 !!
186 !!
176 ?~ r.a
187 ?~ r.a
@@ -180,164 +191,213 @@ Source
180 ?: |(?=($~ q.b) (vor n.a n.q.b))
191 ?: |(?=($~ q.b) (vor n.a n.q.b))
181 [n.a l.a q.b]
192 [n.a l.a q.b]
182 [n.q.b [n.a l.a l.q.b] r.q.b]
193 [n.q.b [n.a l.a l.q.b] r.q.b]
183− ::
194+```
184
195
185−Examples
196+#### Examples
186−--------
187
197
198+```
188− > =s (~(gas to *(qeu @)) `(list @)`~[1 2 3])
199+ > =s (~(gas to *(tree @)) `(list @)`~[1 2 3])
189 > ~(get to s)
200 > ~(get to s)
190− [p=1 q={3 2}]
201+ [n=2 l={3} r={1}]
202+
191 > ~(get to ~)
203 > ~(get to ~)
192 ! exit
204 ! exit
205+```
193
206
194−------------------------------------------------------------------------
207+---
195−
196### `+-nap:to`
208### `+-nap:to`
197
209
198−Remove last element
210+Remove head
199
211
200−Removes the head of `++queue` `a`, producing the resulting queue.
212+Removes the head of queue `a`, producing the resulting queue.
201
213
202−Accepts
214+#### Accepts
203−-------
204
215
205`a` is a queue.
216`a` is a queue.
206
217
207−Produces
218+#### Produces
208−--------
209
219
210A queue.
220A queue.
211
221
212−Source
222+#### Source
213−------
214
223
215− +- nap :: removes head
224+```
225+ +- nap
216 ?> ?=(^ a)
226 ?> ?=(^ a)
217− ?: =(~ l.a) r.a
227+ ?~ l.a r.a
218 =+ b=get(a l.a)
228 =+ b=get(a l.a)
219 bal(a ^+(a [p.b q.b r.a]))
229 bal(a ^+(a [p.b q.b r.a]))
220− ::
230+```
221
231
222−Examples
232+#### Examples
223−--------
224
233
234+```
225 > =a (~(gas to `(qeu @)`~) `(list @)`[1 2 3 4 5 6 ~])
235 > =a (~(gas to `(qeu @)`~) `(list @)`[1 2 3 4 5 6 ~])
226 > -.a
236 > -.a
227 n=6
237 n=6
238+
228 > =b ~(nap to a)
239 > =b ~(nap to a)
229 > -.b
240 > -.b
230 n=2
241 n=2
242+
243+ > a
244+ [n=6 l={} r={5 4 3 2 1}]
245+
231 > b
246 > b
247+ [n=2 l=[n=4 l={5} r={3}] r=[n=1 l={} r={}]]
248+
249+ > `(qeu)`b
232 {5 4 3 2 1}
250 {5 4 3 2 1}
251+
233− > a
252+ > `(qeu)`a
234 {6 5 4 3 2 1}
253 {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+```
235
281
236−------------------------------------------------------------------------
282+#### Examples
237
283
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+---
238### `+-put:to`
294### `+-put:to`
239
295
240Insert
296Insert
241
297
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
243resulting queue.
299resulting queue.
244
300
245−Accepts
301+#### Accepts
246−-------
247
302
248`a` is a queue.
303`a` is a queue.
249
304
250`b` is any noun.
305`b` is any noun.
251
306
252−Produces
307+#### Produces
253−--------
254
308
255A queue.
309A queue.
256
310
257−Source
311+#### Source
258−------
259
312
260− +- put :: insert new tail
313+```
314+ +- put
261− |* b/*
315+ |* b=*
262 |- ^+ a
316 |- ^+ a
263 ?~ a
317 ?~ a
264 [b ~ ~]
318 [b ~ ~]
265 bal(a a(l $(a l.a)))
319 bal(a a(l $(a l.a)))
266− ::
320+```
267−
268
321
269−Examples
322+#### Examples
270−--------
271
323
324+```
272− > (~(gas to `(qeu @)`~) `(list @)`[3 1 2 4 5 6 ~])
325+ > =a (~(gas to `(qeu @)`~) `(list @)`[3 1 2 4 5 6 ~])
273− > (~(put to a) 7)
326+ > `(qeu)`(~(put to a) 7)
274 {7 6 5 4 2 1 3}
327 {7 6 5 4 2 1 3}
328+```
275
329
276−------------------------------------------------------------------------
330+---
277−
278### `+-tap:to`
331### `+-tap:to`
279
332
280Queue to list
333Queue to list
281
334
282−Produces `++queue` `a` as a `++list` from front to back.
335+Produces queue `a` as a list from front to back.
283
336
284−Accepts
337+#### Accepts
285−-------
286
338
287`a` is a queue.
339`a` is a queue.
288
340
289−Source
341+#### Produces
290−------
342+
343+A list.
291
344
292− +- tap :: adds list to end
345+#### Source
346+
347+```
348+ +- tap
293− |= b/(list _?>(?=(^ a) n.a))
349+ =| b=(list _?>(?=(^ a) n.a))
350+ |- ^+ b
294− =+ z=0 :: XX breaks jet match
351+ =+ 0 :: hack for jet match
295− ^+ b
296 ?~ a
352 ?~ a
297 b
353 b
298 $(a r.a, b [n.a $(a l.a)])
354 $(a r.a, b [n.a $(a l.a)])
299− ::
355+```
300
356
301−Examples
357+#### Examples
302−--------
303
358
359+```
304− > =a (~(gas to `(qeu @)`~) `(list @)`[3 1 2 4 5 6 ~])
360+ > =a (~(gas to `(qeu @)`~) [3 1 2 4 5 6 ~])
305 > `*`a
361 > `*`a
306 [6 0 2 [4 [5 0 0] 0] 1 0 3 0 0]
362 [6 0 2 [4 [5 0 0] 0] 1 0 3 0 0]
307− > (~(tap to a) `(list @)`[99 100 101 ~])
363+ > ~(tap to a)
308− ~[3 1 2 4 5 6 99 100 101]
364+ ~[3 1 2 4 5 6]
309−
365+```
310−------------------------------------------------------------------------
311
366
367+---
312### `+-top:to`
368### `+-top:to`
313
369
314−Produces the head of `++queue` `a` as a `++unit` (an empty queue has no head).
370+Produce head
315
371
372+Produces the head of queue `a` as a `unit`.
373+
316−Accepts
374+#### Accepts
317−-------
318
375
319`a` is a queue.
376`a` is a queue.
320
377
321−Produces
378+#### Produces
322−--------
323
379
324A unit.
380A unit.
325
381
326−Source
382+#### Source
327−------
328
383
329− +- top :: produces head
384+```
385+ +- top
330 |- ^- (unit _?>(?=(^ a) n.a))
386 |- ^- (unit _?>(?=(^ a) n.a))
331 ?~ a ~
387 ?~ a ~
332 ?~(r.a [~ n.a] $(a r.a))
388 ?~(r.a [~ n.a] $(a r.a))
389+```
333
390
334−Examples
391+#### Examples
335−--------
336
392
393+```
337 > =a (~(gas to `(qeu @)`~) `(list @)`[1 2 3 4 5 6 ~])
394 > =a (~(gas to `(qeu @)`~) `(list @)`[1 2 3 4 5 6 ~])
338 > ~(top to a)
395 > ~(top to a)
339− [~ 1]
396+ [~ u=1]
397+```
340
398
399+#### Discussion
341
400
401+An empty queue has no head.
342
402
343−***
403+---
docs/reference/library/2l.umd+32−14
@@ -1,6 +1,9 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'15'
3+ title/'2l: Container from Container'
4+ ==
5+
6+;>
4
7
5# 2l: container from container
8# 2l: container from container
6
9
@@ -20,19 +23,26 @@ A map.
20
23
21#### Source
24#### Source
22
25
23− ++ malt
26+```
24− |* a=(list)
27+:- :~ navhome/'/docs/'
25− (molt `(list [p=_-<.a q=_->.a])`a)
28+ sort/'14'
29+ title/'2k: Jar and Jug Logic'
30+ ==
31+
32+;>
33+```
26
34
27#### Examples
35#### Examples
28
36
37+```
29 > (malt [['ok' 'no'] ['a' 'b'] ['x' 'y'] ~])
38 > (malt [['ok' 'no'] ['a' 'b'] ['x' 'y'] ~])
30 [n=[p='x' q='y'] l={[p='a' q='b'] [p='ok' q='no']} r={}]
39 [n=[p='x' q='y'] l={[p='a' q='b'] [p='ok' q='no']} r={}]
31
40
32 > (malt ~[[1 2 3] [4 5 6] [7 8 9]])
41 > (malt ~[[1 2 3] [4 5 6] [7 8 9]])
33 [n=[p=1 q=[2 3]] l={[p=4 q=[5 6]] [p=7 q=[8 9]]} r={}]
42 [n=[p=1 q=[2 3]] l={[p=4 q=[5 6]] [p=7 q=[8 9]]} r={}]
43+```
34
44
35−***
45+---
36### `++molt`
46### `++molt`
37
47
38Map from pair list
48Map from pair list
@@ -49,24 +59,28 @@ A map.
49
59
50#### Source
60#### Source
51
61
62+```
52− ++ molt
63+ ++ molt
53− |* a=(list (pair))
64+ |* a=(list (pair))
54− (~(gas by `(tree [p=_p.i.-.a q=_q.i.-.a})`~) a)
65+ (~(gas by `(tree [p=_p.i.-.a q=_q.i.-.a})`~) a)
66+```
55
67
56#### Examples
68#### Examples
57
69
70+```
58 > =a `(list (pair))`[[1 2] [4 3] [11 0] ~]
71 > =a `(list (pair))`[[1 2] [4 3] [11 0] ~]
59 > a
72 > a
60 > ~[[p=1 q=2] [p=4 q=3] [p=11 q=0]]
73 > ~[[p=1 q=2] [p=4 q=3] [p=11 q=0]]
61
74
62 > (molt a)
75 > (molt a)
63 [n=[p=11 q=0] l={[p=4 q=3] [p=1 q=2]} r={}]
76 [n=[p=11 q=0] l={[p=4 q=3] [p=1 q=2]} r={}]
77+```
64
78
65#### Discussion
79#### Discussion
66
80
67Only used internally as a helper to `malt`.
81Only used internally as a helper to `malt`.
68
82
69−***
83+---
70### `++silt`
84### `++silt`
71
85
72Set from list
86Set from list
@@ -83,14 +97,18 @@ A set.
83
97
84#### Source
98#### Source
85
99
100+```
86− ++ silt
101+ ++ silt
87− |* a=(list)
102+ |* a=(list)
88 =+ b=*(tree _?>(?=(^ a) i.a))
103 =+ b=*(tree _?>(?=(^ a) i.a))
89 (~(gas in b) a)
104 (~(gas in b) a)
105+```
90
106
91#### Examples
107#### Examples
92
108
109+```
93 > (silt `(list @t)`['c' 'hoon' 'javascript' 'python' ~])
110 > (silt `(list @t)`['c' 'hoon' 'javascript' 'python' ~])
94 [n='javascript' l={} r={'python' 'hoon' 'c'}]
111 [n='javascript' l={} r={'python' 'hoon' 'c'}]
112+```
95
113
96−***
114+---
docs/reference/library/2m.umd+59−22
@@ -1,6 +1,10 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'16'
3+ title/'2m: Container from Noun'
4+ ==
5+
6+;>
7+
4
8
5# 2m: container from noun
9# 2m: container from noun
6
10
@@ -20,22 +24,26 @@ A `list`.
20
24
21#### Source
25#### Source
22
26
27+```
23− ++ ly
28+ ++ ly
24 le:nl
29 le:nl
30+```
25
31
26#### Examples
32#### Examples
27
33
34+```
28 > (ly [1 2 3 ~])
35 > (ly [1 2 3 ~])
29 ~[1 2 3]
36 ~[1 2 3]
30
37
31 > (ly "abc")
38 > (ly "abc")
32 ~['a' 'b' 'c']
39 ~['a' 'b' 'c']
40+```
33
41
34#### Discussion.
42#### Discussion.
35
43
36`ly` is an alias for `le:nl`.
44`ly` is an alias for `le:nl`.
37
45
38−***
46+---
39### `++my`
47### `++my`
40
48
41Map from raw noun
49Map from raw noun
@@ -52,19 +60,23 @@ A `map`.
52
60
53#### Source
61#### Source
54
62
63+```
55− ++ my
64+ ++ my
56 my:nl
65 my:nl
66+```
57
67
58#### Examples
68#### Examples
59
69
70+```
60 > (my [['a' 1] ['b' 2] ~])
71 > (my [['a' 1] ['b' 2] ~])
61 [n=[p='b' q=2] l={[p='a' q=1]} r={}]
72 [n=[p='b' q=2] l={[p='a' q=1]} r={}]
73+```
62
74
63#### Discussion.
75#### Discussion.
64
76
65`my` is an alias for `my:nl`.
77`my` is an alias for `my:nl`.
66
78
67−***
79+---
68### `++sy`
80### `++sy`
69
81
70Set from raw noun
82Set from raw noun
@@ -81,11 +93,14 @@ A `set`.
81
93
82#### Source
94#### Source
83
95
96+```
84− ++ sy
97+ ++ sy
85 si:nl
98 si:nl
99+```
86
100
87#### Examples
101#### Examples
88
102
103+```
89 > (sy [1 2 3 ~])
104 > (sy [1 2 3 ~])
90 [n=2 l={1 3} r={}]
105 [n=2 l={1 3} r={}]
91
106
@@ -94,12 +109,13 @@ A `set`.
94
109
95 > (sy "abc")
110 > (sy "abc")
96 [n='b' l={'a' 'c'} r={}]
111 [n='b' l={'a' 'c'} r={}]
112+```
97
113
98#### Discussion.
114#### Discussion.
99
115
100`sy` is an alias for `si:nl`.
116`sy` is an alias for `si:nl`.
101
117
102−***
118+---
103### `++nl`
119### `++nl`
104
120
105Noun-to-container operations
121Noun-to-container operations
@@ -109,10 +125,12 @@ nouns.
109
125
110#### Source
126#### Source
111
127
128+```
112 ++ nl
129 ++ nl
113 |%
130 |%
131+```
114
132
115−***
133+---
116### `++le:nl`
134### `++le:nl`
117
135
118Construct list
136Construct list
@@ -129,22 +147,26 @@ A list.
129
147
130#### Source
148#### Source
131
149
150+```
132− ++ le
151+ ++ le
133 |* a=(list)
152 |* a=(list)
134 ^+ =< $
153 ^+ =< $
135 |% +- $ ?:(*? ~ [i=(snag 0 a) t=$])
154 |% +- $ ?:(*? ~ [i=(snag 0 a) t=$])
136 --
155 --
137 a
156 a
157+```
138
158
139#### Examples
159#### Examples
140
160
161+```
141 > (le:nl [1 2 3 ~])
162 > (le:nl [1 2 3 ~])
142 ~[1 2 3]
163 ~[1 2 3]
143
164
144 > (le:nl "abc")
165 > (le:nl "abc")
145 ~['a' 'b' 'c']
166 ~['a' 'b' 'c']
167+```
146
168
147−***
169+---
148### `++my:nl`
170### `++my:nl`
149
171
150Construct map
172Construct map
@@ -162,17 +184,21 @@ A map.
162
184
163#### Source
185#### Source
164
186
187+```
165− ++ my
188+ ++ my
166 |* a=(list (pair))
189 |* a=(list (pair))
167 => .(a ^+((le a) a))
190 => .(a ^+((le a) a))
168 (~(gas by `(map _p.i.-.a _q.i.-.a)`~) a)
191 (~(gas by `(map _p.i.-.a _q.i.-.a)`~) a)
192+```
169
193
170#### Examples
194#### Examples
171
195
196+```
172 > (my:nl [['a' 1] ['b' 2] ~])
197 > (my:nl [['a' 1] ['b' 2] ~])
173 [n=[p='b' q=2] l={[p='a' q=1]} r={}]
198 [n=[p='b' q=2] l={[p='a' q=1]} r={}]
199+```
174
200
175−***
201+---
176### `++si:nl`
202### `++si:nl`
177
203
178Construct set
204Construct set
@@ -189,23 +215,27 @@ A set.
189
215
190#### Source
216#### Source
191
217
218+```
192− ++ si
219+ ++ si
193 |* a=(list)
220 |* a=(list)
194 => .(a ^+((le a) a))
221 => .(a ^+((le a) a))
195 (~(gas in `(set _i.-.a)`~) a)
222 (~(gas in `(set _i.-.a)`~) a)
223+```
196
224
197#### Examples
225#### Examples
198
226
227+```
199 > (si:nl `(list [@t *])`[['a' 1] ['b' [2 3]] ~])
228 > (si:nl `(list [@t *])`[['a' 1] ['b' [2 3]] ~])
200 [n=['b' [2 3]] l={['a' 1]} r={}]
229 [n=['b' [2 3]] l={['a' 1]} r={}]
230+```
201
231
202−***
232+---
203### `++snag:nl`
233### `++snag:nl`
204
234
205Index
235Index
206
236
207Produces the element at the index `a` of null-terminated noun `b` and failing if
237Produces 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.
209
239
210#### Accepts
240#### Accepts
211
241
@@ -219,16 +249,19 @@ A noun.
219
249
220#### Sources
250#### Sources
221
251
252+```
222− ++ snag
253+ ++ snag
223 |* [a=@ b=(list)]
254 |* [a=@ b=(list)]
224 ?~ b
255 ?~ b
225 ~_ leaf+"snag-fail"
256 ~_ leaf+"snag-fail"
226 !!
257 !!
227 ?: =(0 a) i.b
258 ?: =(0 a) i.b
228 $(b t.b, a (dec a))
259 $(b t.b, a (dec a))
260+```
229
261
230#### Examples
262#### Examples
231
263
264+```
232 > =b [[2 3] [1 4] ~]
265 > =b [[2 3] [1 4] ~]
233 > (snag:nl 0 b)
266 > (snag:nl 0 b)
234 [2 3]
267 [2 3]
@@ -236,8 +269,9 @@ A noun.
236 > (snag:nl 2 b)
269 > (snag:nl 2 b)
237 ! snag-fail
270 ! snag-fail
238 ! exit
271 ! exit
272+```
239
273
240−***
274+---
241#### `++weld:nl`
275#### `++weld:nl`
242
276
243Concatenate
277Concatenate
@@ -256,20 +290,23 @@ A list.
256
290
257#### Source
291#### Source
258
292
293+```
259− ++ weld
294+ ++ weld
260 |* [a=(list) b=(list)]
295 |* [a=(list) b=(list)]
261 => .(a ^+((le a) a), b ^+((le b) b))
296 => .(a ^+((le a) a), b ^+((le b) b))
262 =+ 42
297 =+ 42
263 |-
298 |-
264 ?~ a b
299 ?~ a b
265 [i=i.a t=$(a t.a)]
300 [i=i.a t=$(a t.a)]
301+```
266
302
267#### Examples
303#### Examples
268
304
305+```
269 > =b [[2 3] [1 4] ~]
306 > =b [[2 3] [1 4] ~]
270
307
271 > (weld:nl b [8 9 ~])
308 > (weld:nl b [8 9 ~])
272 [i=[2 3] t=[i=[1 4] t=~[8 9]]]
309 [i=[2 3] t=[i=[1 4] t=~[8 9]]]
310+```
273
311
274−
312+---
275−***
docs/reference/library/2n.umd+84−41
@@ -1,7 +1,9 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'17'
3+ title/'2n: Functional Hacks'
4+ ==
4
5
6+;>
5
7
6# 2n: functional hacks
8# 2n: functional hacks
7
9
@@ -19,10 +21,13 @@ Build `f` such that `(f x) .= (b (a x))`.
19
21
20#### Source
22#### Source
21
23
24+```
22− ++ cork |*([a=_|=(* **) b=gate] (corl b a))
25+ ++ cork |*([a=_|=(* **) b=gate] (corl b a))
26+```
23
27
24#### Examples
28#### Examples
25
29
30+```
26 > (:(cork dec dec dec) 20)
31 > (:(cork dec dec dec) 20)
27 17
32 17
28
33
@@ -32,9 +37,9 @@ Build `f` such that `(f x) .= (b (a x))`.
32
37
33 > ((cork ~(got by mal) dec) %b)
38 > ((cork ~(got by mal) dec) %b)
34 22
39 22
40+```
35
41
36−
42+---
37−***
38### `++corl`
43### `++corl`
39
44
40Compose backward
45Compose backward
@@ -49,20 +54,22 @@ Build `f` such that
49
54
50#### Source
55#### Source
51
56
57+```
52− ++ corl
58+ ++ corl
53 |* [a=gate b=_|=(* **)]
59 |* [a=gate b=_|=(* **)]
54 =< +:|.((a (b))) :: span check
60 =< +:|.((a (b))) :: span check
55 |* c=_+<.b
61 |* c=_+<.b
56 (a (b c))
62 (a (b c))
57− ::
63+```
58
64
59#### Examples
65#### Examples
60
66
67+```
61 > ((corl (lift bex) (slat %ud)) '2')
68 > ((corl (lift bex) (slat %ud)) '2')
62 [~ 4]
69 [~ 4]
70+```
63
71
64−
72+---
65−***
66### `++curr`
73### `++curr`
67
74
68Right curry
75Right curry
@@ -81,22 +88,25 @@ A gate.
81
88
82#### Source
89#### Source
83
90
91+```
84− ++ curr
92+ ++ curr
85− |* [a=_|=(^ **) c=*}
93+ |* [a=_|=(^ **) c=*}
86 |* b=_+<+.a
94 |* b=_+<+.a
87 (a b c)
95 (a b c)
96+```
88
97
89#### Examples
98#### Examples
90
99
100+```
91 > =tep (cury scan sym)
101 > =tep (cury scan sym)
92 > `@t`(tep "asd")
102 > `@t`(tep "asd")
93 'asd'
103 'asd'
94
104
95 > `@t`(tep "lek-om")
105 > `@t`(tep "lek-om")
96 'lek-om'
106 'lek-om'
107+```
97
108
98−
109+---
99−***
100### `++cury`
110### `++cury`
101
111
102Curry left
112Curry left
@@ -115,22 +125,25 @@ A gate.
115
125
116#### Source
126#### Source
117
127
128+```
118− ++ cury
129+ ++ cury
119 |* [a=_|=(^ **) b=*}
130 |* [a=_|=(^ **) b=*}
120 |* c=_+<+.a
131 |* c=_+<+.a
121 (a b c)
132 (a b c)
122−
133+```
123
134
124#### Examples
135#### Examples
125
136
137+```
126 > =mol (cury add 2)
138 > =mol (cury add 2)
127 > (mol 4)
139 > (mol 4)
128 6
140 6
129
141
130 > (mol 7)
142 > (mol 7)
131 9
143 9
144+```
132
145
133−***
146+---
134### `++hard`
147### `++hard`
135
148
136Force remold
149Force remold
@@ -140,16 +153,18 @@ not.
140
153
141#### Source
154#### Source
142
155
156+```
143− ++ hard
157+ ++ hard
144 |* han=gate
158 |* han=gate
145 |= fud=* ^- han
159 |= fud=* ^- han
146 ~_ leaf+"hard"
160 ~_ leaf+"hard"
147 =+ gol=(han fud)
161 =+ gol=(han fud)
148 ?>(=(gol fud) gol)
162 ?>(=(gol fud) gol)
149− ::
163+```
150
164
151#### Examples
165#### Examples
152
166
167+```
153 > ((hard (list)) (limo [1 2 3 ~]))
168 > ((hard (list)) (limo [1 2 3 ~]))
154 ~[1 2 3]
169 ~[1 2 3]
155 > ((hard @) (add 2 2))
170 > ((hard @) (add 2 2))
@@ -159,10 +174,10 @@ not.
159 > ((hard tape) (crip "...Tape to cord, bro?..."))
174 > ((hard tape) (crip "...Tape to cord, bro?..."))
160 ! hard
175 ! hard
161 ! exit
176 ! exit
177+```
162
178
163
179
164−
180+---
165−***
166### `++soft`
181### `++soft`
167
182
168Maybe remold
183Maybe remold
@@ -172,29 +187,35 @@ is not.
172
187
173#### Source
188#### Source
174
189
190+```
175− ++ soft
191+ ++ soft
176 |* han=gate
192 |* han=gate
177 |= fud=* ^- (unit han)
193 |= fud=* ^- (unit han)
178 =+ gol=(han fud)
194 =+ gol=(han fud)
179 ?.(=(gol fud) ~ [~ gol])
195 ?.(=(gol fud) ~ [~ gol])
180− ::
196+```
181
197
182#### Examples
198#### Examples
183
199
200+```
184 > ((soft %4) (add 2 2))
201 > ((soft %4) (add 2 2))
185 [~ %4]
202 [~ %4]
203+
186 > ((soft @) (add 2 2))
204 > ((soft @) (add 2 2))
187 [~ 4]
205 [~ 4]
206+
188 > ((soft %5) (add 2 2))
207 > ((soft %5) (add 2 2))
189 ~
208 ~
209+
190 > ((soft @t) (crip "Tape to cord, Woohoo!"))
210 > ((soft @t) (crip "Tape to cord, Woohoo!"))
191 [~ 'Tape to cord, Woohoo!']
211 [~ 'Tape to cord, Woohoo!']
212+
192 > ((soft @t) (trip 'Cmon man... Tape to cord? Please?!'))
213 > ((soft @t) (trip 'Cmon man... Tape to cord? Please?!'))
193 ~
214 ~
215+```
194
216
195
217
196−
218+---
197−***
198### `++head`
219### `++head`
199
220
200Get head
221Get head
@@ -211,10 +232,13 @@ An atom.
211
232
212#### Source
233#### Source
213
234
235+```
214− ++ head |*(^ ,:+<-)
236+ ++ head |*(^ ,:+<-)
237+```
215
238
216#### Examples
239#### Examples
217
240
241+```
218 > (head [1 2])
242 > (head [1 2])
219 1
243 1
220
244
@@ -223,9 +247,9 @@ An atom.
223
247
224 > (head "hello")
248 > (head "hello")
225 'h'
249 'h'
250+```
226
251
227−
252+---
228−***
229### `++same`
253### `++same`
230
254
231Identity
255Identity
@@ -242,10 +266,13 @@ A noun.
242
266
243#### Source
267#### Source
244
268
269+```
245− ++ same |*(* +<)
270+ ++ same |*(* +<)
271+```
246
272
247#### Examples
273#### Examples
248
274
275+```
249 > (same [1 2])
276 > (same [1 2])
250 [1 2]
277 [1 2]
251
278
@@ -254,8 +281,9 @@ A noun.
254
281
255 > (same "hello")
282 > (same "hello")
256 "hello"
283 "hello"
284+```
257
285
258−***
286+---
259### `++slog`
287### `++slog`
260
288
261Deify printf
289Deify printf
@@ -273,15 +301,19 @@ A `tang`.
273
301
274#### Source
302#### Source
275
303
304+```
276− ++ slog
305+ ++ slog
277− =| pri=@
306+ =| pri=@
278− |= a=tang ^+ same
307+ |= a=tang ^+ same
279− ?~(a same ~>(%slog.[pri i.a] $(a t.a)))
308+ ?~(a same ~>(%slog.[pri i.a] $(a t.a)))
309+```
280
310
281#### Examples
311#### Examples
282
312
313+```
283 > =+ result=((slog [%leaf "error-message"]~) [12 13]) [%product result]
314 > =+ result=((slog [%leaf "error-message"]~) [12 13]) [%product result]
284 [%product 12 13]
315 [%product 12 13]
316+```
285
317
286#### Discussion
318#### Discussion
287
319
@@ -289,7 +321,7 @@ A `tang`.
289calls that string a piece of data through them, so that an error message will be
321calls that string a piece of data through them, so that an error message will be
290printed if there's one to print.
322printed if there's one to print.
291
323
292−***
324+---
293### `++mean`
325### `++mean`
294
326
295Crash and printf
327Crash and printf
@@ -306,19 +338,23 @@ A crash.
306
338
307#### Source
339#### Source
308
340
341+```
309− ++ mean
342+ ++ mean
310 |= a=tang
343 |= a=tang
311 ^+ !!
344 ^+ !!
312 ?~ a !!
345 ?~ a !!
313 ~_(i.a $(a t.a))
346 ~_(i.a $(a t.a))
347+```
314
348
315#### Examples
349#### Examples
316
350
351+```
317 > ~>(%mean.[%leaf "fuse-loop"] !!)
352 > ~>(%mean.[%leaf "fuse-loop"] !!)
318 ####
353 ####
319 !! crash
354 !! crash
355+```
320
356
321−***
357+---
322### `++tail`
358### `++tail`
323
359
324Get tail
360Get tail
@@ -335,10 +371,13 @@ A noun.
335
371
336#### Source
372#### Source
337
373
374+```
338 ++ tail |*(^ ,:+<+)
375 ++ tail |*(^ ,:+<+)
376+```
339
377
340#### Examples
378#### Examples
341
379
380+```
342 > (tail [1 2])
381 > (tail [1 2])
343 2
382 2
344
383
@@ -347,9 +386,9 @@ A noun.
347
386
348 > (tail "hello")
387 > (tail "hello")
349 "ello"
388 "ello"
389+```
350
390
351−
391+---
352−***
353### `++test`
392### `++test`
354
393
355Test for equality
394Test for equality
@@ -368,10 +407,13 @@ A flag.
368
407
369#### Source
408#### Source
370
409
410+```
371− ++ test |=(^ =(+<- +<+))
411+ ++ test |=(^ =(+<- +<+))
412+```
372
413
373#### Examples
414#### Examples
374
415
416+```
375 > (test 1 1)
417 > (test 1 1)
376 %.y
418 %.y
377
419
@@ -383,5 +425,6 @@ A flag.
383
425
384 > (test "hello" ['h' 'e' 'l' 'l' 'o' ~])
426 > (test "hello" ['h' 'e' 'l' 'l' 'o' ~])
385 %.y
427 %.y
428+```
386
429
387−***
430+---
docs/reference/library/2o.umd+42−25
@@ -1,18 +1,25 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'18'
3+ title/'2o: Normalizing Containers'
4+ ==
5+
6+;>
4
7
5# 2o: normalizing containers
8# 2o: normalizing containers
9+
6### `++jar`
10### `++jar`
7
11
8Mold generator. A `jar` is a `map` of `list`.
12Mold generator. A `jar` is a `map` of `list`.
9
13
10#### Source
14#### Source
11
15
16+```
12 ++ jar |*([a=mold b=mold] (map a (list b)))
17 ++ jar |*([a=mold b=mold] (map a (list b)))
18+```
13
19
14#### Examples
20#### Examples
15
21
22+```
16 > =a (ly [1 2 ~])
23 > =a (ly [1 2 ~])
17 > a
24 > a
18 ~[1 2]
25 ~[1 2]
@@ -30,24 +37,26 @@ Mold generator. A `jar` is a `map` of `list`.
30
37
31 > (~(get ja c) %c)
38 > (~(get ja c) %c)
32 ~
39 ~
33−
40+```
34
41
35#### Discussion
42#### Discussion
36
43
37See also: [`ja`](../2j), [`by`](../2i), [`map`](../2i), [`list`](../2b)
44See also: [`ja`](../2j), [`by`](../2i), [`map`](../2i), [`list`](../2b)
38
45
39−***
46+---
40### `++jug`
47### `++jug`
41
48
42Mold generator. A `jug` is a `map` of `set`.
49Mold generator. A `jug` is a `map` of `set`.
43
50
44#### Source
51#### Source
45
52
53+```
46− ++ jug |*([a=mold b=mold] (map a (set b)))
54+ ++ jug |*([a=mold b=mold] (map a (set b)))
47−
55+```
48
56
49#### Examples
57#### Examples
50
58
59+```
51 > =a (sy [1 2 ~])
60 > =a (sy [1 2 ~])
52 > a
61 > a
53 [n=2 l={1} r={}]
62 [n=2 l={1} r={}]
@@ -68,12 +77,13 @@ Mold generator. A `jug` is a `map` of `set`.
68 l=[n=[p=%a q=[n=2 l=[n=1 l={} r={}] r=~]] l={} r={}]
77 l=[n=[p=%a q=[n=2 l=[n=1 l={} r={}] r=~]] l={} r={}]
69 r=~
78 r=~
70 ]
79 ]
80+```
71
81
72#### Discussion
82#### Discussion
73
83
74See also: [`ja`](../2j), [`by`](../2i), [`map`](../2i), [`set`](..2h)
84See also: [`ja`](../2j), [`by`](../2i), [`map`](../2i), [`set`](..2h)
75
85
76−***
86+---
77### `++map`
87### `++map`
78
88
79Map
89Map
@@ -84,26 +94,29 @@ key-value pairs.
84
94
85#### Source
95#### Source
86
96
97+```
87− ++ map |* [a=mold b=mold]
98+ ++ map |* [a=mold b=mold]
88− %+ cork (tree (pair a b))
99+ %+ cork (tree (pair a b))
89− |= c=(tree (pair a b)) ^+ c
100+ |= c=(tree (pair a b)) ^+ c
90 ?.(~(apt by c) ~ c)
101 ?.(~(apt by c) ~ c)
102+```
91
103
92#### Examples
104#### Examples
93
105
94−
106+```
95 > ? *(map @t @u)
107 > ? *(map @t @u)
96 nlr({p/@t q/@u})
108 nlr({p/@t q/@u})
97− {}
109+ {}
98
110
99 > (molt `(list (pair * *))`[[a+1 b+2] ~])
111 > (molt `(list (pair * *))`[[a+1 b+2] ~])
100 [n=[p=[97 1] q=[98 2]] l={} r={}]
112 [n=[p=[97 1] q=[98 2]] l={} r={}]
113+```
101
114
102#### Discussion
115#### Discussion
103
116
104See also: [`by`](../2i)
117See also: [`by`](../2i)
105
118
106−***
119+---
107### `++qeu`
120### `++qeu`
108
121
109Queue
122Queue
@@ -113,12 +126,14 @@ items.
113
126
114#### Source
127#### Source
115
128
129+```
116− ++ qeu |*(a=mold (tree a))
130+ ++ qeu |*(a=mold (tree a))
117−
131+```
118
132
119
133
120#### Examples
134#### Examples
121
135
136+```
122 > (qeu time)
137 > (qeu time)
123 < 1.huj
138 < 1.huj
124 { *
139 { *
@@ -132,13 +147,13 @@ items.
132
147
133 > (~(gas to *(qeu time)) [~2014.1.1 ~2014.1.2 ~])
148 > (~(gas to *(qeu time)) [~2014.1.1 ~2014.1.2 ~])
134 [n=~2014.1.2 l={} r={~2014.1.1}]
149 [n=~2014.1.2 l={} r={~2014.1.1}]
135−
150+```
136
151
137#### Discussion
152#### Discussion
138
153
139See also: [`qeu`](../2k)
154See also: [`qeu`](../2k)
140
155
141−***
156+---
142### `++set`
157### `++set`
143
158
144Set
159Set
@@ -148,15 +163,16 @@ items.
148
163
149#### Source
164#### Source
150
165
166+```
151− ++ set |* a=mold
167+ ++ set |* a=mold
152− %+ cork (tree a)
168+ %+ cork (tree a)
153− |= b=(tree a) ^+ b
169+ |= b=(tree a) ^+ b
154− ?.(~(apt in b) ~ b)
170+ ?.(~(apt in b) ~ b)
155−
171+```
156
172
157#### Examples
173#### Examples
158
174
159−
175+```
160 > (sy "abc")
176 > (sy "abc")
161 [n='b' l={'a' 'c'} r={}]
177 [n='b' l={'a' 'c'} r={}]
162
178
@@ -165,9 +181,10 @@ items.
165
181
166 > (~(put in (sy "abc")) %a)
182 > (~(put in (sy "abc")) %a)
167 [n='b' l=[n='c' l={'a'} r={}] r=~]
183 [n='b' l=[n='c' l={'a'} r={}] r=~]
184+```
168
185
169#### Discussion
186#### Discussion
170
187
171See also: [`in`](../2h)
188See also: [`in`](../2h)
172
189
173−***
190+---
docs/reference/library/2p.umd+33−17
@@ -1,9 +1,13 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'19'
3+ title/'2p: Serialization'
4+ ==
5+
6+;>
4
7
5
8
6# 2p: serialization
9# 2p: serialization
10+
7### `++cue`
11### `++cue`
8
12
9Unpack atom to noun
13Unpack atom to noun
@@ -12,6 +16,7 @@ Produces a noun unpacked from atom `a`. The inverse of `jam`.
12
16
13#### Accepts
17#### Accepts
14
18
19+An Atom.
15
20
16#### Produces
21#### Produces
17
22
@@ -19,7 +24,8 @@ A noun.
19
24
20#### Source
25#### Source
21
26
27+```
22− ++ cue
28+ ++ cue
23 ~/ %cue
29 ~/ %cue
24 |= a=@
30 |= a=@
25 ^- *
31 ^- *
@@ -38,9 +44,11 @@ A noun.
38 [(add 2 (add p.u p.v)) w (~(put by r.v) b w)]
44 [(add 2 (add p.u p.v)) w (~(put by r.v) b w)]
39 =+ d=(rub c a)
45 =+ d=(rub c a)
40 [(add 2 p.d) (need (~(get by m) q.d)) m]
46 [(add 2 p.d) (need (~(get by m) q.d)) m]
47+```
41
48
42#### Examples
49#### Examples
43
50
51+```
44 > (cue 12)
52 > (cue 12)
45 1
53 1
46
54
@@ -52,9 +60,9 @@ A noun.
52
60
53 > (cue 39.689)
61 > (cue 39.689)
54 [0 19]
62 [0 19]
63+```
55
64
56−
65+---
57−***
58### `++jam`
66### `++jam`
59
67
60Pack noun to atom
68Pack noun to atom
@@ -71,7 +79,8 @@ An atom.
71
79
72#### Source
80#### Source
73
81
82+```
74− ++ jam
83+ ++ jam
75 ~/ %jam
84 ~/ %jam
76 |= a=*
85 |= a=*
77 ^- @
86 ^- @
@@ -94,10 +103,11 @@ An atom.
94 [(add 1 p.d) (lsh 0 1 q.d) m]
103 [(add 1 p.d) (lsh 0 1 q.d) m]
95 =+ d=(mat u.c)
104 =+ d=(mat u.c)
96 [(add 2 p.d) (mix 3 (lsh 0 2 q.d)) m]
105 [(add 2 p.d) (mix 3 (lsh 0 2 q.d)) m]
97−
106+```
98
107
99#### Examples
108#### Examples
100
109
110+```
101 > (jam 1)
111 > (jam 1)
102 12
112 12
103
113
@@ -109,12 +119,13 @@ An atom.
109
119
110 > (jam [~ u=19])
120 > (jam [~ u=19])
111 39.689
121 39.689
122+```
112
123
113#### Discussion
124#### Discussion
114
125
115`mat` is only used internally as a helper to `jam`.
126`mat` is only used internally as a helper to `jam`.
116
127
117−***
128+---
118### `++mat`
129### `++mat`
119
130
120Length-encode
131Length-encode
@@ -133,7 +144,8 @@ A cell of two atoms.
133
144
134#### Source
145#### Source
135
146
147+```
136− ++ mat
148+ ++ mat
137 ~/ %mat
149 ~/ %mat
138 |= a=@
150 |= a=@
139 ^- [p=@ q=@]
151 ^- [p=@ q=@]
@@ -143,9 +155,11 @@ A cell of two atoms.
143 =+ c=(met 0 b)
155 =+ c=(met 0 b)
144 :- (add (add c c) b)
156 :- (add (add c c) b)
145 (cat 0 (bex c) (mix (end 0 (dec c) b) (lsh 0 (dec c) a)))
157 (cat 0 (bex c) (mix (end 0 (dec c) b) (lsh 0 (dec c) a)))
158+```
146
159
147#### Examples
160#### Examples
148
161
162+```
149 > (mat 0xaaa)
163 > (mat 0xaaa)
150 [p=20 q=699.024]
164 [p=20 q=699.024]
151
165
@@ -167,12 +181,12 @@ A cell of two atoms.
167 > =c =-(~&(- -) (xeb b))
181 > =c =-(~&(- -) (xeb b))
168 4
182 4
169
183
170− > [`@ub`a `@ub`(end 0 (dec c) b) `@ub`(bex c)]
184+ > [`@ub`a `@ub`(end 0 (dec c) b) `@ub`(bex c)]
171 [0b1010.1010.1010 0b100 0b1.0000]
185 [0b1010.1010.1010 0b100 0b1.0000]
186+```
172
187
173
188
174−
189+---
175−***
176### `++rub`
190### `++rub`
177
191
178Length-decode
192Length-decode
@@ -194,7 +208,8 @@ A cell of two atoms.
194
208
195#### Source
209#### Source
196
210
211+```
197− ++ rub
212+ ++ rub
198 ~/ %rub
213 ~/ %rub
199 |= [a=@ b=@]
214 |= [a=@ b=@]
200 ^- [p=@ q=@]
215 ^- [p=@ q=@]
@@ -209,10 +224,11 @@ A cell of two atoms.
209 =+ d=(add a +(c))
224 =+ d=(add a +(c))
210 =+ e=(add (bex (dec c)) (cut 0 [d (dec c)] b))
225 =+ e=(add (bex (dec c)) (cut 0 [d (dec c)] b))
211 [(add (add c c) e) (cut 0 [(add d (dec c)) e] b)]
226 [(add (add c c) e) (cut 0 [(add d (dec c)) e] b)]
212−
227+```
213
228
214#### Examples
229#### Examples
215
230
231+```
216 > `@ub`(jam 0xaaa)
232 > `@ub`(jam 0xaaa)
217 0b1.0101.0101.0101.0010.0000
233 0b1.0101.0101.0101.0010.0000
218
234
@@ -221,10 +237,10 @@ A cell of two atoms.
221
237
222 > `@ux`q:(rub 1 0b1.0101.0101.0101.0010.0000)
238 > `@ux`q:(rub 1 0b1.0101.0101.0101.0010.0000)
223 0xaaa
239 0xaaa
224−
240+```
225
241
226#### Discussion
242#### Discussion
227
243
228`rub` is only used internally as a helper to `cue`.
244`rub` is only used internally as a helper to `cue`.
229
245
230−***
246+---
docs/reference/library/2q.umd+94−61
@@ -1,9 +1,13 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'20'
3+ title/'2q: Molds and Mold-Builders'
4+ ==
5+
6+;>
4
7
5
8
6# 2q: molds and mold builders
9# 2q: molds and mold builders
10+
7### `++char`
11### `++char`
8
12
9Character
13Character
@@ -14,19 +18,21 @@ consume `tape`s, which are lists of `char`.
14
18
15#### Source
19#### Source
16
20
21+```
17− ++ char @tD
22+ ++ char @tD
23+```
18
24
19#### Examples
25#### Examples
20
26
27+```
21 > *char
28 > *char
22 ''
29 ''
23−
30+
24 > `@tD`97
31 > `@tD`97
25 'a'
32 'a'
33+```
26
34
27−
35+---
28−
29−***
30### `++cord`
36### `++cord`
31
37
32UTF-8 text
38UTF-8 text
@@ -36,14 +42,16 @@ atom of UTF-8 text.
36
42
37#### Source
43#### Source
38
44
45+```
39− ++ cord @t
46+ ++ cord @t
47+```
40
48
41#### Examples
49#### Examples
42
50
43−
51+```
44 > *cord
52 > *cord
45 ''
53 ''
46−
54+
47 > `@ux`'foobar'
55 > `@ux`'foobar'
48 0x7261.626f.6f66
56 0x7261.626f.6f66
49
57
@@ -55,7 +63,7 @@ atom of UTF-8 text.
55
63
56 > `@t`499.984.265.845
64 > `@t`499.984.265.845
57 'urbit'
65 'urbit'
58−
66+```
59
67
60#### Discussion
68#### Discussion
61
69
@@ -67,7 +75,7 @@ from `tape` to `cord`.
67
75
68
76
69
77
70−***
78+---
71### `++date`
79### `++date`
72
80
73Point in time
81Point in time
@@ -77,11 +85,13 @@ which is a day atom and a time.
77
85
78#### Source
86#### Source
79
87
88+```
80− ++ date [[a=? y=@ud] m=@ud t=tarp]
89+ ++ date [[a=? y=@ud] m=@ud t=tarp]
81−
90+```
82
91
83#### Examples
92#### Examples
84
93
94+```
85 > *date
95 > *date
86 [[a=%.y y=0] m=0 t=[d=0 h=0 m=0 s=0 f=~]]
96 [[a=%.y y=0] m=0 t=[d=0 h=0 m=0 s=0 f=~]]
87
97
@@ -90,14 +100,14 @@ which is a day atom and a time.
90
100
91 > now
101 > now
92 ~2018.5.25..17.55.15..9ad8
102 ~2018.5.25..17.55.15..9ad8
93−
103+```
94
104
95
105
96#### Discussion
106#### Discussion
97
107
98See also: [`year`](../3c), [`yore`](../3c) [`stud`](../2q), [`dust`](../2q)
108See also: [`year`](../3c), [`yore`](../3c) [`stud`](../2q), [`dust`](../2q)
99
109
100−***
110+---
101### `++knot`
111### `++knot`
102
112
103ASCII
113ASCII
@@ -106,18 +116,22 @@ An atom type that only permits ASCII characters.
106
116
107#### Source
117#### Source
108
118
119+```
120+
109−++ knot @ta
121+ ++ knot @ta
122+```
110
123
111#### Examples
124#### Examples
112
125
126+```
113 > *knot
127 > *knot
114 ~.
128 ~.
115−
129+
116 > `@ta`105
130 > `@ta`105
117 ~.i
131 ~.i
132+```
118
133
119−
134+---
120−***
121### `++tang`
135### `++tang`
122
136
123Generic print structure
137Generic print structure
@@ -127,10 +141,13 @@ traces.
127
141
128#### Source
142#### Source
129
143
144+```
130−++ tang (list tank)
145+ ++ tang (list tank)
146+```
131
147
132#### Examples
148#### Examples
133
149
150+```
134 > *tang
151 > *tang
135 ~
152 ~
136
153
@@ -145,34 +162,38 @@ traces.
145
162
146 > (~(win re [%rose ["1" "2" "3"] [%leaf "foobar"] [%leaf "bazbud"] ~]) 0 10)
163 > (~(win re [%rose ["1" "2" "3"] [%leaf "foobar"] [%leaf "bazbud"] ~]) 0 10)
147 <<"2 foobar" " bazbud" "3">>
164 <<"2 foobar" " bazbud" "3">>
165+```
148
166
149−
167+---
150−***
151### `++tank`
168### `++tank`
152
169
153Pretty-printing structure
170Pretty-printing structure
154
171
155A `tank` is one of three cases: a `%leaf` is simply a string (a printed line);
172A `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
157new lines; and a `%rose` is a list of `tank` delimited by the strings in `p`
174new lines; and a `%rose` is a list of `tank` delimited by the strings in `p`
158without back-steps at new lines.
175without back-steps at new lines.
159
176
160
177
161#### Source
178#### Source
162
179
180+```
163− ++ tank $% [$leaf p=tape]
181+ ++ tank $% [$leaf p=tape]
164− $: $palm
182+ $: $palm
165− p=[p=tape q=tape r=tape s=tape]
183+ p=[p=tape q=tape r=tape s=tape]
166− q=(list tank)
184+ q=(list tank)
167− ==
185+ ==
168− $: $rose
186+ $: $rose
169− p=[p=tape q=tape r=tape]
187+ p=[p=tape q=tape r=tape]
170− q=(list tank)
188+ q=(list tank)
171− ==
189+ ==
172− ==
190+ ==
191+```
173
192
174#### Examples
193#### Examples
175
194
195+
196+```
176 > *tank
197 > *tank
177 [%rose p=[p="" q="" r=""] q=~]
198 [%rose p=[p="" q="" r=""] q=~]
178
199
@@ -187,7 +208,7 @@ without back-steps at new lines.
187 2.854.495.385.411.919.762.116.571.938.898.990.272.765.493.248
208 2.854.495.385.411.919.762.116.571.938.898.990.272.765.493.248
188 ]
209 ]
189
210
190− > (wash [0 40] >(bex 150) (bex 151)<)
211+ > (wash [0 40] >(bex 150) (bex 151)<)
191 <<
212 <<
192 "[ \\/1.427.247.692.705.959.881.058.285.\\/"
213 "[ \\/1.427.247.692.705.959.881.058.285.\\/"
193 " 969.449.495.136.382.746.624"
214 " 969.449.495.136.382.746.624"
@@ -196,11 +217,11 @@ without back-steps at new lines.
196 " 938.898.990.272.765.493.248"
217 " 938.898.990.272.765.493.248"
197 " \\/ \\/"
218 " \\/ \\/"
198 "]"
219 "]"
199− >>
220+ >>
200−
221+```
201
222
202
223
203−***
224+---
204### `++tape`
225### `++tape`
205
226
206List of characters
227List of characters
@@ -210,13 +231,16 @@ One of Hoon's two string types, the other being `++cord`. A tape is a list of
210
231
211#### Source
232#### Source
212
233
234+```
213− ++ tape (list @tD)
235+ ++ tape (list @tD)
236+```
214
237
215#### Examples
238#### Examples
216
239
240+```
217 > *tape
241 > *tape
218 ""
242 ""
219−
243+
220 > `tape`"foobar"
244 > `tape`"foobar"
221 "foobar"
245 "foobar"
222
246
@@ -228,24 +252,25 @@ One of Hoon's two string types, the other being `++cord`. A tape is a list of
228
252
229 > `(list @)`"foobar"
253 > `(list @)`"foobar"
230 ~[102 111 111 98 97 114]
254 ~[102 111 111 98 97 114]
255+```
231
256
232−
257+---
233−***
234### `++tarp`
258### `++tarp`
235
259
236Parsed time
260Parsed time
237
261
238The time component of a `date`: day, hour, minute, second and a list of `@ux`
262The time component of a `date`: day, hour, minute, second and a list of `@ux`
239− for precision.
263+for precision.
240
264
241#### Source
265#### Source
242
266
267+```
243− ++ tarp [d=@ud h=@ud m=@ud s=@ud f=(list @ux)]
268+ ++ tarp [d=@ud h=@ud m=@ud s=@ud f=(list @ux)]
244−
269+```
245
270
246#### Examples
271#### Examples
247
272
248−
273+```
249 > *tarp
274 > *tarp
250 [d=0 h=0 m=0 s=0 f=~]
275 [d=0 h=0 m=0 s=0 f=~]
251
276
@@ -257,10 +282,10 @@ The time component of a `date`: day, hour, minute, second and a list of `@ux`
257
282
258 > (yell ~d20)
283 > (yell ~d20)
259 [d=20 h=0 m=0 s=0 f=~]
284 [d=20 h=0 m=0 s=0 f=~]
285+```
260
286
261
287
262−
288+---
263−***
264### `++term`
289### `++term`
265
290
266Hoon constant
291Hoon constant
@@ -274,10 +299,13 @@ special syntax, `$`.
274
299
275#### Source
300#### Source
276
301
302+```
277− ++ term @tas
303+ ++ term @tas
304+```
278
305
279#### Examples
306#### Examples
280
307
308+```
281 > *term
309 > *term
282 %$
310 %$
283
311
@@ -289,31 +317,34 @@ special syntax, `$`.
289
317
290 > -:!>(%dead-fish9)
318 > -:!>(%dead-fish9)
291 #t/$dead-fish9
319 #t/$dead-fish9
320+```
292
321
293
322
294−
323+---
295−***
296### `++wain`
324### `++wain`
297
325
298−List of strings
326+List of strings
299
327
300A list of `cord`s. A `wain` is used instead of a single `cord` with `\n`.
328A list of `cord`s. A `wain` is used instead of a single `cord` with `\n`.
301
329
302
330
303#### Source
331#### Source
304
332
333+```
305− ++ wain (list cord)
334+ ++ wain (list cord)
335+```
306
336
307#### Examples
337#### Examples
308
338
339+```
309 > *wain
340 > *wain
310 <||>
341 <||>
311
342
312 > `wain`/som/del/rok
343 > `wain`/som/del/rok
313 <|som del rok|>
344 <|som del rok|>
345+```
314
346
315−
347+---
316−***
317### `++wall`
348### `++wall`
318
349
319List of list of characters
350List of list of characters
@@ -322,13 +353,15 @@ A list of `tape`s. `wall` is used instead of a single `tape` with `\n`.
322
353
323#### Source
354#### Source
324
355
356+```
325− ++ wall (list tape)
357+ ++ wall (list tape)
326−
358+```
327#### Examples
359#### Examples
328
360
361+```
329 > *wall
362 > *wall
330 <<>>
363 <<>>
331−
364+
332 > `wall`(wash [0 20] leaf+<(bex 256)>)
365 > `wall`(wash [0 20] leaf+<(bex 256)>)
333 <<
366 <<
334 "\\/115.792.089.237.\\/"
367 "\\/115.792.089.237.\\/"
@@ -340,7 +373,7 @@ A list of `tape`s. `wall` is used instead of a single `tape` with `\n`.
340 " 639.936"
373 " 639.936"
341 "\\/ \\/"
374 "\\/ \\/"
342 >>
375 >>
376+```
343
377
344
378
345−
379+---
346−***
docs/reference/library/3a.umd+129−46
@@ -1,6 +1,9 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'21'
3+ title/'3a: Modular and Signed Ints'
4+ ==
5+
6+;>
4
7
5# 3a: modular and signed ints
8# 3a: modular and signed ints
6
9
@@ -10,7 +13,7 @@ Extended Euclidean algorithm
10
13
11Produces `d`, the
14Produces `d`, the
12[greatest common divisor](https://en.wikipedia.org/wiki/Greatest_common_divisor)
15[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)`.
14
17
15#### Accepts
18#### Accepts
16
19
@@ -28,7 +31,8 @@ of `a` and `b`. Also produces `u` and `v` such that `au + bv = GCD(a, b)`.
28
31
29#### Source
32#### Source
30
33
34+```
31− ++ egcd
35+ ++ egcd
32 |= [a=@ b=@]
36 |= [a=@ b=@]
33 =+ si
37 =+ si
34 =+ [c=(sun a) d=(sun b)]
38 =+ [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)`.
40 %= $
44 %= $
41 c (dif d (pro q c))
45 c (dif d (pro q c))
42 d c
46 d c
43− u [(dif d.u (pro q c.u)) c.u]
47+ u [(dif d.u (pro q c.u)) c.u]
44 v [(dif d.v (pro q c.v)) c.v]
48 v [(dif d.v (pro q c.v)) c.v]
45 ==
49 ==
46−
50+```
47
51
48#### Examples
52#### Examples
49
53
54+```
50 > (egcd 11 2)
55 > (egcd 11 2)
51 [d=1 u=--1 v=-5]
56 [d=1 u=--1 v=-5]
57+```
52
58
53−***
59+---
54### `++fo`
60### `++fo`
55
61
56Modulo prime
62Modulo prime
@@ -59,10 +65,11 @@ Container core for modular arithmetic functions.
59
65
60#### Source
66#### Source
61
67
68+```
62− ++ fo
69+ ++ fo
63 ^?
70 ^?
64 |_ a=@
71 |_ a=@
65−
72+```
66
73
67#### `++dif`
74#### `++dif`
68
75
@@ -84,17 +91,21 @@ An atom.
84
91
85#### Source
92#### Source
86
93
94+```
87 ++ dif
95 ++ dif
88 |= [b=@ c=@]
96 |= [b=@ c=@]
89 (sit (sub (add a b) (sit c)))
97 (sit (sub (add a b) (sit c)))
98+```
90
99
91#### Examples
100#### Examples
92
101
102+```
93 > (~(dif fo 6) 1 2)
103 > (~(dif fo 6) 1 2)
94 5
104 5
95
105
96 > (~(dif fo 21) 11 45)
106 > (~(dif fo 21) 11 45)
97 8
107 8
108+```
98
109
99#### `++exp`
110#### `++exp`
100
111
@@ -116,6 +127,7 @@ An atom.
116
127
117#### Source
128#### Source
118
129
130+```
119 ++ exp
131 ++ exp
120 |= [b=@ c=@]
132 |= [b=@ c=@]
121 ?: =(0 b)
133 ?: =(0 b)
@@ -123,9 +135,11 @@ An atom.
123 =+ d=$(b (rsh 0 1 b))
135 =+ d=$(b (rsh 0 1 b))
124 =+ e=(pro d d)
136 =+ e=(pro d d)
125 ?:(=(0 (end 0 1 b)) e (pro c e))
137 ?:(=(0 (end 0 1 b)) e (pro c e))
138+```
126
139
127#### Examples
140#### Examples
128
141
142+```
129 > (~(exp fo 5) 8 2)
143 > (~(exp fo 5) 8 2)
130 1
144 1
131
145
@@ -137,8 +151,9 @@ An atom.
137
151
138 > (~(exp fo 995) 8 2)
152 > (~(exp fo 995) 8 2)
139 256
153 256
154+```
140
155
141−***
156+---
142### `++fra`
157### `++fra`
143
158
144Divide
159Divide
@@ -165,12 +180,15 @@ An atom.
165
180
166#### Source
181#### Source
167
182
183+```
168 ++ fra
184 ++ fra
169 |= [b=@ c=@]
185 |= [b=@ c=@]
170 (pro b (inv c))
186 (pro b (inv c))
187+```
171
188
172#### Examples
189#### Examples
173
190
191+```
174 > (~(fra fo 2) 8 2)
192 > (~(fra fo 2) 8 2)
175 0
193 0
176
194
@@ -182,8 +200,9 @@ An atom.
182
200
183 > (~(fra fo 5) 8 2)
201 > (~(fra fo 5) 8 2)
184 4
202 4
203+```
185
204
186−***
205+---
187### `++inv`
206### `++inv`
188
207
189Inverse
208Inverse
@@ -203,13 +222,16 @@ An atom.
203
222
204#### Source
223#### Source
205
224
225+```
206 ++ inv
226 ++ inv
207 |= b=@
227 |= b=@
208 =+ c=(dul:si u:(egcd b a) a)
228 =+ c=(dul:si u:(egcd b a) a)
209 c
229 c
230+```
210
231
211#### Examples
232#### Examples
212
233
234+```
213 > (~(inv fo 11) 2)
235 > (~(inv fo 11) 2)
214 6
236 6
215
237
@@ -224,8 +246,9 @@ An atom.
224
246
225 > (~(inv fo 70) 255)
247 > (~(inv fo 70) 255)
226 67
248 67
249+```
227
250
228−***
251+---
229### `++pro`
252### `++pro`
230
253
231Multiplication
254Multiplication
@@ -246,19 +269,23 @@ An atom.
246
269
247#### Source
270#### Source
248
271
272+```
249 ++ pro
273 ++ pro
250 |= [b=@ c=@]
274 |= [b=@ c=@]
251 (sit (mul b c))
275 (sit (mul b c))
276+```
252
277
253#### Examples
278#### Examples
254
279
280+```
255 > (~(pro fo 3) 11 4)
281 > (~(pro fo 3) 11 4)
256 2
282 2
257
283
258 > (mod 44 3)
284 > (mod 44 3)
259 2
285 2
286+```
260
287
261−***
288+---
262### `++sit`
289### `++sit`
263
290
264Modulus
291Modulus
@@ -277,16 +304,20 @@ An atom.
277
304
278#### Source
305#### Source
279
306
307+```
280 ++ sit
308 ++ sit
281 |= b=@
309 |= b=@
282 (mod b a)
310 (mod b a)
311+```
283
312
284#### Examples
313#### Examples
285
314
315+```
286 > (~(sit fo 3) 14)
316 > (~(sit fo 3) 14)
287 2
317 2
318+```
288
319
289−***
320+---
290### `++sum`
321### `++sum`
291
322
292Modular sum
323Modular sum
@@ -307,20 +338,24 @@ An atom.
307
338
308#### Source
339#### Source
309
340
341+```
310 ++ sum
342 ++ sum
311 |= [b=@ c=@]
343 |= [b=@ c=@]
312 (sit (add b c))
344 (sit (add b c))
313 --
345 --
346+```
314
347
315#### Examples
348#### Examples
316
349
350+```
317 > (~(sum fo 3) 14 3)
351 > (~(sum fo 3) 14 3)
318 2
352 2
319
353
320 > (mod 17 3)
354 > (mod 17 3)
321 2
355 2
356+```
322
357
323−***
358+---
324### `++si`
359### `++si`
325
360
326Signed integer
361Signed integer
@@ -329,9 +364,11 @@ Container core for signed integer functions.
329
364
330#### Source
365#### Source
331
366
367+```
332− ++ si
368+ ++ si
333 ^?
369 ^?
334 |%
370 |%
371+```
335
372
336#### Discussion
373#### Discussion
337
374
@@ -343,6 +380,7 @@ Positive signed integers correspond to odd atoms of twice their absolute value,
343and negative signed integers correspond to atoms of twice their absolute value
380and negative signed integers correspond to atoms of twice their absolute value
344minus one. For example:
381minus one. For example:
345
382
383+```
346 > `@`--4
384 > `@`--4
347 8
385 8
348 > `@s`8
386 > `@s`8
@@ -352,8 +390,9 @@ minus one. For example:
352 7
390 7
353 > `@s`7
391 > `@s`7
354 -4
392 -4
393+```
355
394
356−***
395+---
357### `++abs:si`
396### `++abs:si`
358
397
359Absolute value
398Absolute value
@@ -370,17 +409,21 @@ An atom.
370
409
371### Source
410### Source
372
411
412+```
373 ++ abs |=(a=@s (add (end 0 1 a) (rsh 0 1 a)))
413 ++ abs |=(a=@s (add (end 0 1 a) (rsh 0 1 a)))
414+```
374
415
375#### Examples
416#### Examples
376
417
418+```
377 > (abs:si -11)
419 > (abs:si -11)
378 11
420 11
379
421
380 > (abs:si --520)
422 > (abs:si --520)
381 520
423 520
424+```
382
425
383−***
426+---
384### `++dif:si`
427### `++dif:si`
385
428
386Subtraction
429Subtraction
@@ -399,18 +442,22 @@ A signed integer.
399
442
400#### Source
443#### Source
401
444
445+```
402− ++ dif |= [a=@s b=@s]
446+ ++ dif |= [a=@s b=@s]
403 (sum a (new !(syn b) (abs b)))
447 (sum a (new !(syn b) (abs b)))
448+```
404
449
405#### Examples
450#### Examples
406
451
452+```
407 > (dif:si --3 -2)
453 > (dif:si --3 -2)
408 --5
454 --5
409
455
410 > (dif:si -3 --2)
456 > (dif:si -3 --2)
411 -5
457 -5
458+```
412
459
413−***
460+---
414### `++dul:si`
461### `++dul:si`
415
462
416Modulus
463Modulus
@@ -429,11 +476,14 @@ An atom.
429
476
430#### Source
477#### Source
431
478
479+```
432− ++ dul |= [a=@s b=@]
480+ ++ dul |= [a=@s b=@]
433 =+(c=(old a) ?:(-.c (mod +.c b) (sub b +.c)))
481 =+(c=(old a) ?:(-.c (mod +.c b) (sub b +.c)))
482+```
434
483
435#### Examples
484#### Examples
436
485
486+```
437 > `@s`(dul:si -1 --5)
487 > `@s`(dul:si -1 --5)
438 -5
488 -5
439
489
@@ -444,9 +494,9 @@ An atom.
444
494
445 > `@s`(dul:si -11 -61)
495 > `@s`(dul:si -11 -61)
446 --55
496 --55
497+```
447
498
448−
499+---
449−***
450#### `++fra:si`
500#### `++fra:si`
451
501
452Divide
502Divide
@@ -465,11 +515,14 @@ A signed atom.
465
515
466#### Source
516#### Source
467
517
518+```
468− ++ fra |= [a=@s b=@s]
519+ ++ fra |= [a=@s b=@s]
469 (new =(0 (mix (syn a) (syn b))) (div (abs a) (abs b)))
520 (new =(0 (mix (syn a) (syn b))) (div (abs a) (abs b)))
521+```
470
522
471#### Examples
523#### Examples
472
524
525+```
473 > (fra:si -1 -1)
526 > (fra:si -1 -1)
474 --1
527 --1
475
528
@@ -478,9 +531,9 @@ A signed atom.
478
531
479 > (fra:si -0 -1)
532 > (fra:si -0 -1)
480 --0
533 --0
534+```
481
535
482−
536+---
483−***
484### `++new`
537### `++new`
485
538
486Atom to @s
539Atom to @s
@@ -501,11 +554,14 @@ A signed integer.
501
554
502#### Source
555#### Source
503
556
557+```
504− ++ new |= [a=? b=@]
558+ ++ new |= [a=? b=@]
505 `@s`?:(a (mul 2 b) ?:(=(0 b) 0 +((mul 2 (dec b)))))
559 `@s`?:(a (mul 2 b) ?:(=(0 b) 0 +((mul 2 (dec b)))))
560+```
506
561
507#### Examples
562#### Examples
508
563
564+```
509 > (new:si | 2)
565 > (new:si | 2)
510 -2
566 -2
511
567
@@ -517,8 +573,9 @@ A signed integer.
517
573
518 > (new:si & --2)
574 > (new:si & --2)
519 --4
575 --4
576+```
520
577
521−***
578+---
522### `++old:si`
579### `++old:si`
523
580
524Sign and absolute value
581Sign and absolute value
@@ -536,17 +593,21 @@ A cell composed of a `term` and an atom.
536
593
537#### Source
594#### Source
538
595
596+```
539− ++ old |=(a=@s [(syn a) (abs a)])
597+ ++ old |=(a=@s [(syn a) (abs a)])
598+```
540
599
541#### Examples
600#### Examples
542
601
602+```
543 > (old:si -2)
603 > (old:si -2)
544 [%.n 2]
604 [%.n 2]
545
605
546 > (old:si --2)
606 > (old:si --2)
547 [%.y 2]
607 [%.y 2]
608+```
548
609
549−***
610+---
550### `++pro`
611### `++pro`
551
612
552Multiplication
613Multiplication
@@ -561,18 +622,22 @@ Produces a signed integer by multiplying `a` and `b`.
561
622
562#### Source
623#### Source
563
624
625+```
564− ++ pro |= [a=@s b=@s]
626+ ++ pro |= [a=@s b=@s]
565 (new =(0 (mix (syn a) (syn b))) (mul (abs a) (abs b)))
627 (new =(0 (mix (syn a) (syn b))) (mul (abs a) (abs b)))
628+```
566
629
567#### Examples
630#### Examples
568
631
632+```
569 > (pro:si -3 -3)
633 > (pro:si -3 -3)
570 --9
634 --9
571
635
572 > (pro:si -3 --3)
636 > (pro:si -3 --3)
573 -9
637 -9
638+```
574
639
575−***
640+---
576### `++rem:si`
641### `++rem:si`
577
642
578Remainder
643Remainder
@@ -591,10 +656,13 @@ A signed integer.
591
656
592#### Source
657#### Source
593
658
659+```
594− ++ rem |=([a=@s b=@s] (dif a (pro b (fra a b))))
660+ ++ rem |=([a=@s b=@s] (dif a (pro b (fra a b))))
661+```
595
662
596#### Examples
663#### Examples
597
664
665+```
598 > (rem:si -17 -3)
666 > (rem:si -17 -3)
599 -2
667 -2
600
668
@@ -606,10 +674,10 @@ A signed integer.
606
674
607 > (rem:si --17 --3)
675 > (rem:si --17 --3)
608 --2
676 --2
677+```
609
678
610
679
611−
680+---
612−***
613### `++sum:si`
681### `++sum:si`
614
682
615Addition
683Addition
@@ -628,7 +696,8 @@ A signed integer.
628
696
629#### Source
697#### Source
630
698
699+```
631− ++ sum |= [a=@s b=@s]
700+ ++ sum |= [a=@s b=@s]
632 =+ [c=(old a) d=(old b)]
701 =+ [c=(old a) d=(old b)]
633 ?: -.c
702 ?: -.c
634 ?: -.d
703 ?: -.d
@@ -641,16 +710,19 @@ A signed integer.
641 (new | (sub +.c +.d))
710 (new | (sub +.c +.d))
642 (new & (sub +.d +.c))
711 (new & (sub +.d +.c))
643 (new | (add +.c +.d))
712 (new | (add +.c +.d))
713+```
644
714
645#### Examples
715#### Examples
646
716
717+```
647 > (sum:si -11 --2)
718 > (sum:si -11 --2)
648 -9
719 -9
649
720
650 > (sum:si --2 --2)
721 > (sum:si --2 --2)
651 --4
722 --4
723+```
652
724
653−***
725+---
654#### `++sun:si`
726#### `++sun:si`
655
727
656@u to @s
728@u to @s
@@ -667,10 +739,13 @@ An atom.
667
739
668#### Source
740#### Source
669
741
742+```
670− ++ sun |=(a=@u (mul 2 a))
743+ ++ sun |=(a=@u (mul 2 a))
744+```
671
745
672#### Examples
746#### Examples
673
747
748+```
674 > (mul 2 90)
749 > (mul 2 90)
675 180
750 180
676
751
@@ -688,8 +763,9 @@ An atom.
688 354
763 354
689 > `@u`-89
764 > `@u`-89
690 177
765 177
766+```
691
767
692−***
768+---
693### `++syn:si`
769### `++syn:si`
694
770
695Sign test
771Sign test
@@ -707,18 +783,21 @@ An `term`.
707
783
708#### Source
784#### Source
709
785
786+```
710− ++ syn |=(a=@s =(0 (end 0 1 a)))
787+ ++ syn |=(a=@s =(0 (end 0 1 a)))
788+```
711
789
712#### Examples
790#### Examples
713
791
792+```
714 > (syn:si -2)
793 > (syn:si -2)
715 %.n
794 %.n
716
795
717 > (syn:si --2)
796 > (syn:si --2)
718 %.y
797 %.y
798+```
719
799
720−
800+---
721−***
722### `++cmp:si`
801### `++cmp:si`
723
802
724Compare
803Compare
@@ -737,9 +816,10 @@ equal, `--0` is produced.
737
816
738A signed integer.
817A signed integer.
739
818
740−#### Source
819+#### Source
741
820
821+```
742− ++ cmp |= [a=@s b=@s]
822+ ++ cmp |= [a=@s b=@s]
743 ^- @s
823 ^- @s
744 ?: =(a b)
824 ?: =(a b)
745 --0
825 --0
@@ -755,9 +835,11 @@ A signed integer.
755 -1
835 -1
756 --1
836 --1
757 --
837 --
838+```
758
839
759#### Examples
840#### Examples
760
841
842+```
761 > (cmp:si -2 --1)
843 > (cmp:si -2 --1)
762 -1
844 -1
763
845
@@ -772,5 +854,6 @@ A signed integer.
772
854
773 > (cmp:si --2 --5)
855 > (cmp:si --2 --5)
774 -1
856 -1
857+```
775
858
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+
1---
5210---
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+
3---
5239---
5240+### `++add:rh`
4
5241
5242+Produces the sum of `a` plus `b`.
5
5243
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+ ==
1
5
2−---
6+;>
3−navhome: /docs/
4−---
5−
6
7
7# 3c: urbit time
8# 3c: urbit time
8
9
@@ -23,7 +24,8 @@ A cell of unsigned decimals.
23
24
24#### Source
25#### Source
25
26
27+```
26− ++ yall
28+ ++ yall
27 |= day=@ud
29 |= day=@ud
28 ^- [y=@ud m=@ud d=@ud]
30 ^- [y=@ud m=@ud d=@ud]
29 =+ [era=0 cet=0 lep=*?]
31 =+ [era=0 cet=0 lep=*?]
@@ -46,10 +48,11 @@ A cell of unsigned decimals.
46 ?: (lth day zis)
48 ?: (lth day zis)
47 [yer +(mot) +(day)]
49 [yer +(mot) +(day)]
48 $(mot +(mot), day (sub day zis))
50 $(mot +(mot), day (sub day zis))
49−
51+```
50
52
51#### Examples
53#### Examples
52
54
55+```
53 > (yall 198)
56 > (yall 198)
54 [y=0 m=7 d=17]
57 [y=0 m=7 d=17]
55
58
@@ -58,10 +61,10 @@ A cell of unsigned decimals.
58
61
59 > (yall 0)
62 > (yall 0)
60 [y=0 m=1 d=1]
63 [y=0 m=1 d=1]
64+```
61
65
62
66
63−
67+---
64−***
65### `++yawn`
68### `++yawn`
66
69
67Days since beginning of time
70Days since beginning of time
@@ -83,7 +86,8 @@ An unsigned decimal.
83
86
84#### Source
87#### Source
85
88
89+```
86− ++ yawn
90+ ++ yawn
87 |= [yer=@ud mot=@ud day=@ud]
91 |= [yer=@ud mot=@ud day=@ud]
88 ^- @ud
92 ^- @ud
89 => .(mot (dec mot), day (dec day))
93 => .(mot (dec mot), day (dec day))
@@ -107,9 +111,11 @@ An unsigned decimal.
107 =+ nec=(sub yer 100)
111 =+ nec=(sub yer 100)
108 $(yer nec, day (add day ?:((yelp nec) 36.525 36.524)))
112 $(yer nec, day (add day ?:((yelp nec) 36.525 36.524)))
109 (add day (mul (div yer 400) (add 1 (mul 4 36.524))))
113 (add day (mul (div yer 400) (add 1 (mul 4 36.524))))
114+```
110
115
111#### Examples
116#### Examples
112
117
118+```
113 > (yawn 2.018 7 4)
119 > (yawn 2.018 7 4)
114 737.244
120 737.244
115
121
@@ -118,9 +124,9 @@ An unsigned decimal.
118
124
119 > (yawn 1.990 10 11)
125 > (yawn 1.990 10 11)
120 727.116
126 727.116
127+```
121
128
122−
129+---
123−***
124### `++year`
130### `++year`
125
131
126Date to @d
132Date to @d
@@ -138,7 +144,8 @@ A `@d`.
138
144
139#### Source
145#### Source
140
146
147+```
141− ++ year
148+ ++ year
142 |= det=date
149 |= det=date
143 ^- @da
150 ^- @da
144 =+ ^= yer
151 =+ ^= yer
@@ -147,15 +154,16 @@ A `@d`.
147 (sub 292.277.024.400 (dec y.det))
154 (sub 292.277.024.400 (dec y.det))
148 =+ day=(yawn yer m.det d.t.det)
155 =+ day=(yawn yer m.det d.t.det)
149 (yule day h.t.det m.t.det s.t.det f.t.det)
156 (yule day h.t.det m.t.det s.t.det f.t.det)
150−
157+```
151
158
152#### Examples
159#### Examples
153
160
161+```
154 > (year [[a=%.y y=2.014] m=8 t=[d=4 h=20 m=4 s=57 f=~[0xd940]]])
162 > (year [[a=%.y y=2.014] m=8 t=[d=4 h=20 m=4 s=57 f=~[0xd940]]])
155 0x8000000d227df4e9d940000000000000
163 0x8000000d227df4e9d940000000000000
164+```
156
165
157−
166+---
158−***
159### `++yell`
167### `++yell`
160
168
161Tarp from atomic date
169Tarp from atomic date
@@ -172,7 +180,8 @@ A `tarp`.
172
180
173#### Source
181#### Source
174
182
183+```
175− ++ yell
184+ ++ yell
176 |= now=@d
185 |= now=@d
177 ^- tarp
186 ^- tarp
178 =+ sec=(rsh 6 1 now)
187 =+ sec=(rsh 6 1 now)
@@ -190,10 +199,11 @@ A `tarp`.
190 =+ mit=(div sec mit:yo)
199 =+ mit=(div sec mit:yo)
191 => .(sec (mod sec mit:yo))
200 => .(sec (mod sec mit:yo))
192 [day hor mit sec fan]
201 [day hor mit sec fan]
193−
202+```
194
203
195#### Examples
204#### Examples
196
205
206+```
197 > (yell ~2014.3.20..05.42.53..7456)
207 > (yell ~2014.3.20..05.42.53..7456)
198 [d=106.751.991.820.094 h=5 m=42 s=53 f=~[0x7456]]
208 [d=106.751.991.820.094 h=5 m=42 s=53 f=~[0x7456]]
199
209
@@ -202,9 +212,9 @@ A `tarp`.
202
212
203 > (yell ~1776.7.4)
213 > (yell ~1776.7.4)
204 [d=106.751.991.733.273 h=0 m=0 s=0 f=~]
214 [d=106.751.991.733.273 h=0 m=0 s=0 f=~]
215+```
205
216
206−
217+---
207−***
208### `++yelp`
218### `++yelp`
209
219
210Leap-week?
220Leap-week?
@@ -221,12 +231,15 @@ A flag.
221
231
222#### Source
232#### Source
223
233
234+```
224− ++ yelp
235+ ++ yelp
225 |= yer=@ud ^- ?
236 |= yer=@ud ^- ?
226 &(=(0 (mod yer 4)) |(!=(0 (mod yer 100)) =(0 (mod yer 400))))
237 &(=(0 (mod yer 4)) |(!=(0 (mod yer 100)) =(0 (mod yer 400))))
238+```
227
239
228#### Examples
240#### Examples
229
241
242+```
230 > (yelp 2.014)
243 > (yelp 2.014)
231 %.n
244 %.n
232
245
@@ -238,9 +251,9 @@ A flag.
238
251
239 > (yelp 14.011)
252 > (yelp 14.011)
240 %.n
253 %.n
254+```
241
255
242−
256+---
243−***
244### `++yore`
257### `++yore`
245
258
246Date from atomic date
259Date from atomic date
@@ -257,7 +270,8 @@ A `date`.
257
270
258#### Source
271#### Source
259
272
273+```
260− ++ yore
274+ ++ yore
261 |= now=@da
275 |= now=@da
262 ^- date
276 ^- date
263 =+ rip=(yell now)
277 =+ rip=(yell now)
@@ -266,15 +280,16 @@ A `date`.
266 [a=& y=(sub y.ger 292.277.024.400)]
280 [a=& y=(sub y.ger 292.277.024.400)]
267 [a=| y=+((sub 292.277.024.400 y.ger))]
281 [a=| y=+((sub 292.277.024.400 y.ger))]
268 [m.ger d.ger h.rip m.rip s.rip f.rip]
282 [m.ger d.ger h.rip m.rip s.rip f.rip]
269−
283+```
270
284
271#### Examples
285#### Examples
272
286
287+```
273 > (yore ~2014.6.6..21.09.15..0a16)
288 > (yore ~2014.6.6..21.09.15..0a16)
274 [[a=%.y y=2.014] m=6 t=[d=6 h=21 m=9 s=15 f=~[0xa16]]]
289 [[a=%.y y=2.014] m=6 t=[d=6 h=21 m=9 s=15 f=~[0xa16]]]
290+```
275
291
276−
292+---
277−***
278### `++yule`
293### `++yule`
279
294
280Daily time to time atom
295Daily time to time atom
@@ -292,6 +307,7 @@ A time atom, `@d`.
292
307
293#### Source
308#### Source
294
309
310+```
295 ++ yule :: time atom
311 ++ yule :: time atom
296 |= rip=tarp
312 |= rip=tarp
297 ^- @d
313 ^- @d
@@ -309,9 +325,11 @@ A time atom, `@d`.
309 (add (lsh 4 muc i.f.rip) $(f.rip t.f.rip))
325 (add (lsh 4 muc i.f.rip) $(f.rip t.f.rip))
310 (con (lsh 6 1 sec) fac)
326 (con (lsh 6 1 sec) fac)
311 ::
327 ::
328+```
312
329
313#### Examples
330#### Examples
314
331
332+```
315 > =murica (yell ~1776.7.4)
333 > =murica (yell ~1776.7.4)
316
334
317 > murica
335 > murica
@@ -331,9 +349,9 @@ A time atom, `@d`.
331
349
332 > `@dr`(yule `tarp`[31 12 30 0 ~])
350 > `@dr`(yule `tarp`[31 12 30 0 ~])
333 ~d31.h12.m30
351 ~d31.h12.m30
352+```
334
353
335−
354+---
336−***
337### `++yo`
355### `++yo`
338
356
339Time constants core
357Time constants core
@@ -342,9 +360,11 @@ Core whose arms contain constants for interacting with earth time.
342
360
343#### Source
361#### Source
344
362
363+```
345− ++ yo
364+ ++ yo
365+```
346
366
347−***
367+---
348### `++cet:yo`
368### `++cet:yo`
349
369
350Days in a century
370Days in a century
@@ -359,10 +379,13 @@ An atom.
359
379
360#### Source
380#### Source
361
381
382+```
362− |% ++ cet 36.524
383+ |% ++ cet 36.524
384+```
363
385
364#### Examples
386#### Examples
365
387
388+```
366 > cet:yo
389 > cet:yo
367 36.524
390 36.524
368
391
@@ -371,9 +394,9 @@ An atom.
371
394
372 > (sub (add 24 (mul 100 365)) cet:yo)
395 > (sub (add 24 (mul 100 365)) cet:yo)
373 0
396 0
397+```
374
398
375−
399+---
376−***
377### `++day:yo`
400### `++day:yo`
378
401
379Seconds in day
402Seconds in day
@@ -386,17 +409,21 @@ An atom.
386
409
387#### Source
410#### Source
388
411
412+```
389− ++ day 86.400
413+ ++ day 86.400
414+```
390
415
391#### Examples
416#### Examples
392
417
418+```
393 > day:yo
419 > day:yo
394 86.400
420 86.400
395
421
396 > (add 60 day:yo)
422 > (add 60 day:yo)
397 86.460
423 86.460
424+```
398
425
399−***
426+---
400### `++era:yo`
427### `++era:yo`
401
428
402Leap-year period
429Leap-year period
@@ -411,25 +438,29 @@ An atom.
411
438
412#### Source
439#### Source
413
440
441+```
414− ++ era 146.097
442+ ++ era 146.097
443+```
415
444
416#### Examples
445#### Examples
417
446
447+```
418 > era:yo
448 > era:yo
419 146.097
449 146.097
420
450
421 > (sub era:yo (mul 4 cet:yo))
451 > (sub era:yo (mul 4 cet:yo))
422 1
452 1
453+```
423
454
424#### Discussion
455#### Discussion
425
456
426A year is a leap-year if:
457A year is a leap-year if:
427
458
428− - it's divisible by 4;
459+- it's divisible by 4;
429− - *unless* it's divisible by 100;
460+- *unless* it's divisible by 100;
430− - *or* if it's divisible by 400.
461+- *or* if it's divisible by 400.
431
462
432−***
463+---
433### `++hor:yo`
464### `++hor:yo`
434
465
435Seconds in hour
466Seconds in hour
@@ -443,17 +474,21 @@ An atom.
443
474
444#### Source
475#### Source
445
476
477+```
446− ++ hor 3.600
478+ ++ hor 3.600
479+```
447
480
448#### Examples
481#### Examples
449
482
483+```
450 > hor:yo
484 > hor:yo
451 3.600
485 3.600
452
486
453 > (div hor:yo 60)
487 > (div hor:yo 60)
454 60
488 60
489+```
455
490
456−***
491+---
457### `++jes:yo`
492### `++jes:yo`
458
493
459Maximum 64-bit timestamp
494Maximum 64-bit timestamp
@@ -467,19 +502,22 @@ An atom.
467
502
468#### Source
503#### Source
469
504
505+```
470 ++ jes 106.751.991.084.417
506 ++ jes 106.751.991.084.417
507+```
471
508
472#### Examples
509#### Examples
473
510
511+```
474 > jes:yo
512 > jes:yo
475 106.751.991.084.417
513 106.751.991.084.417
476−
514+```
477
515
478#### Discussion
516#### Discussion
479
517
480The date is December 4, 292,277,026,596.
518The date is December 4, 292,277,026,596.
481
519
482−***
520+---
483### `++mit:yo`
521### `++mit:yo`
484
522
485Seconds in minute
523Seconds in minute
@@ -492,14 +530,18 @@ An atom.
492
530
493#### Source
531#### Source
494
532
533+```
495 ++ mit 60
534 ++ mit 60
535+```
496
536
497#### Examples
537#### Examples
498
538
539+```
499 > mit:yo
540 > mit:yo
500 60
541 60
542+```
501
543
502−***
544+---
503### `++moh:yo`
545### `++moh:yo`
504
546
505Days in month
547Days in month
@@ -514,18 +556,21 @@ A `list` of `@ud`
514
556
515#### Source
557#### Source
516
558
559+```
517 ++ moh `(list @ud)`[31 28 31 30 31 30 31 31 30 31 30 31 ~]
560 ++ moh `(list @ud)`[31 28 31 30 31 30 31 31 30 31 30 31 ~]
561+```
518
562
519#### Examples
563#### Examples
520
564
565+```
521 > moh:yo
566 > moh:yo
522 ~[31 28 31 30 31 30 31 31 30 31 30 31]
567 ~[31 28 31 30 31 30 31 31 30 31 30 31]
523
568
524 > (snag 4 moh:yo)
569 > (snag 4 moh:yo)
525 31
570 31
571+```
526
572
527−
573+---
528−***
529### `++moy:yo`
574### `++moy:yo`
530
575
531Days in months of leap-year
576Days in months of leap-year
@@ -540,17 +585,21 @@ A `list` of `@ud`.
540
585
541#### Source
586#### Source
542
587
588+```
543 ++ moy `(list @ud)`[31 29 31 30 31 30 31 31 30 31 30 31 ~]
589 ++ moy `(list @ud)`[31 29 31 30 31 30 31 31 30 31 30 31 ~]
590+```
544
591
545#### Examples
592#### Examples
546
593
594+```
547 > moy:yo
595 > moy:yo
548 ~[31 29 31 30 31 30 31 31 30 31 30 31]
596 ~[31 29 31 30 31 30 31 31 30 31 30 31]
549
597
550 > (snag 1 moy:yo)
598 > (snag 1 moy:yo)
551 29
599 29
600+```
552
601
553−***
602+---
554### `++qad:yo`
603### `++qad:yo`
555
604
556Seconds in 4 years
605Seconds in 4 years
@@ -564,14 +613,18 @@ An atom.
564
613
565#### Source
614#### Source
566
615
616+```
567− ++ qad 126.144.001
617+ ++ qad 126.144.001
618+```
568
619
569#### Examples
620#### Examples
570
621
622+```
571 > qad:yo
623 > qad:yo
572 126.144.001
624 126.144.001
625+```
573
626
574−***
627+---
575### `++yer:yo`
628### `++yer:yo`
576
629
577Seconds in year
630Seconds in year
@@ -585,12 +638,15 @@ An atom.
585
638
586#### Source
639#### Source
587
640
641+```
588− ++ yer 31.536.000
642+ ++ yer 31.536.000
643+```
589
644
590#### Examples
645#### Examples
591
646
647+```
592 > yer:yo
648 > yer:yo
593 31.536.000
649 31.536.000
650+```
594
651
595−
652+---
596−***
docs/reference/library/3d.umd+89−34
@@ -1,6 +1,9 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'24'
3+ title/'3d: SHA Hash Family'
4+ ==
5+
6+;>
4
7
5# 3d: SHA hash family
8# 3d: SHA hash family
6
9
@@ -21,13 +24,17 @@ An atom.
21
24
22#### Source
25#### Source
23
26
27+```
24− ++ shad |=(ruz=@ (shax (shax ruz)))
28+ ++ shad |=(ruz=@ (shax (shax ruz)))
29+```
25
30
26#### Examples
31#### Examples
27
32
33+```
28 > (shad 11)
34 > (shad 11)
29 \/20.519.637.820.582.103.109.435.907.615.585.653.479.776.629.591.855.451.248.\/
35 \/20.519.637.820.582.103.109.435.907.615.585.653.479.776.629.591.855.451.248.\/
30 718.295.626.625.655.417.234
36 718.295.626.625.655.417.234
37+```
31
38
32***
39***
33### `++shaf`
40### `++shaf`
@@ -44,22 +51,25 @@ first and last halves of the 256-bit salted hash `shas`.
44`ruz` is an atom.
51`ruz` is an atom.
45
52
46#### Source
53#### Source
54+
55+```
47 ++ shaf :: half sha-256
56 ++ shaf :: half sha-256
48 |= [sal=@ ruz=@]
57 |= [sal=@ ruz=@]
49 =+ haz=(shas sal ruz)
58 =+ haz=(shas sal ruz)
50 (mix (end 7 1 haz) (rsh 7 1 haz))
59 (mix (end 7 1 haz) (rsh 7 1 haz))
51− ::
60+```
52
61
53#### Examples
62#### Examples
54
63
64+```
55 > (shaf 17 8)
65 > (shaf 17 8)
56 52.667.672.807.485.289.251.324.336.639.183.409.041
66 52.667.672.807.485.289.251.324.336.639.183.409.041
57
67
58 > `@ub`(shaf 17 8)
68 > `@ub`(shaf 17 8)
59 \/0b1011.1111.1101.0110.1110.1000.0100.1110.1100.1000.0010.0100.1111.0001.0010.0010\/
69 \/0b1011.1111.1101.0110.1110.1000.0100.1110.1100.1000.0010.0100.1111.0001.0010.0010\/
60 .0100.1110.1110.0011.1100.1111.0001.1101.1101.1100.1110.1111.0100.0101.0001.0100
70 .0100.1110.1110.0011.1100.1111.0001.1101.1101.1100.1110.1111.0100.0101.0001.0100
61− \/
71+ \/
62−
72+```
63
73
64***
74***
65### `++shal`
75### `++shal`
@@ -81,7 +91,8 @@ An atom.
81
91
82#### Source
92#### Source
83
93
94+```
84− ++ shal
95+ ++ shal
85 ~/ %shal
96 ~/ %shal
86 |= [len=@ ruz=@] ^- @
97 |= [len=@ ruz=@] ^- @
87 => .(ruz (cut 3 [0 len] ruz))
98 => .(ruz (cut 3 [0 len] ruz))
@@ -192,21 +203,23 @@ An atom.
192 =+ p=(mix (dis e f) (dis (inv e) g)) :: ch
203 =+ p=(mix (dis e f) (dis (inv e) g)) :: ch
193 =+ q=:(sum h o p (wac j kbx) (wac j wox)) :: t1
204 =+ q=:(sum h o p (wac j kbx) (wac j wox)) :: t1
194 $(j +(j), a (sum q n), b a, c b, d c, e (sum d q), f e, g f, h g)
205 $(j +(j), a (sum q n), b a, c b, d c, e (sum d q), f e, g f, h g)
195− ::
206+```
196
207
197#### Examples
208#### Examples
198
209
210+```
199 > (shal 1 'hello')
211 > (shal 1 'hello')
200 \/7.956.615.373.791.575.273.027.009.123.631.914.645.972.441.264.528.176.292.399.908\/
212 \/7.956.615.373.791.575.273.027.009.123.631.914.645.972.441.264.528.176.292.399.908\/
201 .424.469.676.078.106.561.839.264.176.650.109.335.825.608.088.511.266.620.100.157.
213 .424.469.676.078.106.561.839.264.176.650.109.335.825.608.088.511.266.620.100.157.
202 847.055.280.028.606.252.747.432.021.213.474
214 847.055.280.028.606.252.747.432.021.213.474
203− \/
215+ \/
204
216
205 > (shal 1 'hello')
217 > (shal 1 'hello')
206 \/7.956.615.373.791.575.273.027.009.123.631.914.645.972.441.264.528.176.292.399.908\/
218 \/7.956.615.373.791.575.273.027.009.123.631.914.645.972.441.264.528.176.292.399.908\/
207 .424.469.676.078.106.561.839.264.176.650.109.335.825.608.088.511.266.620.100.157.
219 .424.469.676.078.106.561.839.264.176.650.109.335.825.608.088.511.266.620.100.157.
208 847.055.280.028.606.252.747.432.021.213.474
220 847.055.280.028.606.252.747.432.021.213.474
209− \/
221+ \/
222+```
210
223
211#### Discussion
224#### Discussion
212
225
@@ -233,20 +246,24 @@ An atom.
233
246
234#### Source
247#### Source
235
248
249+```
236− ++ sham
250+ ++ sham
237 |= yux=* ^- @uvH ^- @
251 |= yux=* ^- @uvH ^- @
238 ?@ yux
252 ?@ yux
239 (shaf %mash yux)
253 (shaf %mash yux)
240 (shaf %sham (jam yux))
254 (shaf %sham (jam yux))
241 ::
255 ::
256+```
242
257
243#### Examples
258#### Examples
244
259
260+```
245 > (sham [2 4])
261 > (sham [2 4])
246 0v3.71s52.4bqnp.ki2b8.9hhsp.2ufgg
262 0v3.71s52.4bqnp.ki2b8.9hhsp.2ufgg
247
263
248 > (sham "hello")
264 > (sham "hello")
249 0v1.hg8mv.t7s3f.u4f8a.q5noe.dvqvh
265 0v1.hg8mv.t7s3f.u4f8a.q5noe.dvqvh
266+```
250
267
251***
268***
252### `++shan`
269### `++shan`
@@ -265,7 +282,8 @@ An atom.
265
282
266#### Source
283#### Source
267
284
285+```
268− ++ shan
286+ ++ shan
269 |= ruz=@
287 |= ruz=@
270 =+ [few==>(fe .(a 5)) wac=|=([a=@ b=@] (cut 5 [a 1] b))]
288 =+ [few==>(fe .(a 5)) wac=|=([a=@ b=@] (cut 5 [a 1] b))]
271 =+ [sum=sum.few ror=ror.few rol=rol.few net=net.few inv=inv.few]
289 =+ [sum=sum.few ror=ror.few rol=rol.few net=net.few inv=inv.few]
@@ -330,13 +348,14 @@ An atom.
330 :(sum (rol 0 5 a) fz e (wac 2 kbx) (wac j wox))
348 :(sum (rol 0 5 a) fz e (wac 2 kbx) (wac j wox))
331 :(sum (rol 0 5 a) fy e (wac 3 kbx) (wac j wox))
349 :(sum (rol 0 5 a) fy e (wac 3 kbx) (wac j wox))
332 $(j +(j), a tem, b a, c (rol 0 30 b), d c, e d)
350 $(j +(j), a tem, b a, c (rol 0 30 b), d c, e d)
333− ::
351+```
334−
335
352
336#### Examples
353#### Examples
337
354
355+```
338 > (shan 'hello')
356 > (shan 'hello')
339 975.987.071.262.755.080.377.722.350.727.279.193.143.145.743.181
357 975.987.071.262.755.080.377.722.350.727.279.193.143.145.743.181
358+```
340
359
341#### Discussion
360#### Discussion
342
361
@@ -359,18 +378,20 @@ of that logical operation is then itself hashed with SHA-256.
359
378
360#### Source
379#### Source
361
380
381+```
362− ++ shas
382+ ++ shas
363 |= [sal=@ ruz=@]
383 |= [sal=@ ruz=@]
364 (shax (mix sal (shax ruz)))
384 (shax (mix sal (shax ruz)))
365− ::
385+```
366
386
367#### Examples
387#### Examples
368
388
389+```
369 > (shas 12.845 6)
390 > (shas 12.845 6)
370 \/111.115.941.493.032.291.043.932.789.632.248.509.108.945.255.494.251.860.287\/
391 \/111.115.941.493.032.291.043.932.789.632.248.509.108.945.255.494.251.860.287\/
371 .707.279.709.200.349.471.936
392 .707.279.709.200.349.471.936
372− \/
393+ \/
373−
394+```
374
395
375***
396***
376### `++shaw`
397### `++shaw`
@@ -394,18 +415,21 @@ An atom.
394
415
395#### Source
416#### Source
396
417
418+```
397− ++ shaw
419+ ++ shaw
398 |= [sal=@ len=@ ruz=@]
420 |= [sal=@ len=@ ruz=@]
399 (~(raw og (shas sal (mix len ruz))) len)
421 (~(raw og (shas sal (mix len ruz))) len)
400− ::
422+```
401
423
402#### Examples
424#### Examples
403
425
426+```
404 > `@ub`(shaw 3 6 98)
427 > `@ub`(shaw 3 6 98)
405 0b11.0111
428 0b11.0111
406
429
407 > `@ub`(shaw 2 6 98)
430 > `@ub`(shaw 2 6 98)
408 0b11
431 0b11
432+```
409
433
410***
434***
411### `++shax`
435### `++shax`
@@ -416,18 +440,21 @@ Produces an atom by hashing an atom `ruz` with SHA-256.
416
440
417#### Sources
441#### Sources
418
442
443+```
419− ++ shax
444+ ++ shax
420 ~/ %shax
445 ~/ %shax
421 |= ruz=@ ^- @
446 |= ruz=@ ^- @
422 (shay [(met 3 ruz) ruz])
447 (shay [(met 3 ruz) ruz])
423− ::
448+```
424
449
425#### Examples
450#### Examples
426
451
452+```
427 > (shax 'hello')
453 > (shax 'hello')
428 \/16.552.786.619.039.860.277.601.417.878.457.384.195.409.020.923.835.016.617.984.82\/
454 \/16.552.786.619.039.860.277.601.417.878.457.384.195.409.020.923.835.016.617.984.82\/
429 0.774.431.701.725.740
455 0.774.431.701.725.740
430− \/
456+ \/
457+```
431
458
432***
459***
433### `++shay`
460### `++shay`
@@ -445,7 +472,8 @@ the byte-length of the theoretical buffer represented by the atom.
445
472
446#### Source
473#### Source
447
474
475+```
448− ++ shay
476+ ++ shay
449 ~/ %shay
477 ~/ %shay
450 |= [len=@u ruz=@] ^- @
478 |= [len=@u ruz=@] ^- @
451 => .(ruz (cut 3 [0 len] ruz))
479 => .(ruz (cut 3 [0 len] ruz))
@@ -530,19 +558,21 @@ the byte-length of the theoretical buffer represented by the atom.
530 =+ p=(mix (dis e f) (dis (inv e) g)) :: ch
558 =+ p=(mix (dis e f) (dis (inv e) g)) :: ch
531 =+ q=:(sum h o p (wac j kbx) (wac j wox)) :: t1
559 =+ q=:(sum h o p (wac j kbx) (wac j wox)) :: t1
532 $(j +(j), a (sum q n), b a, c b, d c, e (sum d q), f e, g f, h g)
560 $(j +(j), a (sum q n), b a, c b, d c, e (sum d q), f e, g f, h g)
533−
561+```
534
562
535#### Examples
563#### Examples
536
564
565+```
537 > (shay 1 'hello')
566 > (shay 1 'hello')
538 \/16.144.219.278.061.159.438.339.586.294.967.166.038.336.988.797.862.808.055.174.98\/
567 \/16.144.219.278.061.159.438.339.586.294.967.166.038.336.988.797.862.808.055.174.98\/
539 7.398.597.302.069.674
568 7.398.597.302.069.674
540− \/
569+ \/
541
570
542 > (shay 2 'hello')
571 > (shay 2 'hello')
543 \/100.467.333.538.737.303.691.714.735.404.408.035.555.613.179.595.938.688.113.300.8\/
572 \/100.467.333.538.737.303.691.714.735.404.408.035.555.613.179.595.938.688.113.300.8\/
544 01.974.878.934.544.183
573 01.974.878.934.544.183
545− \/
574+ \/
575+```
546
576
547#### Discussion
577#### Discussion
548
578
@@ -567,17 +597,21 @@ An atom.
567
597
568#### Source
598#### Source
569
599
600+```
570− ++ shaz
601+ ++ shaz
571 |= ruz=@ ^- @
602 |= ruz=@ ^- @
572 (shal [(met 3 ruz) ruz])
603 (shal [(met 3 ruz) ruz])
604+```
573
605
574#### Examples
606#### Examples
575
607
608+```
576 > (shaz 'hello')
609 > (shaz 'hello')
577 \/3.548.533.422.469.437.734.729.094.584.175.910.682.076.656.883.559.953.324.378.007\/
610 \/3.548.533.422.469.437.734.729.094.584.175.910.682.076.656.883.559.953.324.378.007\/
578 .735.849.386.038.666.450.748.109.671.344.747.196.048.200.348.948.408.339.256.384.
611 .735.849.386.038.666.450.748.109.671.344.747.196.048.200.348.948.408.339.256.384.
579 360.070.359.656.053.016.948.640.159.265.179
612 360.070.359.656.053.016.948.640.159.265.179
580 \/
613 \/
614+```
581
615
582***
616***
583### `++og`
617### `++og`
@@ -594,14 +628,19 @@ atom that is used as a seed for the hash.
594A core.
628A core.
595
629
596#### Source
630#### Source
631+
632+```
597− ++ og
633+ ++ og
598 ~/ %og
634 ~/ %og
599 |_ a=@
635 |_ a=@
636+```
600
637
601#### Examples
638#### Examples
602
639
640+```
603 > ~(. og 919)
641 > ~(. og 919)
604 <4.wmp {a/@ud <54.tyv 119.olq 31.ohr 1.jmk $143>}>
642 <4.wmp {a/@ud <54.tyv 119.olq 31.ohr 1.jmk $143>}>
643+```
605
644
606#### Discussion
645#### Discussion
607
646
@@ -627,13 +666,16 @@ An atom.
627
666
628#### Source
667#### Source
629
668
669+```
630− ++ rad
670+ ++ rad
631 |= b=@ ^- @
671 |= b=@ ^- @
632 =+ c=(raw (met 0 b))
672 =+ c=(raw (met 0 b))
633 ?:((lth c b) c $(a +(a)))
673 ?:((lth c b) c $(a +(a)))
674+```
634
675
635#### Examples
676#### Examples
636
677
678+```
637 > (~(rad og 5) 11)
679 > (~(rad og 5) 11)
638 4
680 4
639
681
@@ -645,6 +687,7 @@ An atom.
645
687
646 > (~(rad og eny) 11) :: `eny` acts as a random sample
688 > (~(rad og eny) 11) :: `eny` acts as a random sample
647 7
689 7
690+```
648
691
649***
692***
650### `++rads`
693### `++rads`
@@ -665,13 +708,16 @@ A cell.
665
708
666#### Source
709#### Source
667
710
711+```
668− ++ rads
712+ ++ rads
669 |= b=@
713 |= b=@
670 =+ r=(rad b)
714 =+ r=(rad b)
671 [r +>.$(a (shas %og-s (mix a r)))]
715 [r +>.$(a (shas %og-s (mix a r)))]
716+```
672
717
673#### Examples
718#### Examples
674
719
720+```
675 > (~(rads og 4) 10)
721 > (~(rads og 4) 10)
676 [2 <4.wmp {a/@ <54.tyv 119.olq 31.ohr 1.jmk $143>}>]
722 [2 <4.wmp {a/@ <54.tyv 119.olq 31.ohr 1.jmk $143>}>]
677
723
@@ -680,6 +726,7 @@ A cell.
680 =^ b rng (rads:rng 10)
726 =^ b rng (rads:rng 10)
681 [a b]
727 [a b]
682 [2 8]
728 [2 8]
729+```
683
730
684#### Discussion
731#### Discussion
685
732
@@ -704,7 +751,8 @@ An atom.
704
751
705#### Source
752#### Source
706
753
754+```
707− ++ raw
755+ ++ raw
708 ~/ %raw
756 ~/ %raw
709 |= b=@ ^- @
757 |= b=@ ^- @
710 %+ can
758 %+ can
@@ -717,9 +765,11 @@ An atom.
717 ?: (lth b 256)
765 ?: (lth b 256)
718 [[b (end 0 b d)] ~]
766 [[b (end 0 b d)] ~]
719 [[256 d] $(c d, b (sub b 256))]
767 [[256 d] $(c d, b (sub b 256))]
768+```
720
769
721#### Examples
770#### Examples
722
771
772+```
723 > `@ud`(~(raw og 27) 4)
773 > `@ud`(~(raw og 27) 4)
724 0b1001
774 0b1001
725
775
@@ -731,6 +781,7 @@ An atom.
731
781
732 > `@ub`(~(raw og 11) 3)
782 > `@ub`(~(raw og 11) 3)
733 0b100
783 0b100
784+```
734
785
735***
786***
736### `++raws`
787### `++raws`
@@ -743,14 +794,17 @@ parent core with `(raw b)`.
743
794
744#### Source
795#### Source
745
796
797+```
746− ++ raws
798+ ++ raws
747 |= b=@
799 |= b=@
748 =+ r=(raw b)
800 =+ r=(raw b)
749 [r +>.$(a (shas %og-s r))]
801 [r +>.$(a (shas %og-s r))]
750 --
802 --
803+```
751
804
752#### Examples
805#### Examples
753
806
807+```
754 > `[@ub _og]`(~(raws og 7) 4)
808 > `[@ub _og]`(~(raws og 7) 4)
755 [0b1100 <4.wmp {a/@ <54.tyv 119.olq 31.ohr 1.jmk $143>}>]
809 [0b1100 <4.wmp {a/@ <54.tyv 119.olq 31.ohr 1.jmk $143>}>]
756
810
@@ -759,6 +813,7 @@ parent core with `(raw b)`.
759 =^ b rng (rads:rng 4)
813 =^ b rng (rads:rng 4)
760 [`@ub`a `@ub`b]
814 [`@ub`a `@ub`b]
761 [0b10 0b1]
815 [0b10 0b1]
816+```
762
817
763#### Discussion
818#### Discussion
764
819
docs/reference/library/3e.umd+6−4
@@ -1,10 +1,12 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'25'
3+ title/'3e: (Removed)'
4+ ==
4
5
6+;>
5
7
6# 3e: AES encryption
8# 3e: AES encryption
7
9
8The standard-library functions in this section have been removed.
10The standard-library functions in this section have been removed.
9
11
10−***
12+---
docs/reference/library/3f.umd+96−37
@@ -1,10 +1,13 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'26'
3+ title/'3f: Scrambling'
4+ ==
5+
6+;>
4
7
5# 3f: scrambling
8# 3f: scrambling
6
9
7−### `++un`
10+### `++un`*
8
11
9Reversible scrambling
12Reversible scrambling
10
13
@@ -13,10 +16,12 @@ Used in the `@p` phonetic base.
13
16
14#### Source
17#### Source
15
18
19+```
16− ++ un
20+ ++ un
17 |%
21 |%
22+```
18
23
19−***
24+---
20### `++wren`
25### `++wren`
21
26
22Conceal structure
27Conceal structure
@@ -35,7 +40,8 @@ An atom.
35
40
36#### Source
41#### Source
37
42
43+```
38− ++ wren
44+ ++ wren
39 |= pyn=@ ^- @
45 |= pyn=@ ^- @
40 =+ len=(met 3 pyn)
46 =+ len=(met 3 pyn)
41 ?: =(0 len)
47 ?: =(0 len)
@@ -52,10 +58,11 @@ An atom.
52 =+ mog=(zyft :(mix mig (end 3 1 len) (cut 3 [len 1] pyn)))
58 =+ mog=(zyft :(mix mig (end 3 1 len) (cut 3 [len 1] pyn)))
53 [[1 mog] $(mig mog)]
59 [[1 mog] $(mig mog)]
54 ::
60 ::
55−
61+```
56
62
57#### Examples
63#### Examples
58
64
65+```
59 > `@ux`(wren:un 'testing')
66 > `@ux`(wren:un 'testing')
60 0x30.bf6a.b9fe.7d8f
67 0x30.bf6a.b9fe.7d8f
61
68
@@ -64,8 +71,9 @@ An atom.
64
71
65 > `@da`(wred:un (wren:un ~2001.2.5))
72 > `@da`(wred:un (wren:un ~2001.2.5))
66 ~2001.2.5
73 ~2001.2.5
74+```
67
75
68−***
76+---
69### `++wred`
77### `++wred`
70
78
71Restore structure
79Restore structure
@@ -84,7 +92,8 @@ An atom.
84
92
85#### Source
93#### Source
86
94
95+```
87− ++ wred
96+ ++ wred
88 |= cry=@ ^- @
97 |= cry=@ ^- @
89 =+ len=(met 3 cry)
98 =+ len=(met 3 cry)
90 ?: =(0 len)
99 ?: =(0 len)
@@ -101,9 +110,11 @@ An atom.
101 =+ mog=(cut 3 [len 1] cry)
110 =+ mog=(cut 3 [len 1] cry)
102 [[1 :(mix mig (end 3 1 len) (zyrt mog))] $(mig mog)]
111 [[1 :(mix mig (end 3 1 len) (zyrt mog))] $(mig mog)]
103 ::
112 ::
113+```
104
114
105#### Examples
115#### Examples
106
116
117+```
107 > (wred:un 0x30.bf6a.b9fe.7d8f)
118 > (wred:un 0x30.bf6a.b9fe.7d8f)
108 29.113.321.805.538.676
119 29.113.321.805.538.676
109
120
@@ -112,8 +123,9 @@ An atom.
112
123
113 > (wred:un (wren:un 200.038.426))
124 > (wred:un (wren:un 200.038.426))
114 200.038.426
125 200.038.426
126+```
115
127
116−***
128+---
117### `++xafo`
129### `++xafo`
118
130
119Add modulo 255
131Add modulo 255
@@ -133,10 +145,13 @@ An atom.
133
145
134#### Source
146#### Source
135
147
148+```
136 ++ xafo |=([a=@ b=@] +((mod (add (dec b) a) 255)))
149 ++ xafo |=([a=@ b=@] +((mod (add (dec b) a) 255)))
150+```
137
151
138#### Examples
152#### Examples
139
153
154+```
140 > (xafo:un 5 6)
155 > (xafo:un 5 6)
141 11
156 11
142
157
@@ -145,8 +160,9 @@ An atom.
145
160
146 > (xafo:un 256 (xaro:un 256 20))
161 > (xafo:un 256 (xaro:un 256 20))
147 20
162 20
163+```
148
164
149−***
165+---
150### `++xaro`
166### `++xaro`
151
167
152Subtract modulo 255
168Subtract modulo 255
@@ -166,10 +182,13 @@ An atom.
166
182
167#### Source
183#### Source
168
184
185+```
169 ++ xaro |=([a=@ b=@] +((mod (add (dec b) (sub 255 (mod a 255))) 255)))
186 ++ xaro |=([a=@ b=@] +((mod (add (dec b) (sub 255 (mod a 255))) 255)))
187+```
170
188
171#### Examples
189#### Examples
172
190
191+```
173 > (xaro:un 17 57)
192 > (xaro:un 17 57)
174 40
193 40
175
194
@@ -178,8 +197,9 @@ An atom.
178
197
179 > (xaro:un 256 (xafo:un 256 20))
198 > (xaro:un 256 (xafo:un 256 20))
180 20
199 20
200+```
181
201
182−***
202+---
183### `++zaft`
203### `++zaft`
184
204
185Look up in 255 sub box
205Look up in 255 sub box
@@ -197,7 +217,8 @@ An atom.
197
217
198#### Source
218#### Source
199
219
220+```
200− ++ zaft
221+ ++ zaft
201 |= a=@D
222 |= a=@D
202 =+ ^= b
223 =+ ^= b
203 0xcc.75bc.86c8.2fb1.9a42.f0b3.79a0.92ca.21f6.1e41.cde5.fcc0.
224 0xcc.75bc.86c8.2fb1.9a42.f0b3.79a0.92ca.21f6.1e41.cde5.fcc0.
@@ -212,10 +233,11 @@ An atom.
212 3750.6ef1.44dd.89ef.6576.d00a.fbda.9ed2.3b6c.7b0c.bde9.2ade.
233 3750.6ef1.44dd.89ef.6576.d00a.fbda.9ed2.3b6c.7b0c.bde9.2ade.
213 5c88.c182.481a.1b0f.2bfd.d591.2726.57ba
234 5c88.c182.481a.1b0f.2bfd.d591.2726.57ba
214 (cut 3 [(dec a) 1] b)
235 (cut 3 [(dec a) 1] b)
215− ::
236+```
216
237
217#### Examples
238#### Examples
218
239
240+```
219 > (zaft:un 0x12)
241 > (zaft:un 0x12)
220 42
242 42
221
243
@@ -227,8 +249,9 @@ An atom.
227 > (zaft:un 0x0)
249 > (zaft:un 0x0)
228 ! decrement-underflow
250 ! decrement-underflow
229 ! exit
251 ! exit
252+```
230
253
231−***
254+---
232### `++zart`
255### `++zart`
233
256
234Reverse look up in 255 sub box
257Reverse look up in 255 sub box
@@ -246,6 +269,7 @@ An atom.
246
269
247#### Source
270#### Source
248
271
272+```
249 ++ zart :: reverse 255-sbox
273 ++ zart :: reverse 255-sbox
250 |= a=@D
274 |= a=@D
251 =+ ^= b
275 =+ ^= b
@@ -262,9 +286,11 @@ An atom.
262 e409.7b9f.1598.1d3f.33de.8ce3.8970.8e7a
286 e409.7b9f.1598.1d3f.33de.8ce3.8970.8e7a
263 (cut 3 [(dec a) 1] b)
287 (cut 3 [(dec a) 1] b)
264 ::
288 ::
289+```
265
290
266#### Examples
291#### Examples
267
292
293+```
268 > `@ux`(zart:un 204)
294 > `@ux`(zart:un 204)
269 0xff
295 0xff
270
296
@@ -273,8 +299,9 @@ An atom.
273
299
274 > (zaft:un 0x12)
300 > (zaft:un 0x12)
275 42
301 42
302+```
276
303
277−***
304+---
278### `++zyft`
305### `++zyft`
279
306
280Lookup byte in 256 sub box
307Lookup byte in 256 sub box
@@ -292,6 +319,7 @@ An atom.
292
319
293#### Source
320#### Source
294
321
322+```
295 ++ zyft :: forward 256-sbox
323 ++ zyft :: forward 256-sbox
296 |= a=@D
324 |= a=@D
297 =+ ^= b
325 =+ ^= b
@@ -309,9 +337,11 @@ An atom.
309 9068.1edf.8f33.b632.d427.97fa.9ee1
337 9068.1edf.8f33.b632.d427.97fa.9ee1
310 (cut 3 [a 1] b)
338 (cut 3 [a 1] b)
311 ::
339 ::
340+```
312
341
313#### Examples
342#### Examples
314
343
344+```
315 > (zyft:un 0x12)
345 > (zyft:un 0x12)
316 57
346 57
317
347
@@ -322,8 +352,9 @@ An atom.
322 187
352 187
323 > `@ux`(zyrt:un 187)
353 > `@ux`(zyrt:un 187)
324 0xff
354 0xff
355+```
325
356
326−***
357+---
327### `++zyrt`
358### `++zyrt`
328
359
329Reverse lookup byte in 256 sub box
360Reverse lookup byte in 256 sub box
@@ -341,6 +372,7 @@ An atom.
341
372
342#### Source
373#### Source
343
374
375+```
344 ++ zyrt :: reverse 256-sbox
376 ++ zyrt :: reverse 256-sbox
345 |= a=@D
377 |= a=@D
346 =+ ^= b
378 =+ ^= b
@@ -357,9 +389,11 @@ An atom.
357 1c4a.28ac.fc0b.26ca.5870.e576.f7f1.616d.905f.ef41.33bc.
389 1c4a.28ac.fc0b.26ca.5870.e576.f7f1.616d.905f.ef41.33bc.
358 df4d.225e.2d56.7fd6.1395.a3f8.c582
390 df4d.225e.2d56.7fd6.1395.a3f8.c582
359 (cut 3 [a 1] b)
391 (cut 3 [a 1] b)
392+```
360
393
361#### Examples
394#### Examples
362
395
396+```
363 > `@ux`(zyrt:un 57)
397 > `@ux`(zyrt:un 57)
364 0x12
398 0x12
365
399
@@ -370,19 +404,22 @@ An atom.
370 0xff
404 0xff
371 > (zyft:un 0xff)
405 > (zyft:un 0xff)
372 187
406 187
407+```
373
408
374−***
409+---
375### `++ob`
410### `++ob`
376
411
377Reversible scrambling, v2
412Reversible scrambling, v2
378
413
414+```
379 ++ ob
415 ++ ob
380 |%
416 |%
417+```
381
418
382A core for performing reversible scrambling operations for the `@p` phonetic
419A core for performing reversible scrambling operations for the `@p` phonetic
383base.
420base.
384
421
385−***
422+---
386### `++feen`
423### `++feen`
387
424
388Conceal structure, v2
425Conceal structure, v2
@@ -401,7 +438,8 @@ An atom.
401
438
402#### Source
439#### Source
403
440
441+```
404− ++ feen
442+ ++ feen
405 |= pyn=@ ^- @
443 |= pyn=@ ^- @
406 ?: &((gte pyn 0x1.0000) (lte pyn 0xffff.ffff))
444 ?: &((gte pyn 0x1.0000) (lte pyn 0xffff.ffff))
407 (add 0x1.0000 (fice (sub pyn 0x1.0000)))
445 (add 0x1.0000 (fice (sub pyn 0x1.0000)))
@@ -412,10 +450,11 @@ An atom.
412 (add 0x1.0000 (fice (sub lo 0x1.0000)))
450 (add 0x1.0000 (fice (sub lo 0x1.0000)))
413 pyn
451 pyn
414 ::
452 ::
415−
453+```
416
454
417#### Examples
455#### Examples
418
456
457+```
419 > `@p`(feen:ob 111.103)
458 > `@p`(feen:ob 111.103)
420 ~mophul-pagwyx
459 ~mophul-pagwyx
421
460
@@ -427,8 +466,9 @@ An atom.
427
466
428 > `@p`(feen:ob ~wex)
467 > `@p`(feen:ob ~wex)
429 ~wex
468 ~wex
469+```
430
470
431−***
471+---
432### `++fend`
472### `++fend`
433
473
434Restore structure, v2
474Restore structure, v2
@@ -448,7 +488,8 @@ An atom.
448
488
449#### Source
489#### Source
450
490
491+```
451− ++ fend
492+ ++ fend
452 |= cry=@ ^- @
493 |= cry=@ ^- @
453 ?: &((gte cry 0x1.0000) (lte cry 0xffff.ffff))
494 ?: &((gte cry 0x1.0000) (lte cry 0xffff.ffff))
454 (add 0x1.0000 (teil (sub cry 0x1.0000)))
495 (add 0x1.0000 (teil (sub cry 0x1.0000)))
@@ -459,9 +500,11 @@ An atom.
459 (add 0x1.0000 (teil (sub lo 0x1.0000)))
500 (add 0x1.0000 (teil (sub lo 0x1.0000)))
460 cry
501 cry
461 ::
502 ::
503+```
462
504
463#### Examples
505#### Examples
464
506
507+```
465 > `@p`(fend:ob 111.103)
508 > `@p`(fend:ob 111.103)
466 ~doznec-sapfes
509 ~doznec-sapfes
467
510
@@ -476,9 +519,9 @@ An atom.
476
519
477 > `@p`(fend:ob ~tarmed)
520 > `@p`(fend:ob ~tarmed)
478 ~tarmed
521 ~tarmed
522+```
479
523
480−
524+---
481−***
482### `++fice`
525### `++fice`
483
526
484Feistel-like cipher
527Feistel-like cipher
@@ -498,6 +541,7 @@ An atom.
498
541
499#### Source
542#### Source
500
543
544+```
501 ++ fice :: adapted from
545 ++ fice :: adapted from
502 |= nor=@ :: black and rogaway
546 |= nor=@ :: black and rogaway
503 ^- @ :: "ciphers with
547 ^- @ :: "ciphers with
@@ -508,17 +552,19 @@ An atom.
508 [(mod nor 65.535) (div nor 65.535)]
552 [(mod nor 65.535) (div nor 65.535)]
509 (add (mul 65.535 -.sel) +.sel)
553 (add (mul 65.535 -.sel) +.sel)
510 ::
554 ::
511−
555+```
512
556
513#### Examples
557#### Examples
514
558
559+```
515 > (fice:ob 11)
560 > (fice:ob 11)
516 776.343.932
561 776.343.932
517
562
518 > (fice:ob (teil:ob 11))
563 > (fice:ob (teil:ob 11))
519 11
564 11
565+```
520
566
521−***
567+---
522### `++teil`
568### `++teil`
523
569
524Reverse Feistel-like cipher
570Reverse Feistel-like cipher
@@ -538,6 +584,7 @@ An atom.
538
584
539#### Source
585#### Source
540
586
587+```
541 ++ teil :: reverse ++fice
588 ++ teil :: reverse ++fice
542 |= vip=@
589 |= vip=@
543 ^- @
590 ^- @
@@ -548,19 +595,20 @@ An atom.
548 [(mod vip 65.535) (div vip 65.535)]
595 [(mod vip 65.535) (div vip 65.535)]
549 (add (mul 65.535 -.sel) +.sel)
596 (add (mul 65.535 -.sel) +.sel)
550 ::
597 ::
551−
598+```
552
599
553
600
554#### Examples
601#### Examples
555
602
603+```
556 > (teil:ob 11)
604 > (teil:ob 11)
557 514.230.493
605 514.230.493
558
606
559 > (teil:ob (fice:ob 11))
607 > (teil:ob (fice:ob 11))
560 11
608 11
609+```
561
610
562−
611+---
563−***
564### `++rynd`
612### `++rynd`
565
613
566Reverse Feistel-like cipher
614Reverse Feistel-like cipher
@@ -582,24 +630,27 @@ A cell of two atoms.
582
630
583#### Source
631#### Source
584
632
633+```
585− ++ rynd
634+ ++ rynd
586 |= [n=@ l=@ r=@]
635 |= [n=@ l=@ r=@]
587 ^- [@ @]
636 ^- [@ @]
588 :- r
637 :- r
589 ?~ (mod n 2)
638 ?~ (mod n 2)
590 (~(sum fo 65.535) l (en:aesc (snag n raku) r))
639 (~(sum fo 65.535) l (en:aesc (snag n raku) r))
591 (~(sum fo 65.536) l (en:aesc (snag n raku) r))
640 (~(sum fo 65.536) l (en:aesc (snag n raku) r))
641+```
592
642
593#### Examples
643#### Examples
594
644
645+```
595 > (rynd:ob 2 261 9)
646 > (rynd:ob 2 261 9)
596 [9 37.422]
647 [9 37.422]
597
648
598 > (rynd:ob 2 (rund:ob 2 37.422 9))
649 > (rynd:ob 2 (rund:ob 2 37.422 9))
599 [261 32.902]
650 [261 32.902]
651+```
600
652
601−
653+---
602−***
603### `++rund`
654### `++rund`
604
655
605Reverse single Feistel-like
656Reverse single Feistel-like
@@ -621,23 +672,27 @@ A cell of two atoms.
621
672
622#### Source
673#### Source
623
674
675+```
624− ++ rund
676+ ++ rund
625 |= [n=@ l=@ r=@]
677 |= [n=@ l=@ r=@]
626 ^- [@ @]
678 ^- [@ @]
627 :- r
679 :- r
628 ?~ (mod n 2)
680 ?~ (mod n 2)
629 (~(dif fo 65.535) l (muk (snag n raku) 2 r))
681 (~(dif fo 65.535) l (muk (snag n raku) 2 r))
630 (~(dif fo 65.536) l (muk (snag n raku) 2 r))
682 (~(dif fo 65.536) l (muk (snag n raku) 2 r))
683+```
631
684
632#### Examples
685#### Examples
633
686
687+```
634 > (rund:ob 2 261 9)
688 > (rund:ob 2 261 9)
635 [9 28.635]
689 [9 28.635]
636
690
637 > (rund:ob 2 (rynd:ob 2 28.635 9))
691 > (rund:ob 2 (rynd:ob 2 28.635 9))
638 [261 32.651]
692 [261 32.651]
693+```
639
694
640−***
695+---
641### `++raku`
696### `++raku`
642
697
643Key list
698Key list
@@ -650,6 +705,7 @@ A list of atoms of aura `@ux` (hexadecimal).
650
705
651#### Source
706#### Source
652
707
708+```
653 ++ raku
709 ++ raku
654 ^- (list @ux)
710 ^- (list @ux)
655 :~ 0xb76d.5eed
711 :~ 0xb76d.5eed
@@ -658,10 +714,13 @@ A list of atoms of aura `@ux` (hexadecimal).
658 0x4b38.7af7
714 0x4b38.7af7
659 ==
715 ==
660 --
716 --
717+```
661
718
662#### Examples
719#### Examples
663
720
721+```
664 > raku:ob
722 > raku:ob
665 ~[0xb76d.5eed 0xee28.1300 0x85bc.ae01 0x4b38.7af7]
723 ~[0xb76d.5eed 0xee28.1300 0x85bc.ae01 0x4b38.7af7]
724+```
666
725
667−***
726+---
docs/reference/library/3g.umd+91−53
@@ -1,9 +1,12 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'27'
3+ title/'3g: Molds and Mold-Builders'
4+ ==
4
5
6+;>
5
7
6# 3g: molds and mold builders
8# 3g: molds and mold builders
9+
7### `++coin`
10### `++coin`
8
11
9
12
@@ -14,14 +17,17 @@ and printed using `++so` and `++co` cores.
14
17
15#### Source
18#### Source
16
19
20+```
17− ++ coin $% [$$ p=dime]
21+ ++ coin $% [$$ p=dime]
18− [$blob p=*]
22+ [$blob p=*]
19− [$many p=(list coin)]
23+ [$many p=(list coin)]
20− ==
24+ ==
25+```
21
26
22−***
27+---
23#### Examples
28#### Examples
24
29
30+```
25 > `coin`(need (slay '~s1'))
31 > `coin`(need (slay '~s1'))
26 [%$ p=[p=~.dr q=18.446.744.073.709.551.616]]
32 [%$ p=[p=~.dr q=18.446.744.073.709.551.616]]
27
33
@@ -41,10 +47,10 @@ and printed using `++so` and `++co` cores.
41
47
42 > ~02cd1
48 > ~02cd1
43 [3 4]
49 [3 4]
50+```
44
51
45
52
46−
53+---
47−***
48### `++dime`
54### `++dime`
49
55
50Aura-atom pair
56Aura-atom pair
@@ -56,14 +62,18 @@ to parse atoms of specific auras.
56
62
57#### Source
63#### Source
58
64
65+```
59 ++ dime [p=@ta q=@]
66 ++ dime [p=@ta q=@]
67+```
60
68
61#### Examples
69#### Examples
62
70
71+```
63 > +>:(slay '0x123')
72 > +>:(slay '0x123')
64 p=[p=~.ux q=291]
73 p=[p=~.ux q=291]
74+```
65
75
66−***
76+---
67### `++edge`
77### `++edge`
68
78
69Parsing location metadata
79Parsing location metadata
@@ -72,24 +82,26 @@ Optional result `p` and parsing continuation `q`.
72
82
73#### Source
83#### Source
74
84
85+```
75− ++ hair [p=@ud q=@ud]
86+ ++ hair [p=@ud q=@ud]
76−
87+```
77
88
78#### Examples
89#### Examples
79
90
80−
91+```
81 > *edge
92 > *edge
82 [p=[p=0 q=0] q=~]
93 [p=[p=0 q=0] q=~]
83
94
84 > (tall:vast [1 1] "a b")
95 > (tall:vast [1 1] "a b")
85 [p=[p=1 q=3] q=[~ u=[p=[%wing p=~[%a]] q=[p=[p=1 q=2] q=" b"]]]]
96 [p=[p=1 q=3] q=[~ u=[p=[%wing p=~[%a]] q=[p=[p=1 q=2] q=" b"]]]]
97+```
86
98
87#### Discussion
99#### Discussion
88
100
89See also: [Section 2e](../2e.md), `++rule`
101See also: [Section 2e](../2e.md), `++rule`
90
102
91
103
92−***
104+---
93### `++hair`
105### `++hair`
94
106
95Parsing line and column
107Parsing line and column
@@ -98,11 +110,13 @@ A pair of two `@ud` used in parsing indicating line and column number.
98
110
99#### Source
111#### Source
100
112
113+```
101− ++ hair [p=@ud q=@ud]
114+ ++ hair [p=@ud q=@ud]
102−
115+```
103
116
104#### Examples
117#### Examples
105
118
119+```
106 > *hair
120 > *hair
107 [p=0 q=0]
121 [p=0 q=0]
108
122
@@ -114,9 +128,9 @@ A pair of two `@ud` used in parsing indicating line and column number.
114
128
115 > `hair`p:((plus ace) [1 1] " --")
129 > `hair`p:((plus ace) [1 1] " --")
116 [p=1 q=4]
130 [p=1 q=4]
131+```
117
132
118−
133+---
119−***
120### `++like`
134### `++like`
121
135
122Generic edge
136Generic edge
@@ -125,16 +139,18 @@ Generates an `++edge` with a parsed result set to a specific type.
125
139
126#### Source
140#### Source
127
141
142+```
128− ++ like |* a=gate
143+ ++ like |* a=gate
129− |= b=_`*`[(hair) ~]
144+ |= b=_`*`[(hair) ~]
130− :- p=(hair -.b)
145+ :- p=(hair -.b)
131− ^= q
146+ ^= q
132− :- ~
147+ :- ~
133 u=[p=(a +>-.b) q=[p=(hair -.b) q=(tape +.b)]]
148 u=[p=(a +>-.b) q=[p=(hair -.b) q=(tape +.b)]]
134−
149+```
135
150
136#### Examples
151#### Examples
137
152
153+```
138 > *(like char)
154 > *(like char)
139 [p=[p=0 q=0] q=~]
155 [p=[p=0 q=0] q=~]
140
156
@@ -146,9 +162,9 @@ Generates an `++edge` with a parsed result set to a specific type.
146
162
147 > `(like ,@)`(ace [1 1] " a")
163 > `(like ,@)`(ace [1 1] " a")
148 [p=[p=1 q=2] q=[~ u=[p=32 q=[p=[p=1 q=2] q="a"]]]]
164 [p=[p=1 q=2] q=[~ u=[p=32 q=[p=[p=1 q=2] q="a"]]]]
165+```
149
166
150−
167+---
151−***
152### `++nail`
168### `++nail`
153
169
154Location, remainder of parsed text
170Location, remainder of parsed text
@@ -157,15 +173,18 @@ Indicates parsing position `p`, and remaining text to be parsed `q`.
157
173
158#### Source
174#### Source
159
175
176+```
160− ++ nail [p=hair q=tape]
177+ ++ nail [p=hair q=tape]
161−
178+```
162
179
163#### Examples
180#### Examples
164
181
182+```
165 > +<:;~(plug cab cab)
183 > +<:;~(plug cab cab)
166 c=[p=[p=0 q=0] q=""]
184 c=[p=[p=0 q=0] q=""]
185+```
167
186
168−***
187+---
169### `++path`
188### `++path`
170
189
171Filesystem path
190Filesystem path
@@ -174,19 +193,22 @@ A list of `++knot`s. `++knot` is another name for `@ta`.
174
193
175#### Source
194#### Source
176
195
196+```
177− ++ path (list knot)
197+ ++ path (list knot)
178−
198+```
179
199
180#### Examples
200#### Examples
181
201
202+```
182 > `path`"abc"
203 > `path`"abc"
183 /a/b/c
204 /a/b/c
205+```
184
206
185#### Discussion
207#### Discussion
186
208
187Used in `%clay` and `%eyre` extensively.
209Used in `%clay` and `%eyre` extensively.
188
210
189−***
211+---
190### `++pint`
212### `++pint`
191
213
192Parsing range
214Parsing range
@@ -196,20 +218,22 @@ stack traces.
196
218
197#### Source
219#### Source
198
220
221+```
199− ++ pint [p=[p=@ q=@] q=[p=@ q=@]]
222+ ++ pint [p=[p=@ q=@] q=[p=@ q=@]]
200−
223+```
201
224
202#### Examples
225#### Examples
203
226
227+```
204 > !:(!!) :: !! always produces a crash
228 > !:(!!) :: !! always produces a crash
205 /~zod/home/~2014.9.20..01.22.04..52e3/:<[1 4].[1 6]>
229 /~zod/home/~2014.9.20..01.22.04..52e3/:<[1 4].[1 6]>
206
230
207 > `pint`[[1 4] [1 6]]
231 > `pint`[[1 4] [1 6]]
208 [p=[p=1 q=4] q=[p=1 q=6]]
232 [p=[p=1 q=4] q=[p=1 q=6]]
233+```
209
234
210
235
211−
236+---
212−***
213### `++rule`
237### `++rule`
214
238
215Parsing rule
239Parsing rule
@@ -219,16 +243,18 @@ An empty parsing rule, but used to check that parsing rules match this with `_`.
219
243
220#### Source
244#### Source
221
245
246+```
222− ++ rule _|=(nail *edge)
247+ ++ rule _|=(nail *edge)
223−
248+```
224
249
225#### Examples
250#### Examples
226
251
252+```
227 > ([|=(a=nail [p.a ~ u=['a' a]])]:|6 [1 1] "hi")
253 > ([|=(a=nail [p.a ~ u=['a' a]])]:|6 [1 1] "hi")
228 [[p=1 q=1] ~ u=['a' p=[p=1 q=1] q="hi"]]
254 [[p=1 q=1] ~ u=['a' p=[p=1 q=1] q="hi"]]
255+```
229
256
230−
257+---
231−***
232### `++spot`
258### `++spot`
233
259
234Stack trace line
260Stack trace line
@@ -237,16 +263,19 @@ The stack trace that is printed after crashing.
237
263
238#### Source
264#### Source
239
265
266+```
240− ++ spot [p=path q=pint]
267+ ++ spot [p=path q=pint]
268+```
241
269
242#### Examples
270#### Examples
243
271
272+```
244 > !: !! :: !! always produces a crash
273 > !: !! :: !! always produces a crash
245 /~zod/home/~2018.8.8..21.42.40..7852:<[1 5].[1 7]>
274 /~zod/home/~2018.8.8..21.42.40..7852:<[1 5].[1 7]>
246 ! exit
275 ! exit
276+```
247
277
248−
278+---
249−***
250### `++tone`
279### `++tone`
251
280
252Nock result, error report
281Nock result, error report
@@ -257,13 +286,16 @@ or failure with an error report (`%2`).
257
286
258#### Source
287#### Source
259
288
289+```
260 ++ tone $% [$0 p=*] :: success
290 ++ tone $% [$0 p=*] :: success
261 [$1 p=(list)] :: blocks
291 [$1 p=(list)] :: blocks
262 [$2 p=(list [@ta *])] :: error report
292 [$2 p=(list [@ta *])] :: error report
263− ==
293+ ==
294+```
264
295
265#### Examples
296#### Examples
266
297
298+```
267 > (mink [[20 21] 0 3] $~)
299 > (mink [[20 21] 0 3] $~)
268 [%0 p=21]
300 [%0 p=21]
269
301
@@ -289,9 +321,9 @@ or failure with an error report (`%2`).
289 ]
321 ]
290 ]
322 ]
291 ]
323 ]
324+```
292
325
293−
326+---
294−***
295### `++toon`
327### `++toon`
296
328
297Nock result, stack trace
329Nock result, stack trace
@@ -302,22 +334,24 @@ or failure with a stack trace (`%2`).
302
334
303#### Source
335#### Source
304
336
337+```
305 ++ toon $% [$0 p=*] :: success
338 ++ toon $% [$0 p=*] :: success
306 [$1 p=(list)] :: blocks
339 [$1 p=(list)] :: blocks
307 [$2 p=(list tank)] :: stack trace
340 [$2 p=(list tank)] :: stack trace
308− ==
341+ ==
309−
342+```
310
343
311#### Examples
344#### Examples
312
345
346+```
313 > (mock [[20 21] 0 3] $~)
347 > (mock [[20 21] 0 3] $~)
314 [%0 p=21]
348 [%0 p=21]
315
349
316 > (mock [[1 2] !=(!:(+(.)))] ,~)
350 > (mock [[1 2] !=(!:(+(.)))] ,~)
317 [%2 p=~[[%leaf p="/~zod/try/~2014.9.23..18.34.32..d3c5/:<[1 20].[1 24]>"]]]
351 [%2 p=~[[%leaf p="/~zod/try/~2014.9.23..18.34.32..d3c5/:<[1 20].[1 24]>"]]]
352+```
318
353
319−
354+---
320−***
321### `++wonk`
355### `++wonk`
322
356
323Product from edge
357Product from edge
@@ -326,10 +360,13 @@ Pull result out of a `++edge`, or crash if there's no result.
326
360
327#### Source
361#### Source
328
362
363+```
329− ++ wonk |*(veq=edge ?~(q.veq !! p.u.q.veq))
364+ ++ wonk |*(veq=edge ?~(q.veq !! p.u.q.veq))
365+```
330
366
331#### Examples
367#### Examples
332
368
369+```
333 > (wide:vast [1 1] "(add 2 2)")
370 > (wide:vast [1 1] "(add 2 2)")
334 [ p=[p=1 q=10]
371 [ p=[p=1 q=10]
335 q
372 q
@@ -343,9 +380,10 @@ Pull result out of a `++edge`, or crash if there's no result.
343
380
344 > (wonk (wide:vast [1 1] "(add 2 2)"))
381 > (wonk (wide:vast [1 1] "(add 2 2)"))
345 [%cnhp p=[%wing p=~[%add]] q=~[[%sand p=%ud q=2] [%sand p=%ud q=2]]]
382 [%cnhp p=[%wing p=~[%add]] q=~[[%sand p=%ud q=2] [%sand p=%ud q=2]]]
383+```
346
384
347#### Discussion
385#### Discussion
348
386
349See also: `++edge`
387See also: `++edge`
350
388
351−***
389+---
docs/reference/library/4a.umd+36−13
@@ -1,9 +1,14 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'28'
3+ title/'4a: Exotic Bases'
4+ ==
5+
6+;>
7+
4
8
5
9
6# 4a: exotic bases
10# 4a: exotic bases
11+
7### `++po`
12### `++po`
8
13
9Phonetic base
14Phonetic base
@@ -14,6 +19,7 @@ contained arms.
14
19
15#### Source
20#### Source
16
21
22+```
17 ~/ %po
23 ~/ %po
18 =+ :- ^= sis :: prefix syllables
24 =+ :- ^= sis :: prefix syllables
19 'dozmarbinwansamlitsighidfidlissogdirwacsabwissib\
25 'dozmarbinwansamlitsighidfidlissogdirwacsabwissib\
@@ -50,9 +56,9 @@ contained arms.
50 /remlysfynwerrycsugnysnyllyndyndemluxfedsedbecmun\
56 /remlysfynwerrycsugnysnyllyndyndemluxfedsedbecmun\
51 /lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes'
57 /lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes'
52 |%
58 |%
59+```
53
60
54−
61+---
55−***
56### `++ind`
62### `++ind`
57
63
58Parse suffix
64Parse suffix
@@ -69,13 +75,17 @@ A `unit`.
69
75
70#### Source
76#### Source
71
77
78+```
72− ++ ind ~/ %ind
79+ ++ ind ~/ %ind
73 |= a=@tas
80 |= a=@tas
74 =+ b=0
81 =+ b=0
75 |- ^- (unit @)
82 |- ^- (unit @)
76 ?:(=(256 b) ~ ?:(=(a (tod b)) [~ b] $(b +(b))))
83 ?:(=(256 b) ~ ?:(=(a (tod b)) [~ b] $(b +(b))))
84+```
85+
77#### Examples
86#### Examples
78
87
88+```
79 > (ind:po 'zod')
89 > (ind:po 'zod')
80 [~ u=0]
90 [~ u=0]
81
91
@@ -84,8 +94,9 @@ A `unit`.
84
94
85 > (ind:po 'del')
95 > (ind:po 'del')
86 [~ u=37]
96 [~ u=37]
97+```
87
98
88−***
99+---
89### `++ins`
100### `++ins`
90
101
91Parse prefix
102Parse prefix
@@ -102,14 +113,17 @@ A `unit` of an atom.
102
113
103#### Source
114#### Source
104
115
116+```
105− ++ ins ~/ %ins
117+ ++ ins ~/ %ins
106 |= a=@tas
118 |= a=@tas
107 =+ b=0
119 =+ b=0
108 |- ^- (unit @)
120 |- ^- (unit @)
109 ?:(=(256 b) ~ ?:(=(a (tos b)) [~ b] $(b +(b))))
121 ?:(=(256 b) ~ ?:(=(a (tos b)) [~ b] $(b +(b))))
122+```
110
123
111#### Examples
124#### Examples
112
125
126+```
113 > (ins:po 'mar')
127 > (ins:po 'mar')
114 [~ u=1]
128 [~ u=1]
115
129
@@ -121,8 +135,9 @@ A `unit` of an atom.
121
135
122 > (ins:po 'pok')
136 > (ins:po 'pok')
123 ~
137 ~
138+```
124
139
125−***
140+---
126### `++tod`
141### `++tod`
127
142
128Fetch suffix
143Fetch suffix
@@ -139,11 +154,14 @@ An atom.
139
154
140#### Source
155#### Source
141
156
157+```
142− ++ tod ~/ %tod
158+ ++ tod ~/ %tod
143 |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] dex)))
159 |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] dex)))
160+```
144
161
145#### Examples
162#### Examples
146
163
164+```
147 > `@t`(tod:po 1)
165 > `@t`(tod:po 1)
148 'nec'
166 'nec'
149
167
@@ -161,8 +179,9 @@ An atom.
161
179
162 > `@t`(tod:po 256)
180 > `@t`(tod:po 256)
163 ! exit
181 ! exit
182+```
164
183
165−***
184+---
166### `++tos`
185### `++tos`
167
186
168Fetch prefix
187Fetch prefix
@@ -179,11 +198,14 @@ An atom.
179
198
180#### Source
199#### Source
181
200
201+```
182− ++ tos ~/ %tos
202+ ++ tos ~/ %tos
183 |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] sis)))
203 |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] sis)))
204+```
184
205
185#### Examples
206#### Examples
186
207
208+```
187 > `@t`(tos:po 0)
209 > `@t`(tos:po 0)
188 'doz'
210 'doz'
189
211
@@ -195,5 +217,6 @@ An atom.
195
217
196 > `@t`(tos:po 253)
218 > `@t`(tos:po 253)
197 'mat'
219 'mat'
220+```
198
221
199−***
222+---
docs/reference/library/4b.umd+247−229
@@ -1,18 +1,26 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'29'
3+ title/'4b: Text Processing'
4+ ==
4
5
6+;>
5
7
6# 4b: text processing
8# 4b: text processing
9+
7### `++at`
10### `++at`
8
11
12+```
9 ++ at
13 ++ at
10− |_ a/@
14+ |_ a=@
15+```
11
16
12XX document
17XX document
13
18
19+
20+
14### `++r`
21### `++r`
15
22
23+```
16 ++ r
24 ++ r
17 ?: ?& (gte (met 3 a) 2)
25 ?: ?& (gte (met 3 a) 2)
18 |-
26 |-
@@ -27,55 +35,71 @@ XX document
27 ?: (lte (met 3 a) 2)
35 ?: (lte (met 3 a) 2)
28 rud
36 rud
29 rux
37 rux
30− ::
38+```
39+
31
40
32XX document
41XX document
33
42
34### `++rf`
43### `++rf`
35
44
45+```
36 ++ rf `tape`[?-(a $& '&', $| '|', * !!) ~]
46 ++ rf `tape`[?-(a $& '&', $| '|', * !!) ~]
47+```
37
48
38
49
39XX document
50XX document
40
51
41### `++rn`
52### `++rn`
42
53
54+```
43 ++ rn `tape`[?>(=(0 a) '~') ~]
55 ++ rn `tape`[?>(=(0 a) '~') ~]
56+```
44
57
45XX document
58XX document
46
59
47### `++rt`
60### `++rt`
48
61
62+```
49 ++ rt `tape`['\'' (weld (mesc (trip a)) `tape`['\'' ~])]
63 ++ rt `tape`['\'' (weld (mesc (trip a)) `tape`['\'' ~])]
64+```
50
65
51XX document
66XX document
52
67
53### `++rta`
68### `++rta`
54
69
70+```
55 ++ rta rt
71 ++ rta rt
72+```
56
73
57XX document
74XX document
58
75
59### `++rtam`
76### `++rtam`
60
77
78+```
61 ++ rtam `tape`['%' (trip a)]
79 ++ rtam `tape`['%' (trip a)]
80+```
62
81
63XX document
82XX document
64
83
65### `++rub`
84### `++rub`
66
85
86+```
67 ++ rub `tape`['0' 'b' (rum 2 ~ |=(b/@ (add '0' b)))]
87 ++ rub `tape`['0' 'b' (rum 2 ~ |=(b/@ (add '0' b)))]
88+```
68
89
69XX document
90XX document
70
91
71### `++rud`
92### `++rud`
72
93
94+```
73 ++ rud (rum 10 ~ |=(b/@ (add '0' b)))
95 ++ rud (rum 10 ~ |=(b/@ (add '0' b)))
96+```
74
97
75XX document
98XX document
76
99
77### `++rum`
100### `++rum`
78
101
102+```
79 ++ rum
103 ++ rum
80 |= {b/@ c/tape d/$-(@ @)}
104 |= {b/@ c/tape d/$-(@ @)}
81 ^- tape
105 ^- tape
@@ -92,12 +116,13 @@ XX document
92 e +(e)
116 e +(e)
93 ==
117 ==
94 ::
118 ::
95−
119+```
96
120
97XX document
121XX document
98
122
99### `++rup`
123### `++rup`
100
124
125+```
101 ++ rup
126 ++ rup
102 =+ b=(met 3 a)
127 =+ b=(met 3 a)
103 ^- tape
128 ^- tape
@@ -120,11 +145,13 @@ XX document
120 =+ d=(end 3 2 a)
145 =+ d=(end 3 2 a)
121 (weld ^$(a c, b (met 3 c)) `tape`['-' $(a (mix c d), b 2)])
146 (weld ^$(a c, b (met 3 c)) `tape`['-' $(a (mix c d), b 2)])
122 ::
147 ::
148+```
123
149
124XX document
150XX document
125
151
126### `++ruv`
152### `++ruv`
127
153
154+```
128 ++ ruv
155 ++ ruv
129 ^- tape
156 ^- tape
130 :+ '0'
157 :+ '0'
@@ -139,21 +166,24 @@ XX document
139 '-'
166 '-'
140 ?:((lth b 26) (add 65 b) ?:((lth b 52) (add 71 b) (sub b 4)))
167 ?:((lth b 26) (add 65 b) ?:((lth b 52) (add 71 b) (sub b 4)))
141 ::
168 ::
169+```
142
170
143XX document
171XX document
144
172
145### `++rux`
173### `++rux`
146
174
175+```
147 ++ rux `tape`['0' 'x' (rum 16 ~ |=(b/@ (add b ?:((lth b 10) 48 87))))]
176 ++ rux `tape`['0' 'x' (rum 16 ~ |=(b/@ (add b ?:((lth b 10) 48 87))))]
148 --
177 --
149 :::::::::::::::::::::::::::::::::::::::::::::::::::::: ::
178 :::::::::::::::::::::::::::::::::::::::::::::::::::::: ::
179+```
150
180
151XX document
181XX document
152
182
153−------------------------------------------------------------------------
183+---
154
184
155
185
156−***
186+---
157
187
158### `++cass`
188### `++cass`
159
189
@@ -161,71 +191,74 @@ To lowercase
161
191
162Produce the case insensitive (all lowercase) [`++cord`]() of a [`++tape`]().
192Produce the case insensitive (all lowercase) [`++cord`]() of a [`++tape`]().
163
193
164−Accepts
194+#### Accepts
165−-------
166
195
167`vib` is a `++tape`.
196`vib` is a `++tape`.
168
197
169−Produces
198+#### Produces
170−--------
171
199
172A `++cord`.
200A `++cord`.
173
201
174−Source
202+#### Source
175−------
176
203
204+```
177 ++ cass :: lowercase
205 ++ cass :: lowercase
178 |= vib/tape
206 |= vib/tape
179 %+ rap 3
207 %+ rap 3
180 (turn vib |=(a/@ ?.(&((gte a 'A') (lte a 'Z')) a (add 32 a))))
208 (turn vib |=(a/@ ?.(&((gte a 'A') (lte a 'Z')) a (add 32 a))))
209+```
181
210
182−Examples
211+#### Examples
183−--------
184
212
213+```
185 > (cass "john doe")
214 > (cass "john doe")
186 7.309.170.810.699.673.450
215 7.309.170.810.699.673.450
216+
187 > `cord`(cass "john doe")
217 > `cord`(cass "john doe")
188 'john doe'
218 'john doe'
219+
189 > (cass "abc, 123, !@#")
220 > (cass "abc, 123, !@#")
190 2.792.832.775.110.938.439.066.079.945.313
221 2.792.832.775.110.938.439.066.079.945.313
191− > `cord`(cass "abc, 123, !@#")
192− 'abc, 123, !@#'
193
222
223+ > `cord`(cass "abc, 123, !@#")
224+ 'abc, 123, !@#'
225+```
194
226
195−***
227+---
196### `++crip`
228### `++crip`
197
229
198Tape to cord
230Tape to cord
199
231
200Produce a `++cord` from a `++tape`.
232Produce a `++cord` from a `++tape`.
201
233
202−Accepts
234+#### Accepts
203−-------
204
235
205`a` is a `++tape`.
236`a` is a `++tape`.
206
237
207−Produces
238+#### Produces
208−--------
209
239
210A `++cord`.
240A `++cord`.
211
241
212−Source
242+#### Source
213−------
214
243
244+```
215 ++ crip |=(a=tape `@t`(rap 3 a)) :: tape to cord
245 ++ crip |=(a=tape `@t`(rap 3 a)) :: tape to cord
246+```
216
247
217−Examples
248+#### Examples
218−--------
219
249
250+```
220 > (crip "john doe")
251 > (crip "john doe")
221 'john doe'
252 'john doe'
253+
222 > (crip "abc 123 !@#")
254 > (crip "abc 123 !@#")
223 'abc 123 !@#'
255 'abc 123 !@#'
256+
224 > `@ud`(crip "abc")
257 > `@ud`(crip "abc")
225 6.513.249
258 6.513.249
259+```
226
260
227−
261+---
228−***
229### `++cuss`
262### `++cuss`
230
263
231To uppercase
264To uppercase
@@ -233,59 +266,58 @@ To uppercase
233Turn all occurances of lowercase letters in any `++tape` into uppercase
266Turn all occurances of lowercase letters in any `++tape` into uppercase
234letters, as a `++cord`.
267letters, as a `++cord`.
235
268
236−Accepts
269+#### Accepts
237−-------
238
270
239`vib` is a `++tape`.
271`vib` is a `++tape`.
240
272
241−Produces
273+#### Produces
242−--------
243
274
244A `++cord`.
275A `++cord`.
245
276
246−Source
277+#### Source
247−------
248
278
279+```
249 ++ cuss :: uppercase
280 ++ cuss :: uppercase
250 |= vib=tape
281 |= vib=tape
251 ^- @t
282 ^- @t
252 %+ rap 3
283 %+ rap 3
253 (turn vib |=(a=@ ?.(&((gte a 'a') (lte a 'z')) a (sub a 32))))
284 (turn vib |=(a=@ ?.(&((gte a 'a') (lte a 'z')) a (sub a 32))))
254− ::
285+```
255
286
256−Examples
287+#### Examples
257−--------
258
288
289+```
259 > (cuss "john doe")
290 > (cuss "john doe")
260 'JOHN DOE'
291 'JOHN DOE'
292+
261 > (cuss "abc ABC 123 !@#")
293 > (cuss "abc ABC 123 !@#")
262 'ABC ABC 123 !@#'
294 'ABC ABC 123 !@#'
295+
263 > `@ud`(cuss "abc")
296 > `@ud`(cuss "abc")
264 4.407.873
297 4.407.873
298+
265 > (cuss "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsQqRrVvWwXxYyZz")
299 > (cuss "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsQqRrVvWwXxYyZz")
266 'AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSQQRRVVWWXXYYZZ'
300 'AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSQQRRVVWWXXYYZZ'
301+```
267
302
268−
303+---
269−***
270### `++mesc`
304### `++mesc`
271
305
272Escape special chars
306Escape special chars
273
307
274Escape special characters, used in `++show`.
308Escape special characters, used in `++show`.
275
309
276−Accepts
310+#### Accepts
277−-------
278
311
279`vib` is a `++tape`.
312`vib` is a `++tape`.
280
313
281−Produces
314+#### Produces
282−--------
283
315
284A `++tape`.
316A `++tape`.
285
317
286−Source
318+#### Source
287−------
288
319
320+```
289 ++ mesc :: ctrl code escape
321 ++ mesc :: ctrl code escape
290 |= vib/tape
322 |= vib/tape
291 ^- tape
323 ^- tape
@@ -296,42 +328,40 @@ Source
296 ?: ?|((gth i.vib 126) (lth i.vib 32) =(`@`39 i.vib))
328 ?: ?|((gth i.vib 126) (lth i.vib 32) =(`@`39 i.vib))
297 ['\\' (welp ~(rux at i.vib) '/' $(vib t.vib))]
329 ['\\' (welp ~(rux at i.vib) '/' $(vib t.vib))]
298 [i.vib $(vib t.vib)]
330 [i.vib $(vib t.vib)]
299− ::
331+```
300
332
301−Examples
333+#### Examples
302−--------
303
334
335+```
304− /> (mesc "ham lus")
336+ > (mesc "ham lus")
305 "ham lus"
337 "ham lus"
306− /> (mesc "bas\\hur")
338+ > (mesc "bas\\hur")
307 "bas\\\\hur"
339 "bas\\\\hur"
308− /> (mesc "as'saß")
340+ > (mesc "as'saß")
309 "as\0x27/sa\0xc3/\0x9f/"
341 "as\0x27/sa\0xc3/\0x9f/"
342+```
310
343
311
344
312−
345+---
313−***
314### `++runt`
346### `++runt`
315
347
316Prepend `n` times
348Prepend `n` times
317
349
318Add `a` repetitions of character `b` to the head of `++tape` `c`.
350Add `a` repetitions of character `b` to the head of `++tape` `c`.
319
351
320−Accepts
352+#### Accepts
321−-------
322
353
323`a` and `b` are atoms.
354`a` and `b` are atoms.
324
355
325`c` is a `++tape`.
356`c` is a `++tape`.
326
357
327−Produces
358+#### Produces
328−--------
329
359
330A `++tape`.
360A `++tape`.
331
361
332−Source
362+#### Source
333−------
334
363
364+```
335 ++ runt :: prepend repeatedly
365 ++ runt :: prepend repeatedly
336 |= [[a/@ b/@] c/tape]
366 |= [[a/@ b/@] c/tape]
337 ^- tape
367 ^- tape
@@ -339,77 +369,75 @@ Source
339 c
369 c
340 [b $(a (dec a))]
370 [b $(a (dec a))]
341 ::
371 ::
372+```
342
373
343−Examples
374+#### Examples
344−--------
345
375
376+```
346− /> (runt [2 '/'] "ham")
377+ > (runt [2 '/'] "ham")
347 "//ham"
378 "//ham"
348− /> (runt [10 'a'] "")
379+ > (runt [10 'a'] "")
349 "aaaaaaaaaa"
380 "aaaaaaaaaa"
381+```
350
382
351
383
352−
384+---
353−***
354### `++sand`
385### `++sand`
355
386
356Soft-cast by odor
387Soft-cast by odor
357
388
358Soft-cast validity by odor.
389Soft-cast validity by odor.
359
390
360−Accepts
391+#### Accepts
361−-------
362
392
363`a` is a `++span` (`@ta`).
393`a` is a `++span` (`@ta`).
364
394
365`b` is an atom.
395`b` is an atom.
366
396
367−Produces
397+#### Produces
368−--------
369
398
370A `(unit @)`.
399A `(unit @)`.
371
400
372−Source
401+#### Source
373−------
374
402
403+```
375 ++ sand :: atom sanity
404 ++ sand :: atom sanity
376 |= a/@ta
405 |= a/@ta
377 |= b/@ ^- (unit @)
406 |= b/@ ^- (unit @)
378 ?.(((sane a) b) ~ [~ b])
407 ?.(((sane a) b) ~ [~ b])
379 ::
408 ::
409+```
380
410
381−Examples
411+#### Examples
382−--------
383
412
413+```
384− /> `(unit @ta)`((sand %ta) 'sym-som')
414+ > `(unit @ta)`((sand %ta) 'sym-som')
385 [~ ~.sym-som]
415 [~ ~.sym-som]
386− /> `(unit @ta)`((sand %ta) 'err!')
416+ > `(unit @ta)`((sand %ta) 'err!')
387 ~
417 ~
418+```
388
419
389
420
390−
421+---
391−***
392### `++sane`
422### `++sane`
393
423
394Check odor validity
424Check odor validity
395
425
396Check validity by odor. Produces a gate.
426Check validity by odor. Produces a gate.
397
427
398−Accepts
428+#### Accepts
399−-------
400
429
401`a` is a `++span` (`@ta`).
430`a` is a `++span` (`@ta`).
402
431
403`b` is an atom.
432`b` is an atom.
404
433
405−Produces
434+#### Produces
406−--------
407
435
408A boolean.
436A boolean.
409
437
410−Source
438+#### Source
411−------
412
439
440+```
413 ++ sane :: atom sanity
441 ++ sane :: atom sanity
414 |= a/@ta
442 |= a/@ta
415 |= b/@ ^- ?
443 |= b/@ ^- ?
@@ -445,39 +473,38 @@ Source
445 $(b (rsh 3 len b))
473 $(b (rsh 3 len b))
446 ==
474 ==
447 ::
475 ::
476+```
448
477
449−Examples
478+#### Examples
450−--------
451
479
480+```
452− /> ((sane %tas) %mol)
481+ > ((sane %tas) %mol)
453 %.y
482 %.y
454− /> ((sane %tas) 'lam')
483+ > ((sane %tas) 'lam')
455 %.y
484 %.y
456− /> ((sane %tas) 'more ace')
485+ > ((sane %tas) 'more ace')
457 %.n
486 %.n
487+```
458
488
459
489
460−
490+---
461−***
462### `++teff`
491### `++teff`
463
492
464UTF8 Length
493UTF8 Length
465
494
466Produces the number of utf8 bytes.
495Produces the number of utf8 bytes.
467
496
468−Accepts
497+#### Accepts
469−-------
470
498
471`a` is a `@t`.
499`a` is a `@t`.
472
500
473−Produces
501+#### Produces
474−--------
475
502
476An atom.
503An atom.
477
504
478−Source
505+#### Source
479−------
480
506
507+```
481 |= a/@t ^- @
508 |= a/@t ^- @
482 =+ b=(end 3 1 a)
509 =+ b=(end 3 1 a)
483 ~| %bad-utf8
510 ~| %bad-utf8
@@ -485,39 +512,38 @@ Source
485 ?>(=(`@`0 a) 0)
512 ?>(=(`@`0 a) 0)
486 ?> |((gte b 32) =(10 b))
513 ?> |((gte b 32) =(10 b))
487 ?:((lte b 127) 1 ?:((lte b 223) 2 ?:((lte b 239) 3 4)))
514 ?:((lte b 127) 1 ?:((lte b 223) 2 ?:((lte b 239) 3 4)))
515+```
488
516
489−Examples
517+#### Examples
490−--------
491
518
519+```
492− /> (teff 'a')
520+ > (teff 'a')
493 1
521 1
494− /> (teff 'ß')
522+ > (teff 'ß')
495 2
523 2
524+```
496
525
497
526
498−
527+---
499−***
500### `++trim`
528### `++trim`
501
529
502Tape split
530Tape split
503
531
504Split first `a` characters off `++tape` `b`.
532Split first `a` characters off `++tape` `b`.
505
533
506−Accepts
534+#### Accepts
507−-------
508
535
509`a` is an atom.
536`a` is an atom.
510
537
511`b` is a `++tape`.
538`b` is a `++tape`.
512
539
513−Produces
540+#### Produces
514−--------
515
541
516A cell of `++tape`s, `p` and `q`.
542A cell of `++tape`s, `p` and `q`.
517
543
518−Source
544+#### Source
519−------
520
545
546+```
521 ++ trim :: 31-bit nonzero
547 ++ trim :: 31-bit nonzero
522 |= key/@
548 |= key/@
523 =+ syd=0xcafe.babe
549 =+ syd=0xcafe.babe
@@ -527,38 +553,36 @@ Source
527 ?.(=(0 ham) ham $(syd +(syd)))
553 ?.(=(0 ham) ham $(syd +(syd)))
528 --
554 --
529 ::
555 ::
556+```
530
557
558+#### Examples
531
559
532−Examples
560+```
533−--------
534−
535− /> (trim 5 "lasok termun")
561+ > (trim 5 "lasok termun")
536 [p="lasok" q=" termun"]
562 [p="lasok" q=" termun"]
537− /> (trim 5 "zam")
563+ > (trim 5 "zam")
538 [p="zam" q=""]
564 [p="zam" q=""]
565+```
539
566
540
567
541−
568+---
542−***
543### `++trip`
569### `++trip`
544
570
545Cord to tape
571Cord to tape
546
572
547Produce a `++tape` from `++cord`.
573Produce a `++tape` from `++cord`.
548
574
549−Accepts
575+#### Accepts
550−-------
551
576
552`a` is an atom.
577`a` is an atom.
553
578
554−Produces
579+#### Produces
555−--------
556
580
557A `++tape`.
581A `++tape`.
558
582
559−Source
583+#### Source
560−------
561
584
585+```
562 ++ trip :: cord to tape
586 ++ trip :: cord to tape
563 ~/ %trip
587 ~/ %trip
564 |= a/@ ^- tape
588 |= a/@ ^- tape
@@ -566,94 +590,92 @@ Source
566 ~
590 ~
567 [^-(@ta (end 3 1 a)) $(a (rsh 3 1 a))]
591 [^-(@ta (end 3 1 a)) $(a (rsh 3 1 a))]
568 ::
592 ::
593+```
569
594
595+#### Examples
570
596
571−Examples
597+```
572−--------
573−
574− /> (trip 'john doe')
598+ > (trip 'john doe')
575 "john doe"
599 "john doe"
576− /> (trip 'abc 123 !@#')
600+ > (trip 'abc 123 !@#')
577 "abc 123 !@#"
601 "abc 123 !@#"
578− /> (trip 'abc')
602+ > (trip 'abc')
579 "abc"
603 "abc"
604+```
580
605
581
606
582−
607+---
583−***
584### `++tuba`
608### `++tuba`
585
609
586UTF8 to UTF32 tape
610UTF8 to UTF32 tape
587
611
588Convert `++tape` to a `++list` of codepoints (`@c`).
612Convert `++tape` to a `++list` of codepoints (`@c`).
589
613
590−Accepts
614+#### Accepts
591−-------
592
615
593`a` is a `++tape`.
616`a` is a `++tape`.
594
617
595−Produces
618+#### Produces
596−--------
597
619
598A `++list` of codepoints `@c`.
620A `++list` of codepoints `@c`.
599
621
600−Source
622+#### Source
601−------
602
623
624+```
603 ++ tuba :: utf8 to utf32 tape
625 ++ tuba :: utf8 to utf32 tape
604 |= a/tape
626 |= a/tape
605 ^- (list @c)
627 ^- (list @c)
606 (rip 5 (turf (rap 3 a))) :: XX horrible
628 (rip 5 (turf (rap 3 a))) :: XX horrible
607 ::
629 ::
630+```
608
631
609−Examples
632+#### Examples
610−--------
611
633
634+```
612− /> (tuba "я тут")
635+ > (tuba "я тут")
613 ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.]
636 ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.]
614− /> (tuba "chars")
637+ > (tuba "chars")
615 ~[~-c ~-h ~-a ~-r ~-s]
638 ~[~-c ~-h ~-a ~-r ~-s]
639+```
616
640
617
641
618−
642+---
619−***
620### `++tufa`
643### `++tufa`
621
644
622UTF32 to UTF8 tape
645UTF32 to UTF8 tape
623
646
624Wrap a `++list` of utf32 codepoints into a utf8 `++tape`.
647Wrap a `++list` of utf32 codepoints into a utf8 `++tape`.
625
648
626−Accepts
649+#### Accepts
627−-------
628
650
629`a` is a `++list` of `@c`.
651`a` is a `++list` of `@c`.
630
652
631−Produces
653+#### Produces
632−--------
633
654
634A `++tape`.
655A `++tape`.
635
656
636−Source
657+#### Source
637−------
638
658
659+```
639 ++ tufa :: utf32 to utf8 tape
660 ++ tufa :: utf32 to utf8 tape
640 |= a=(list @c)
661 |= a=(list @c)
641 ^- tape
662 ^- tape
642 ?~ a ""
663 ?~ a ""
643 (weld (rip 3 (tuft i.a)) $(a t.a))
664 (weld (rip 3 (tuft i.a)) $(a t.a))
644 ::
665 ::
666+```
645
667
646−Examples
668+#### Examples
647−--------
648
669
670+```
649− /> (tufa ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.])
671+ > (tufa ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.])
650 "я тут"
672 "я тут"
651− /> (tufa ((list @c) ~[%a %b 0xb1 %c]))
673+ > (tufa ((list @c) ~[%a %b 0xb1 %c]))
652 "ab±c"
674 "ab±c"
675+```
653
676
654
677
655−
678+---
656−***
657### `++tuft`
679### `++tuft`
658
680
659UTF32 to UTF8 text
681UTF32 to UTF8 text
@@ -661,19 +683,17 @@ UTF32 to UTF8 text
661Convert utf32 glyph to
683Convert utf32 glyph to
662LSB utf8 `++cord`.
684LSB utf8 `++cord`.
663
685
664−Accepts
686+#### Accepts
665−-------
666
687
667`a` is a codepoint (`@c`).
688`a` is a codepoint (`@c`).
668
689
669−Produces
690+#### Produces
670−--------
671
691
672A `++cord`.
692A `++cord`.
673
693
674−Source
694+#### Source
675−------
676
695
696+```
677 ++ tuft :: utf32 to utf8 text
697 ++ tuft :: utf32 to utf8 text
678 |= a/@c
698 |= a/@c
679 ^- @t
699 ^- @t
@@ -702,38 +722,36 @@ Source
702 (mix 0b1000.0000 (end 0 6 b))
722 (mix 0b1000.0000 (end 0 6 b))
703 c
723 c
704 ==
724 ==
705− ::
725+```
706
726
707−Examples
727+#### Examples
708−--------
709
728
729+```
710− /> (tuft `@c`%a)
730+ > (tuft `@c`%a)
711 'a'
731 'a'
712− /> (tuft `@c`0xb6)
732+ > (tuft `@c`0xb6)
713 '¶'
733 '¶'
734+```
714
735
715
736
716−
737+---
717−***
718### `++turf`
738### `++turf`
719
739
720UTF8 to UTF32 cord
740UTF8 to UTF32 cord
721
741
722Convert utf8 (`++cord`) to utf32 codepoints.
742Convert utf8 (`++cord`) to utf32 codepoints.
723
743
724−Accepts
744+#### Accepts
725−-------
726
745
727`a` is a `@t`.
746`a` is a `@t`.
728
747
729−Produces
748+#### Produces
730−--------
731
749
732A `@c`, UTF-32 codepoint.
750A `@c`, UTF-32 codepoint.
733
751
734−Source
752+#### Source
735−------
736
753
754+```
737 ++ turf :: utf8 to utf32
755 ++ turf :: utf8 to utf32
738 |= a/@t
756 |= a/@t
739 ^- @c
757 ^- @c
@@ -755,43 +773,42 @@ Source
755 ?. =((tuft c) (end 3 b a)) ~|(%bad-utf8 !!)
773 ?. =((tuft c) (end 3 b a)) ~|(%bad-utf8 !!)
756 [c $(a (rsh 3 b a))]
774 [c $(a (rsh 3 b a))]
757 ::
775 ::
776+```
758
777
759−Examples
778+#### Examples
760−--------
761
779
780+```
762− /> (turf 'my ßam')
781+ > (turf 'my ßam')
763 ~-my.~df.am
782 ~-my.~df.am
764− /> 'я тут'
783+ > 'я тут'
765 'я тут'
784 'я тут'
766− /> (turf 'я тут')
785+ > (turf 'я тут')
767 ~-~44f..~442.~443.~442.
786 ~-~44f..~442.~443.~442.
768− /> `@ux`'я тут'
787+ > `@ux`'я тут'
769 0x82.d183.d182.d120.8fd1
788 0x82.d183.d182.d120.8fd1
770− /> `@ux`(turf 'я тут')
789+ > `@ux`(turf 'я тут')
771 0x442.0000.0443.0000.0442.0000.0020.0000.044f
790 0x442.0000.0443.0000.0442.0000.0020.0000.044f
791+```
772
792
773
793
774−
794+---
775−***
776### `++wack`
795### `++wack`
777
796
778Coin format encode
797Coin format encode
779
798
780Escape `++span` `~` as `~~` and `_` as `~-`. Used for printing.
799Escape `++span` `~` as `~~` and `_` as `~-`. Used for printing.
781
800
782−Accepts
801+#### Accepts
783−-------
784
802
785`a` is a `++span` (`@ta`).
803`a` is a `++span` (`@ta`).
786
804
787−Produces
805+#### Produces
788−--------
789
806
790A `++span` (`@ta`).
807A `++span` (`@ta`).
791
808
792−Source
809+#### Source
793−------
794
810
811+```
795 ++ wack :: coin format
812 ++ wack :: coin format
796 |= a/@ta
813 |= a/@ta
797 ^- @ta
814 ^- @ta
@@ -804,41 +821,42 @@ Source
804 ?: =('_' i.b) ['~' '-' $(b t.b)]
821 ?: =('_' i.b) ['~' '-' $(b t.b)]
805 [i.b $(b t.b)]
822 [i.b $(b t.b)]
806 ::
823 ::
824+```
807
825
808−Examples
826+#### Examples
809−--------
810
827
828+```
811− /> (wack '~20_sam~')
829+ > (wack '~20_sam~')
812 ~.~~20~-sam~~
830 ~.~~20~-sam~~
831+
813− /> `@t`(wack '~20_sam~')
832+ > `@t`(wack '~20_sam~')
814 '~~20~-sam~~'
833 '~~20~-sam~~'
834+
815 > ~(rend co %many ~[`ud/5 `ta/'~20_sam'])
835 > ~(rend co %many ~[`ud/5 `ta/'~20_sam'])
816 "._5_~~.~~20~-sam__"
836 "._5_~~.~~20~-sam__"
837+
817 > ._5_~~.~~20~-sam__
838 > ._5_~~.~~20~-sam__
818 [5 ~.~20_sam]
839 [5 ~.~20_sam]
840+```
819
841
820−
842+---
821−
822−***
823### `++wick`
843### `++wick`
824
844
825Coin format decode
845Coin format decode
826
846
827Unescape `++span` `~~` as `~` and `~-` as `_`.
847Unescape `++span` `~~` as `~` and `~-` as `_`.
828
848
829−Accepts
849+#### Accepts
830−-------
831
850
832`a` is a an atom.
851`a` is a an atom.
833
852
834−Produces
853+#### Produces
835−--------
836
854
837A `++span` `@ta`.
855A `++span` `@ta`.
838
856
839−Source
857+#### Source
840−------
841
858
859+```
842 ++ wick :: knot format
860 ++ wick :: knot format
843 |= a/@
861 |= a/@
844 ^- (unit @ta)
862 ^- (unit @ta)
@@ -856,37 +874,37 @@ Source
856 @ [b ~]
874 @ [b ~]
857 ==
875 ==
858 ::
876 ::
877+```
859
878
860−Examples
879+#### Examples
861−--------
862
880
881+```
863− /> `@t`(wick '~-ams~~lop')
882+ > `@t`(wick '~-ams~~lop')
864 '_ams~lop'
883 '_ams~lop'
865− /> `@t`(wick (wack '~20_sam~'))
866− '~20_sam~'
867
884
885+ > `@t`(wick (wack '~20_sam~'))
886+ '~20_sam~'
887+```
868
888
869
889
870−***
890+---
871### `++woad`
891### `++woad`
872
892
873Unescape cord
893Unescape cord
874
894
875Unescape `++cord` codepoints.
895Unescape `++cord` codepoints.
876
896
877−Accepts
897+#### Accepts
878−-------
879
898
880`a` is a `@ta`.
899`a` is a `@ta`.
881
900
882−Produces
901+#### Produces
883−--------
884
902
885A `++cord`.
903A `++cord`.
886
904
887−Source
905+#### Source
888−------
889
906
907+```
890 ++ woad :: cord format
908 ++ woad :: cord format
891 |= a/@ta
909 |= a/@ta
892 ^- @t
910 ^- @t
@@ -920,35 +938,34 @@ Source
920 $'~' ['~' $(a c)]
938 $'~' ['~' $(a c)]
921 ==
939 ==
922 ::
940 ::
941+```
923
942
924−Examples
943+#### Examples
925−--------
926
944
945+```
927− /> (woad ~.~b6.20.as)
946+ > (woad ~.~b6.20.as)
928 '¶20 as'
947 '¶20 as'
948+```
929
949
930
950
931−
951+---
932−***
933### `++wood`
952### `++wood`
934
953
935Escape cord
954Escape cord
936
955
937Escape `++cord` codepoints.
956Escape `++cord` codepoints.
938
957
939−Accepts
958+#### Accepts
940−-------
941
959
942`a` is a `++span` (`@ta`).
960`a` is a `++span` (`@ta`).
943
961
944−Produces
962+#### Produces
945−--------
946
963
947A `++span` (`@ta`).
964A `++span` (`@ta`).
948
965
949−Source
966+#### Source
950−------
951
967
968+```
952 ++ wood :: cord format
969 ++ wood :: cord format
953 |= a/@t
970 |= a/@t
954 ^- @ta
971 ^- @ta
@@ -974,12 +991,13 @@ Source
974 =+ f=(rsh 2 e c)
991 =+ f=(rsh 2 e c)
975 [(add ?:((lte f 9) 48 87) f) $(c (end 2 e c))]
992 [(add ?:((lte f 9) 48 87) f) $(c (end 2 e c))]
976 ::
993 ::
994+```
977
995
978−Examples
996+#### Examples
979−--------
980
997
998+```
981− /> (wood 'my ßam')
999+ > (wood 'my ßam')
982 ~.my.~df.am
1000 ~.my.~df.am
1001+```
983
1002
984−
1003+---
985−***
docs/reference/library/4c.umd+69−63
@@ -1,51 +1,54 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'30'
3+ title/'4c: Tank Printer'
4+ ==
4
5
6+;>
5
7
6# 4c: tank printer
8# 4c: tank printer
9+
7### `++re`
10### `++re`
8
11
9Pretty-printing engine
12Pretty-printing engine
10
13
11Pretty-printing engine that accepts a `++tank` sample and contains arms that perform computation on it.
14Pretty-printing engine that accepts a `++tank` sample and contains arms that perform computation on it.
12
15
13−Accepts
16+#### Accepts
14−-------
15
17
16`tac` is a `++tank`.
18`tac` is a `++tank`.
17
19
18−Produces
20+#### Produces
19−--------
20
21
22+```
21 ++ re
23 ++ re
22 |_ tac/tank
24 |_ tac/tank
25+```
23
26
24−Examples
27+#### Examples
25−--------
26
28
29+```
27− /> ~(. re leaf+"ham")
30+ > ~(. re leaf+"ham")
28 <2.gdc {tac/{$leaf ""} <402.arm 110.jyx 1.ztu $151>}>
31 <2.gdc {tac/{$leaf ""} <402.arm 110.jyx 1.ztu $151>}>
32+```
29
33
34+---
30### `++ram`
35### `++ram`
31
36
32Flatten to tape
37Flatten to tape
33
38
34Flatten `++tank` out into a `++tape`.
39Flatten `++tank` out into a `++tape`.
35
40
36−Accepts
41+#### Accepts
37−-------
38
42
39`tac` is a `++tank`, taken from sample of `++re` core.
43`tac` is a `++tank`, taken from sample of `++re` core.
40
44
41−Produces
45+#### Produces
42−--------
43
46
44A `++tape`.
47A `++tape`.
45
48
46−Source
49+#### Source
47−------
48
50
51+```
49 ++ ram
52 ++ ram
50 ^- tape
53 ^- tape
51 ?- -.tac
54 ?- -.tac
@@ -61,36 +64,36 @@ Source
61 (weld ram(tac i.q.tac) ?~(t.q.tac voz (weld p.p.tac voz)))
64 (weld ram(tac i.q.tac) ?~(t.q.tac voz (weld p.p.tac voz)))
62 ==
65 ==
63 ::
66 ::
67+```
64
68
65−Examples
69+#### Examples
66−--------
67
70
71+```
68− /> ~(ram re leaf+"foo")
72+ > ~(ram re leaf+"foo")
69 "foo"
73 "foo"
70− /> ~(ram re rose+["." "(" ")"]^~[leaf+"bar" leaf+"baz" leaf+"bam"])
74+ > ~(ram re rose+["." "(" ")"]^~[leaf+"bar" leaf+"baz" leaf+"bam"])
71 "(bar.baz.bam)"
75 "(bar.baz.bam)"
72−
76+```
77+---
73### `++win`
78### `++win`
74
79
75Render at indent
80Render at indent
76
81
77Render at indent level `tab` and width `edg`.
82Render at indent level `tab` and width `edg`.
78
83
79−Accepts
84+#### Accepts
80−-------
81
85
82`tac` is a `++tank`, taken from sample of `++re` core.
86`tac` is a `++tank`, taken from sample of `++re` core.
83
87
84`tab` and `edg` are atoms.
88`tab` and `edg` are atoms.
85
89
86−Produces
90+#### Produces
87−--------
88
91
89A `++wall` (`++list` of `++tapes`).
92A `++wall` (`++list` of `++tapes`).
90
93
91−Source
94+#### Source
92−------
93
95
96+```
94 ++ win
97 ++ win
95 |= {tab/@ edg/@}
98 |= {tab/@ edg/@}
96 =+ lug=`wall`~
99 =+ lug=`wall`~
@@ -117,36 +120,39 @@ Source
117 ==
120 ==
118 (wig(lug qyr) q.p.tac)
121 (wig(lug qyr) q.p.tac)
119 ::
122 ::
123+```
120
124
121−Examples
125+#### Examples
122−--------
123
126
127+```
124− /> (~(win re leaf+"samoltekon-lapdok") 0 20)
128+ > (~(win re leaf+"samoltekon-lapdok") 0 20)
125 <<"samoltekon-lapdok">>
129 <<"samoltekon-lapdok">>
130+
126− /> (~(win re leaf+"samoltekon-lapdok") 0 10)
131+ > (~(win re leaf+"samoltekon-lapdok") 0 10)
127 <<"\/samolt\/" " ekon-l" " apdok" "\/ \/">>
132 <<"\/samolt\/" " ekon-l" " apdok" "\/ \/">>
133+
128− /> (~(win re rose+["--" "[" "]"]^~[leaf+"1423" leaf+"2316"]) 0 20)
134+ > (~(win re rose+["--" "[" "]"]^~[leaf+"1423" leaf+"2316"]) 0 20)
129 <<"[1423--2316]">>
135 <<"[1423--2316]">>
136+
130− /> (~(win re rose+["--" "[" "]"]^~[leaf+"1423" leaf+"2316"]) 0 10)
137+ > (~(win re rose+["--" "[" "]"]^~[leaf+"1423" leaf+"2316"]) 0 10)
131 <<"[ 1423" " 2316" "]">>
138 <<"[ 1423" " 2316" "]">>
139+```
132
140
141+---
133### `++din`
142### `++din`
134
143
135XX document
144XX document
136
145
137−Accepts
146+#### Accepts
138−-------
139
147
140−Produces
148+#### Produces
141−--------
142
149
143−Source
150+#### Source
144−------
145
151
146 ++ din (mod (add 2 tab) (mul 2 (div edg 3)))
152 ++ din (mod (add 2 tab) (mul 2 (div edg 3)))
147
153
148
154
149−----------------------------------------------------------------------
155+---
150
156
151### `++fit`
157### `++fit`
152
158
@@ -154,25 +160,21 @@ Fit on one line test
154
160
155Determine whether `tac` fits on one line. Internal to `++win`
161Determine whether `tac` fits on one line. Internal to `++win`
156
162
157−Accepts
163+#### Accepts
158−-------
159
164
160−Produces
165+#### Produces
161−--------
162
166
163−Source
167+#### Source
164−------
165
168
166++ fit (lte (lent ram) (sub edg tab))
169++ fit (lte (lent ram) (sub edg tab))
167
170
168
171
169−Examples
172+#### Examples
170−--------
171
173
172
174
173
175
174
176
175−----------------------------------------------------------------------
177+---
176
178
177### `++rig`
179### `++rig`
178
180
@@ -181,21 +183,19 @@ Wrap in `\/`
181Wrap `++tape` in `\/` if it doesn't fit at current indentation. Internal to
183Wrap `++tape` in `\/` if it doesn't fit at current indentation. Internal to
182`++win`
184`++win`
183
185
184−Accepts
186+#### Accepts
185−-------
186
187
187`tac` is a `++tank`, taken from sample of `++re` core.
188`tac` is a `++tank`, taken from sample of `++re` core.
188
189
189`hom` is a `++tape`.
190`hom` is a `++tape`.
190
191
191−Produces
192+#### Produces
192−--------
193
193
194A `++wall` (list of `++tape`s).
194A `++wall` (list of `++tape`s).
195
195
196−Source
196+#### Source
197−------
198
197
198+```
199 ++ rig
199 ++ rig
200 |= hom/tape
200 |= hom/tape
201 ^- wall
201 ^- wall
@@ -214,26 +214,26 @@ Source
214 => .(mut (trim (sub edg tab) hom))
214 => .(mut (trim (sub edg tab) hom))
215 [(runt [tab ' '] p.mut) $(hom q.mut)]
215 [(runt [tab ' '] p.mut) $(hom q.mut)]
216 ::
216 ::
217+```
217
218
218−Examples
219+#### Examples
219−--------
220
220
221+---
221### `++wig`
222### `++wig`
222
223
223`++win` render tape
224`++win` render tape
224
225
225Render `++tape`. Internal to `++win`.
226Render `++tape`. Internal to `++win`.
226
227
227−Accepts
228+#### Accepts
228−-------
229
229
230`tac` is a `++tank`, taken from sample of `++re` core.
230`tac` is a `++tank`, taken from sample of `++re` core.
231
231
232`hom` is a `++tape`.
232`hom` is a `++tape`.
233
233
234−Produces
234+#### Produces
235−--------
236
235
236+```
237 ++ wig
237 ++ wig
238 |= hom/tape
238 |= hom/tape
239 ^- wall
239 ^- wall
@@ -249,13 +249,14 @@ Produces
249 [(runt [tab ' '] (weld hom `tape`[' ' (slag wug i.lug)])) t.lug]
249 [(runt [tab ' '] (weld hom `tape`[' ' (slag wug i.lug)])) t.lug]
250 --
250 --
251 --
251 --
252+```
252
253
253
254
254
255
255−
256+---
256−***
257### `++show`
257### `++show`
258
258
259+```
259 ++ show :: XX deprecated, use span
260 ++ show :: XX deprecated, use span
260 |= vem/*
261 |= vem/*
261 |^ ^- tank
262 |^ ^- tank
@@ -312,11 +313,13 @@ Produces
312 {s/$z c/*} $(vem [[%r %$ %$ %$] c.vem])
313 {s/$z c/*} $(vem [[%r %$ %$ %$] c.vem])
313 * !!
314 * !!
314 ==
315 ==
316+```
315
317
316XX document
318XX document
317
319
318### `++shep`
320### `++shep`
319
321
322+```
320 ++ shep
323 ++ shep
321 |= {fom/@ gar/*}
324 |= {fom/@ gar/*}
322 ^- tank
325 ^- tank
@@ -334,11 +337,13 @@ XX document
334 ['\\' '#' $(i (add 2 i))]
337 ['\\' '#' $(i (add 2 i))]
335 (weld ~(ram re (show d -.gar)) $(i (add 2 i), gar +.gar))
338 (weld ~(ram re (show d -.gar)) $(i (add 2 i), gar +.gar))
336 ::
339 ::
340+```
337
341
338XX document
342XX document
339
343
340### `++shop`
344### `++shop`
341
345
346+```
342 ++ shop
347 ++ shop
343 |= {aug/* vel/$-(a/@ tape)}
348 |= {aug/* vel/$-(a/@ tape)}
344 ^- tank
349 ^- tank
@@ -352,6 +357,7 @@ XX document
352 [^$ ~]
357 [^$ ~]
353 [^$(aug -.aug) $(aug +.aug)]
358 [^$(aug -.aug) $(aug +.aug)]
354 ::
359 ::
360+```
355
361
356
362
357XX document
363XX document
docs/reference/library/4d.umd+16−9
@@ -1,6 +1,9 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'31'
3+ title/'4d: Parsing (Tracing)'
4+ ==
5+
6+;>
4
7
5
8
6# 4d: parsing (tracing)
9# 4d: parsing (tracing)
@@ -24,15 +27,17 @@ A `hair`.
24
27
25#### Source
28#### Source
26
29
30+```
27− ++ last |= [zyc=hair naz=hair]
31+ ++ last |= [zyc=hair naz=hair]
28 ^- hair
32 ^- hair
29 ?: =(p.zyc p.naz)
33 ?: =(p.zyc p.naz)
30 ?:((gth q.zyc q.naz) zyc naz)
34 ?:((gth q.zyc q.naz) zyc naz)
31 ?:((gth p.zyc p.naz) zyc naz)
35 ?:((gth p.zyc p.naz) zyc naz)
32−
36+```
33
37
34#### Examples
38#### Examples
35
39
40+```
36 > (last [1 1] [1 2])
41 > (last [1 1] [1 2])
37 [p=1 q=2]
42 [p=1 q=2]
38
43
@@ -44,7 +49,7 @@ A `hair`.
44
49
45 > (last [7 7] [7 7])
50 > (last [7 7] [7 7])
46 [p=7 q=7]
51 [p=7 q=7]
47−
52+```
48
53
49***
54***
50### `lust`
55### `lust`
@@ -66,14 +71,16 @@ A hair.
66
71
67#### Source
72#### Source
68
73
74+```
69− ++ lust |= [weq=char naz=hair]
75+ ++ lust |= [weq=char naz=hair]
70 ^- hair
76 ^- hair
71 ?:(=(`@`10 weq) [+(p.naz) 1] [p.naz +(q.naz)])
77 ?:(=(`@`10 weq) [+(p.naz) 1] [p.naz +(q.naz)])
72−
78+```
73
79
74
80
75#### Examples
81#### Examples
76
82
83+```
77 > (lust `a` [1 1])
84 > (lust `a` [1 1])
78 [p=1 q=2]
85 [p=1 q=2]
79
86
@@ -92,6 +99,6 @@ A hair.
92 lokes
99 lokes
93 """
100 """
94 [2 6]
101 [2 6]
95−
102+```
96
103
97***
104***
docs/reference/library/4e.umd+117−105
@@ -1,9 +1,12 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'32'
3+ title/'4e: Parsing (Combinators)'
4+ ==
4
5
6+;>
5
7
6# 4e: parsing (combinators)
8# 4e: parsing (combinators)
9+
7### `++bend`
10### `++bend`
8
11
9Conditional composer
12Conditional composer
@@ -14,8 +17,7 @@ result. If there is no suffix, or if the suffix fails to be composed
14with the current result, the current result is produced. Used to map a
17with the current result, the current result is produced. Used to map a
15group of rules to a specified output.
18group of rules to a specified output.
16
19
17−Accepts
20+#### Accepts
18−-------
19
21
20`raq` is a gate.
22`raq` is a gate.
21
23
@@ -23,14 +25,13 @@ Accepts
23
25
24`vex` is an edge.
26`vex` is an edge.
25
27
26−Produces
28+#### Produces
27−--------
28
29
29A `++rule`.
30A `++rule`.
30
31
31−Source
32+#### Source
32−------
33
33
34+```
34 ++ bend :: conditional comp
35 ++ bend :: conditional comp
35 ~/ %bend
36 ~/ %bend
36 |* raq/_|*({a/* b/*} [~ u=[a b]])
37 |* raq/_|*({a/* b/*} [~ u=[a b]])
@@ -47,27 +48,33 @@ Source
47 [p=yur q=q.vex]
48 [p=yur q=q.vex]
48 [p=yur q=[~ u=[p=u.vux q=q.u.q.yit]]]
49 [p=yur q=[~ u=[p=u.vux q=q.u.q.yit]]]
49 ::
50 ::
51+```
50
52
51−Examples
53+#### Examples
52−--------
53
54
55+```
54 > (;~((bend |=([a/char b/char] ?.(=(a b) ~ (some +(a))))) prn prn) [1 1] "qs")
56 > (;~((bend |=([a/char b/char] ?.(=(a b) ~ (some +(a))))) prn prn) [1 1] "qs")
55 [p=[p=1 q=3] q=[~ u=[p=~~q q=[p=[p=1 q=2] q="s"]]]]
57 [p=[p=1 q=3] q=[~ u=[p=~~q q=[p=[p=1 q=2] q="s"]]]]
58+
56 > (;~((bend |=([a/char b/char] ?.(=(a b) ~ (some +(a))))) prn prn) [1 1] "qqq")
59 > (;~((bend |=([a/char b/char] ?.(=(a b) ~ (some +(a))))) prn prn) [1 1] "qqq")
57 [p=[p=1 q=3] q=[~ u=[p=~~r q=[p=[p=1 q=3] q="q"]]]]
60 [p=[p=1 q=3] q=[~ u=[p=~~r q=[p=[p=1 q=3] q="q"]]]]
61+
58 > (scan "aa" ;~((bend |=([a/char b/char] ?.(=(a b) ~ (some +(a))))) prn prn))
62 > (scan "aa" ;~((bend |=([a/char b/char] ?.(=(a b) ~ (some +(a))))) prn prn))
59 ~~b
63 ~~b
64+
60 > (scan "ba" ;~((bend |=([a/char b/char] ?.(=(a b) ~ (some +(a))))) prn prn))
65 > (scan "ba" ;~((bend |=([a/char b/char] ?.(=(a b) ~ (some +(a))))) prn prn))
61 ! {1 3}
66 ! {1 3}
62 ! exit
67 ! exit
68+
63 > `(unit @tas)`(scan "" ;~((bend) (easy ~) sym))
69 > `(unit @tas)`(scan "" ;~((bend) (easy ~) sym))
64 ~
70 ~
71+
65 > `(unit @tas)`(scan "sep" ;~((bend) (easy ~) sym))
72 > `(unit @tas)`(scan "sep" ;~((bend) (easy ~) sym))
66 [~ %sep]
73 [~ %sep]
74+```
67
75
68
76
69−
77+---
70−***
71### `++comp`
78### `++comp`
72
79
73Arbitrary compose
80Arbitrary compose
@@ -76,8 +83,7 @@ Parsing composer: connects the `++edge` `vex` with a following `++rule` `sab`,
76combining the contents of `vex` with the result of `sab` using a binary
83combining the contents of `vex` with the result of `sab` using a binary
77gate `raq`. Used to fold over the results of several `++rules`.
84gate `raq`. Used to fold over the results of several `++rules`.
78
85
79−Accepts
86+#### Accepts
80−-------
81
87
82`raq` is a gate that accepts a cell of two nouns, `a` and `b`, and
88`raq` is a gate that accepts a cell of two nouns, `a` and `b`, and
83produces a cell of two nouns.
89produces a cell of two nouns.
@@ -86,14 +92,13 @@ produces a cell of two nouns.
86
92
87`vex` is an edge.
93`vex` is an edge.
88
94
89−Produces
95+#### Produces
90−--------
91
96
92A `++rule`.
97A `++rule`.
93
98
94−Source
99+#### Source
95−------
96
100
101+```
97 ++ comp
102 ++ comp
98 ~/ %comp
103 ~/ %comp
99 |* raq/_|*({a/* b/*} [a b]) :: arbitrary compose
104 |* raq/_|*({a/* b/*} [a b]) :: arbitrary compose
@@ -108,17 +113,19 @@ Source
108 [p=yur q=q.yit]
113 [p=yur q=q.yit]
109 [p=yur q=[~ u=[p=(raq p.u.q.vex p.u.q.yit) q=q.u.q.yit]]]
114 [p=yur q=[~ u=[p=(raq p.u.q.vex p.u.q.yit) q=q.u.q.yit]]]
110 ::
115 ::
116+```
111
117
112−Examples
118+#### Examples
113−--------
114
119
120+```
115 > (scan "123" ;~((comp |=([a/@u b/@u] (add a b))) dit dit dit))
121 > (scan "123" ;~((comp |=([a/@u b/@u] (add a b))) dit dit dit))
116 6
122 6
117 > (scan "12" ;~((comp |=([a/@u b/@u] (add a b))) dit dit dit))
123 > (scan "12" ;~((comp |=([a/@u b/@u] (add a b))) dit dit dit))
118 ! {1 3}
124 ! {1 3}
119 ! exit
125 ! exit
126+```
120
127
121−***
128+---
122### `++fail`
129### `++fail`
123
130
124Never parse
131Never parse
@@ -126,32 +133,32 @@ Never parse
126Produces an `++edge` at the same text position (`++hair`) with a failing
133Produces an `++edge` at the same text position (`++hair`) with a failing
127result (`q=~`).
134result (`q=~`).
128
135
129−Accepts
136+#### Accepts
130−-------
131
137
132`tub` is a `++nail`.
138`tub` is a `++nail`.
133
139
134−Produces
140+#### Produces
135−--------
136
141
137An `++edge`.
142An `++edge`.
138
143
139−Source
144+#### Source
140−------
141
145
146+```
142 ++ fail |=(tub/nail [p=p.tub q=~]) :: never parse
147 ++ fail |=(tub/nail [p=p.tub q=~]) :: never parse
148+```
143
149
144−Examples
150+#### Examples
145−--------
146
151
152+```
147 > (fail [[1 1] "abc"])
153 > (fail [[1 1] "abc"])
148 [p=[p=1 q=1] q=~]
154 [p=[p=1 q=1] q=~]
155+
149 > (fail [[p=1.337 q=70] "Parse me, please?"])
156 > (fail [[p=1.337 q=70] "Parse me, please?"])
150 [p=[p=1.337 q=70] q=~]
157 [p=[p=1.337 q=70] q=~]
158+```
151
159
152
160
153−
161+---
154−***
155### `++glue`
162### `++glue`
156
163
157Skip delimiter
164Skip delimiter
@@ -160,8 +167,7 @@ Parsing composer: connects an `++edge` `vex` with a following `++rule` `sab` by
160parsing the `++rule` `bus` (the delimiting symbol) and throwing out the
167parsing the `++rule` `bus` (the delimiting symbol) and throwing out the
161result.
168result.
162
169
163−Accepts
170+#### Accepts
164−-------
165
171
166`bus` is a `++rule`.
172`bus` is a `++rule`.
167
173
@@ -169,14 +175,13 @@ Accepts
169
175
170`vex` is an `++edge`.
176`vex` is an `++edge`.
171
177
172−Produces
178+#### Produces
173−--------
174
179
175
180
176
181
177−Source
182+#### Source
178−------
179
183
184+```
180 ++ glue :: add rule
185 ++ glue :: add rule
181 ~/ %glue
186 ~/ %glue
182 |* bus/rule
187 |* bus/rule
@@ -184,22 +189,25 @@ Source
184 |* {vex/edge sab/rule}
189 |* {vex/edge sab/rule}
185 (plug vex ;~(pfix bus sab))
190 (plug vex ;~(pfix bus sab))
186 ::
191 ::
192+```
187
193
188−Examples
194+#### Examples
189−--------
190
195
196+```
191 > (scan "200|mal|bon" ;~((glue bar) dem sym sym))
197 > (scan "200|mal|bon" ;~((glue bar) dem sym sym))
192 [q=200 7.102.829 7.237.474]
198 [q=200 7.102.829 7.237.474]
199+
193 > `[@u @tas @tas]`(scan "200|mal|bon" ;~((glue bar) dem sym sym))
200 > `[@u @tas @tas]`(scan "200|mal|bon" ;~((glue bar) dem sym sym))
194 [200 %mal %bon]
201 [200 %mal %bon]
202+
195 > (scan "200|;|bon" ;~((glue bar) dem sem sym))
203 > (scan "200|;|bon" ;~((glue bar) dem sem sym))
196 [q=200 ~~~3b. 7.237.474]
204 [q=200 ~~~3b. 7.237.474]
205+
197 > (scan "200.;.bon" ;~((glue dot) dem sem sym))
206 > (scan "200.;.bon" ;~((glue dot) dem sem sym))
198 [q=200 ~~~3b. 7.237.474]
207 [q=200 ~~~3b. 7.237.474]
208+```
199
209
200−
210+---
201−
202−***
203### `++less`
211### `++less`
204
212
205Parse unless
213Parse unless
@@ -207,21 +215,19 @@ Parse unless
207Parsing composer: if an `++edge` `vex` reflects a success, fail. Otherwise,
215Parsing composer: if an `++edge` `vex` reflects a success, fail. Otherwise,
208connect `vex` with the following `++rule`.
216connect `vex` with the following `++rule`.
209
217
210−Accepts
218+#### Accepts
211−-------
212
219
213`sab` is a `++rule`.
220`sab` is a `++rule`.
214
221
215`vex` is an `++edge`.
222`vex` is an `++edge`.
216
223
217−Produces
224+#### Produces
218−--------
219
225
220
226
221
227
222−Source
228+#### Source
223−------
224
229
230+```
225 ++ less :: no first and second
231 ++ less :: no first and second
226 |* {vex/edge sab/rule}
232 |* {vex/edge sab/rule}
227 ?~ q.vex
233 ?~ q.vex
@@ -229,22 +235,25 @@ Source
229 [p=(last p.vex p.roq) q=q.roq]
235 [p=(last p.vex p.roq) q=q.roq]
230 (fail +<.sab)
236 (fail +<.sab)
231 ::
237 ::
238+```
232
239
233−Examples
240+#### Examples
234−--------
235
241
242+```
236 > (scan "sas-/lo" (star ;~(less lus bar prn)))
243 > (scan "sas-/lo" (star ;~(less lus bar prn)))
237 "sas-/lo"
244 "sas-/lo"
245+
238 > (scan "sas-/l+o" (star ;~(less lus bar prn)))
246 > (scan "sas-/l+o" (star ;~(less lus bar prn)))
239 ! {1 8}
247 ! {1 8}
240 ! exit
248 ! exit
249+
241 > (scan "sas|-/lo" (star ;~(less lus bar prn)))
250 > (scan "sas|-/lo" (star ;~(less lus bar prn)))
242 ! {1 5}
251 ! {1 5}
243 ! exit
252 ! exit
253+```
244
254
245
255
246−
256+---
247−***
248### `++pfix`
257### `++pfix`
249
258
250Discard first rule
259Discard first rule
@@ -252,34 +261,34 @@ Discard first rule
252Parsing composer: connects an `++edge` `vex` with two subsequent `++rule`s,
261Parsing composer: connects an `++edge` `vex` with two subsequent `++rule`s,
253ignoring the result of the first and producing the result of the second.
262ignoring the result of the first and producing the result of the second.
254
263
255−Accepts
264+#### Accepts
256−-------
257
265
258`vex` is an edge.
266`vex` is an edge.
259
267
260−Produces
268+#### Produces
261−--------
262
269
263
270
264
271
265−Source
272+#### Source
266−------
267
273
274+```
268 ++ pfix :: discard first rule
275 ++ pfix :: discard first rule
269 ~/ %pfix
276 ~/ %pfix
270 (comp |*({a/* b/*} b))
277 (comp |*({a/* b/*} b))
278+```
271
279
272−Examples
280+#### Examples
273−--------
274
281
282+```
275 > `@t`(scan "%him" ;~(pfix cen sym))
283 > `@t`(scan "%him" ;~(pfix cen sym))
276 'him'
284 'him'
285+
277 > (scan "+++10" ;~(pfix (star lus) dem))
286 > (scan "+++10" ;~(pfix (star lus) dem))
278 q=10
287 q=10
288+```
279
289
280
290
281−
291+---
282−***
283### `++plug`
292### `++plug`
284
293
285Parse to tuple
294Parse to tuple
@@ -288,21 +297,19 @@ Parsing composer: connects an `++edge` `vex` with a following `++rule` `sab`, pr
288a cell of both the results. See also: the monad applicator ;\~ for a
297a cell of both the results. See also: the monad applicator ;\~ for a
289more detailed explanation.
298more detailed explanation.
290
299
291−Accepts
300+#### Accepts
292−-------
293
301
294`sab` is a `++rule`.
302`sab` is a `++rule`.
295
303
296`vex` is an `++edge`.
304`vex` is an `++edge`.
297
305
298−Produces
306+#### Produces
299−--------
300
307
301
308
302
309
303−Source
310+#### Source
304−------
305
311
312+```
306 ++ plug :: first then second
313 ++ plug :: first then second
307 ~/ %plug
314 ~/ %plug
308 |* {vex/edge sab/rule}
315 |* {vex/edge sab/rule}
@@ -314,20 +321,23 @@ Source
314 [p=yur q=q.yit]
321 [p=yur q=q.yit]
315 [p=yur q=[~ u=[p=[p.u.q.vex p.u.q.yit] q=q.u.q.yit]]]
322 [p=yur q=[~ u=[p=[p.u.q.vex p.u.q.yit] q=q.u.q.yit]]]
316 ::
323 ::
324+```
317
325
318−Examples
326+#### Examples
319−--------
320
327
328+```
321 > (scan "1..20" ;~(plug dem dot dot dem))
329 > (scan "1..20" ;~(plug dem dot dot dem))
322 [q=1 ~~~. ~~~. q=20]
330 [q=1 ~~~. ~~~. q=20]
331+
323 > (scan "moke/~2014.1.1" ;~(plug sym fas nuck:so))
332 > (scan "moke/~2014.1.1" ;~(plug sym fas nuck:so))
324 [1.701.539.693 ~~~2f. [% p=[p=~.da q=170.141.184.500.766.106.671.844.917.172.921.958.400]]]
333 [1.701.539.693 ~~~2f. [% p=[p=~.da q=170.141.184.500.766.106.671.844.917.172.921.958.400]]]
334+
325 > ;;(,[@tas @t ~ %da @da] (scan "moke/~2014.1.1" ;~(plug sym fas nuck:so)))
335 > ;;(,[@tas @t ~ %da @da] (scan "moke/~2014.1.1" ;~(plug sym fas nuck:so)))
326 [%moke '/' ~ %da ~2014.1.1]
336 [%moke '/' ~ %da ~2014.1.1]
337+```
327
338
328
339
329−
340+---
330−***
331### `++pose`
341### `++pose`
332
342
333Parse options
343Parse options
@@ -335,21 +345,19 @@ Parse options
335Parsing composer: if `vex` reflects a failure, connect it with the
345Parsing composer: if `vex` reflects a failure, connect it with the
336following rule `sab`. See also: the monad applicator ;\~
346following rule `sab`. See also: the monad applicator ;\~
337
347
338−Accepts
348+#### Accepts
339−-------
340
349
341`sab` is a `++rule`.
350`sab` is a `++rule`.
342
351
343`vex` is an `++edge`.
352`vex` is an `++edge`.
344
353
345−Produces
354+#### Produces
346−--------
347
355
348
356
349
357
350−Source
358+#### Source
351−------
352
359
360+```
353 ++ pose :: first or second
361 ++ pose :: first or second
354 ~/ %pose
362 ~/ %pose
355 |* {vex/edge sab/rule}
363 |* {vex/edge sab/rule}
@@ -358,24 +366,27 @@ Source
358 [p=(last p.vex p.roq) q=q.roq]
366 [p=(last p.vex p.roq) q=q.roq]
359 vex
367 vex
360 ::
368 ::
369+```
361
370
371+#### Examples
362
372
363−Examples
373+```
364−--------
365−
366 > `@t`(scan "+" ;~(pose lus tar cen))
374 > `@t`(scan "+" ;~(pose lus tar cen))
367 '+'
375 '+'
376+
368 > `@t`(scan "*" ;~(pose lus tar cen))
377 > `@t`(scan "*" ;~(pose lus tar cen))
369 '*'
378 '*'
379+
370 > `@t`(scan "%" ;~(pose lus tar cen))
380 > `@t`(scan "%" ;~(pose lus tar cen))
371 '%'
381 '%'
382+
372 > `@t`(scan "-" ;~(pose lus tar cen))
383 > `@t`(scan "-" ;~(pose lus tar cen))
373 ! {1 1}
384 ! {1 1}
374 ! exit
385 ! exit
386+```
375
387
376
388
377−
389+---
378−***
379### `++sfix`
390### `++sfix`
380
391
381Discard second rule
392Discard second rule
@@ -383,37 +394,36 @@ Discard second rule
383Parsing composer: connects `++edge`s `vex` with two subsequent `++rule`s returning the
394Parsing composer: connects `++edge`s `vex` with two subsequent `++rule`s returning the
384result of the first and discarding the result of the second.
395result of the first and discarding the result of the second.
385
396
386−Accepts
397+#### Accepts
387−-------
388
398
389`a` is the result of parsing the first `++rule`.
399`a` is the result of parsing the first `++rule`.
390
400
391`b` is the result of of parsing the second `++rule`.
401`b` is the result of of parsing the second `++rule`.
392
402
393−Produces
403+#### Produces
394−--------
395
404
396
405
397
406
398−Source
407+#### Source
399−------
400
408
409+```
401 ++ sfix :: discard second rule
410 ++ sfix :: discard second rule
402 ~/ %sfix
411 ~/ %sfix
403 (comp |*({a/* b/*} a))
412 (comp |*({a/* b/*} a))
413+```
404
414
415+#### Examples
405
416
406−Examples
417+```
407−--------
408−
409 > `@t`(scan "him%" ;~(sfix sym cen))
418 > `@t`(scan "him%" ;~(sfix sym cen))
410 'him'
419 'him'
420+
411 > (scan "10+++" ;~(sfix dem (star lus)))
421 > (scan "10+++" ;~(sfix dem (star lus)))
412 q=10
422 q=10
423+```
413
424
414
425
415−
426+---
416−***
417### `++simu`
427### `++simu`
418
428
419First and second
429First and second
@@ -421,21 +431,19 @@ First and second
421Parsing composer: if an `++edge` `vex` reflects a failure, fail. Otherwise,
431Parsing composer: if an `++edge` `vex` reflects a failure, fail. Otherwise,
422connect `vex` with the following `++rule`.
432connect `vex` with the following `++rule`.
423
433
424−Accepts
434+#### Accepts
425−-------
426
435
427`sab` is a `++rule`.
436`sab` is a `++rule`.
428
437
429`vex` is an `++edge`.
438`vex` is an `++edge`.
430
439
431−Produces
440+#### Produces
432−--------
433
441
434
442
435
443
436−Source
444+#### Source
437−------
438
445
446+```
439 ++ simu :: first and second
447 ++ simu :: first and second
440 |* {vex/edge sab/rule}
448 |* {vex/edge sab/rule}
441 ?~ q.vex
449 ?~ q.vex
@@ -443,20 +451,24 @@ Source
443 =+ roq=(sab)
451 =+ roq=(sab)
444 roq
452 roq
445 ::
453 ::
454+```
446
455
447−Examples
456+#### Examples
448−--------
449
457
458+```
450 > (scan "~zod" scat:vast)
459 > (scan "~zod" scat:vast)
451 [%dtzy p=%p q=0]
460 [%dtzy p=%p q=0]
461+
452 > (scan "%zod" scat:vast)
462 > (scan "%zod" scat:vast)
453 [%dtzz p=%tas q=6.582.138]
463 [%dtzz p=%tas q=6.582.138]
464+
454 > (scan "%zod" ;~(simu cen scat:vast))
465 > (scan "%zod" ;~(simu cen scat:vast))
455 [%dtzz p=%tas q=6.582.138]
466 [%dtzz p=%tas q=6.582.138]
467+
456 > (scan "~zod" ;~(simu cen scat:vast))
468 > (scan "~zod" ;~(simu cen scat:vast))
457 ! {1 1}
469 ! {1 1}
458 ! exit
470 ! exit
471+```
459
472
460
473
461−
474+---
462−***
docs/reference/library/4f.umd+289−268
@@ -1,29 +1,31 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'33'
3+ title/'4f: Parsing (Rule-Builders)'
4+ ==
5+
6+;>
4
7
5
8
6# 4f: parsing (rule builders)
9# 4f: parsing (rule builders)
10+
7### `++bass`
11### `++bass`
8
12
9Parser modifier: LSB
13Parser modifier: LSB
10ordered `++list` as atom of a `++base`.
14ordered `++list` as atom of a `++base`.
11
15
12−Accepts
16+#### Accepts
13−-------
14
17
15`wuc` is an atom.
18`wuc` is an atom.
16
19
17`tyd` is a `++rule`.
20`tyd` is a `++rule`.
18
21
19−Produces
22+#### Produces
20−--------
21
23
22A `++rule`.
24A `++rule`.
23
25
24−Source
26+#### Source
25−------
26
27
28+```
27 ++ bass
29 ++ bass
28 |* {wuc/@ tyd/rule}
30 |* {wuc/@ tyd/rule}
29 %+ cook
31 %+ cook
@@ -33,21 +35,21 @@ Source
33 =|({p/@ q/@} |.((add p (mul wuc q))))
35 =|({p/@ q/@} |.((add p (mul wuc q))))
34 tyd
36 tyd
35 ::
37 ::
38+```
36
39
40+#### Examples
37
41
38−Examples
42+```
39−--------
40−
41 > (scan "123" (bass 10 (star dit)))
43 > (scan "123" (bass 10 (star dit)))
42 q=123
44 q=123
43 > (scan "123" (bass 8 (star dit)))
45 > (scan "123" (bass 8 (star dit)))
44 q=83
46 q=83
45 > `@ub`(scan "123" (bass 8 (star dit)))
47 > `@ub`(scan "123" (bass 8 (star dit)))
46 0b101.0011
48 0b101.0011
49+```
47
50
48
51
49−
52+---
50−***
51
53
52### `++boss`
54### `++boss`
53
55
@@ -55,21 +57,19 @@ Parser modifier: LSB
55
57
56Ordered `++list` as atom of a `++base`.
58Ordered `++list` as atom of a `++base`.
57
59
58−Accepts
60+#### Accepts
59−-------
60
61
61`wuc` is an atom.
62`wuc` is an atom.
62
63
63`tyd` is a `++rule`.
64`tyd` is a `++rule`.
64
65
65−Produces
66+#### Produces
66−--------
67
67
68A `++rule`.
68A `++rule`.
69
69
70−Source
70+#### Source
71−------
72
71
72+```
73 ++ boss
73 ++ boss
74 |* {wuc/@ tyd/rule}
74 |* {wuc/@ tyd/rule}
75 %+ cook
75 %+ cook
@@ -79,19 +79,22 @@ Source
79 =|({p/@ q/@} |.((add p (mul wuc q))))
79 =|({p/@ q/@} |.((add p (mul wuc q))))
80 tyd
80 tyd
81 ::
81 ::
82+```
83+
84+#### Examples
82
85
83−Examples
86+```
84−--------
85−
86 > (scan "123" (boss 10 (star dit)))
87 > (scan "123" (boss 10 (star dit)))
87 q=321
88 q=321
89+
88 > `@t`(scan "bam" (boss 256 (star alp)))
90 > `@t`(scan "bam" (boss 256 (star alp)))
89 'bam'
91 'bam'
92+
90 > `@ux`(scan "bam" (boss 256 (star alp)))
93 > `@ux`(scan "bam" (boss 256 (star alp)))
91 0x6d.6162
94 0x6d.6162
95+```
92
96
93−
97+---
94−***
95### `++cold`
98### `++cold`
96
99
97Replace with constant
100Replace with constant
@@ -99,21 +102,19 @@ Replace with constant
99Parser modifier. Accepts a `++rule` `sef` and produces a parser that
102Parser modifier. Accepts a `++rule` `sef` and produces a parser that
100produces a constant `cus`, assuming `sef` is successful.
103produces a constant `cus`, assuming `sef` is successful.
101
104
102−Accepts
105+#### Accepts
103−-------
104
106
105`cus` is a constant noun.
107`cus` is a constant noun.
106
108
107`sef` is a `++rule`.
109`sef` is a `++rule`.
108
110
109−Produces
111+#### Produces
110−--------
111
112
112An `++edge`.
113An `++edge`.
113
114
114−Source
115+#### Source
115−------
116
116
117+```
117 ++ cold :: replace w+ constant
118 ++ cold :: replace w+ constant
118 ~/ %cold
119 ~/ %cold
119 |* {cus/* sef/rule}
120 |* {cus/* sef/rule}
@@ -123,18 +124,20 @@ Source
123 ?~ q.vex
124 ?~ q.vex
124 vex
125 vex
125 [p=p.vex q=[~ u=[p=cus q=q.u.q.vex]]]
126 [p=p.vex q=[~ u=[p=cus q=q.u.q.vex]]]
127+```
126
128
127−Examples
129+#### Examples
128−--------
129
130
131+```
130 > ((cold %foo (just 'a')) [[1 1] "abc"])
132 > ((cold %foo (just 'a')) [[1 1] "abc"])
131 [p=[p=1 q=2] q=[~ u=[p=%foo q=[p=[p=1 q=2] q="bc"]]]]
133 [p=[p=1 q=2] q=[~ u=[p=%foo q=[p=[p=1 q=2] q="bc"]]]]
134+
132 > ((cold %foo (just 'a')) [[1 1] "bc"])
135 > ((cold %foo (just 'a')) [[1 1] "bc"])
133 [p=[p=1 q=1] q=~]
136 [p=[p=1 q=1] q=~]
137+```
134
138
135
139
136−
140+---
137−***
138### `++cook`
141### `++cook`
139
142
140Apply gate
143Apply gate
@@ -142,21 +145,19 @@ Apply gate
142Parser modifier. Produces a parser that takes a (successful) result of a
145Parser modifier. Produces a parser that takes a (successful) result of a
143`++rule` `sef` and slams it through `poq`.
146`++rule` `sef` and slams it through `poq`.
144
147
145−Accepts
148+#### Accepts
146−-------
147
149
148`poq` is a gate.
150`poq` is a gate.
149
151
150`sef` is a `++rule`.
152`sef` is a `++rule`.
151
153
152−Produces
154+#### Produces
153−--------
154
155
155An `++rule`.
156An `++rule`.
156
157
157−Source
158+#### Source
158−------
159
159
160+```
160 ++ cook :: apply gate
161 ++ cook :: apply gate
161 ~/ %cook
162 ~/ %cook
162 |* {poq/gate sef/rule}
163 |* {poq/gate sef/rule}
@@ -167,22 +168,26 @@ Source
167 vex
168 vex
168 [p=p.vex q=[~ u=[p=(poq p.u.q.vex) q=q.u.q.vex]]]
169 [p=p.vex q=[~ u=[p=(poq p.u.q.vex) q=q.u.q.vex]]]
169 ::
170 ::
171+```
170
172
171−Examples
173+#### Examples
172−--------
173
174
175+```
174 > ((cook ,@ud (just 'a')) [[1 1] "abc"])
176 > ((cook ,@ud (just 'a')) [[1 1] "abc"])
175 [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]]
177 [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]]
178+
176 > ((cook ,@tas (just 'a')) [[1 1] "abc"])
179 > ((cook ,@tas (just 'a')) [[1 1] "abc"])
177 [p=[p=1 q=2] q=[~ u=[p=%a q=[p=[p=1 q=2] q="bc"]]]]
180 [p=[p=1 q=2] q=[~ u=[p=%a q=[p=[p=1 q=2] q="bc"]]]]
181+
178 > ((cook |=(a=@ +(a)) (just 'a')) [[1 1] "abc"])
182 > ((cook |=(a=@ +(a)) (just 'a')) [[1 1] "abc"])
179 [p=[p=1 q=2] q=[~ u=[p=98 q=[p=[p=1 q=2] q="bc"]]]]
183 [p=[p=1 q=2] q=[~ u=[p=98 q=[p=[p=1 q=2] q="bc"]]]]
184+
180 > ((cook |=(a=@ `@t`+(a)) (just 'a')) [[1 1] "abc"])
185 > ((cook |=(a=@ `@t`+(a)) (just 'a')) [[1 1] "abc"])
181 [p=[p=1 q=2] q=[~ u=[p='b' q=[p=[p=1 q=2] q="bc"]]]]
186 [p=[p=1 q=2] q=[~ u=[p='b' q=[p=[p=1 q=2] q="bc"]]]]
187+```
182
188
183
189
184−
190+---
185−***
186### `++easy`
191### `++easy`
187
192
188Always parse
193Always parse
@@ -190,19 +195,17 @@ Always parse
190Parser generator. Produces a parser that succeeds with given noun `huf`
195Parser generator. Produces a parser that succeeds with given noun `huf`
191without consuming any text.
196without consuming any text.
192
197
193−Accepts
198+#### Accepts
194−-------
195
199
196`huf` is a noun.
200`huf` is a noun.
197
201
198−Produces
202+#### Produces
199−--------
200
203
201A `++rule`.
204A `++rule`.
202
205
203−Source
206+#### Source
204−------
205
207
208+```
206 ++ easy :: always parse
209 ++ easy :: always parse
207 ~/ %easy
210 ~/ %easy
208 |* huf=*
211 |* huf=*
@@ -211,20 +214,23 @@ Source
211 ^- (like ,_huf)
214 ^- (like ,_huf)
212 [p=p.tub q=[~ u=[p=huf q=tub]]]
215 [p=p.tub q=[~ u=[p=huf q=tub]]]
213 ::
216 ::
217+```
214
218
215−Examples
219+#### Examples
216−--------
217
220
221+```
218 > ((easy %foo) [[1 1] "abc"])
222 > ((easy %foo) [[1 1] "abc"])
219 [p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="abc"]]]]
223 [p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="abc"]]]]
224+
220 > ((easy %foo) [[1 1] "bc"])
225 > ((easy %foo) [[1 1] "bc"])
221 [p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="bc"]]]]
226 [p=[p=1 q=1] q=[~ [p=%foo q=[p=[p=1 q=1] q="bc"]]]]
227+
222 > ((easy 'a') [[1 1] "bc"])
228 > ((easy 'a') [[1 1] "bc"])
223 [p=[p=1 q=1] q=[~ [p='a' q=[p=[p=1 q=1] q="bc"]]]]
229 [p=[p=1 q=1] q=[~ [p='a' q=[p=[p=1 q=1] q="bc"]]]]
230+```
224
231
225
232
226−
233+---
227−***
228### `++full`
234### `++full`
229
235
230Parse to end
236Parse to end
@@ -232,76 +238,77 @@ Parse to end
232Parser modifier. Accepts a `++rule` `sef`, and produces a parser that succeeds only
238Parser modifier. Accepts a `++rule` `sef`, and produces a parser that succeeds only
233when the of `tub` is fully consumed using `sef`.
239when the of `tub` is fully consumed using `sef`.
234
240
235−Accepts
241+#### Accepts
236−-------
237
242
238`sef` is a `++rule`.
243`sef` is a `++rule`.
239
244
240−Produces
245+#### Produces
241−--------
242
246
243A `++rule`.
247A `++rule`.
244
248
245−Source
249+#### Source
246−------
247
250
251+```
248− ++ full :: parse to end
252+ ++ full :: parse to end
249 |* sef=_rule
253 |* sef=_rule
250 |= tub=nail
254 |= tub=nail
251 =+ vex=(sef tub)
255 =+ vex=(sef tub)
252 ?~(q.vex vex ?:(=(~ q.q.u.q.vex) vex [p=p.vex q=~]))
256 ?~(q.vex vex ?:(=(~ q.q.u.q.vex) vex [p=p.vex q=~]))
253 ::
257 ::
258+```
254
259
255−Examples
260+#### Examples
256−--------
257
261
262+```
258 > ((full (just 'a')) [[1 1] "ab"])
263 > ((full (just 'a')) [[1 1] "ab"])
259 [p=[p=1 q=2] q=~]
264 [p=[p=1 q=2] q=~]
265+
260 > ((full (jest 'ab')) [[1 1] "ab"])
266 > ((full (jest 'ab')) [[1 1] "ab"])
261 [p=[p=1 q=3] q=[~ u=[p='ab' q=[p=[p=1 q=3] q=""]]]]
267 [p=[p=1 q=3] q=[~ u=[p='ab' q=[p=[p=1 q=3] q=""]]]]
268+
262 > ((full ;~(plug (just 'a') (just 'b'))) [[1 1] "ab"])
269 > ((full ;~(plug (just 'a') (just 'b'))) [[1 1] "ab"])
263 [p=[p=1 q=3] q=[~ u=[p=[~~a ~~b] q=[p=[p=1 q=3] q=""]]]]
270 [p=[p=1 q=3] q=[~ u=[p=[~~a ~~b] q=[p=[p=1 q=3] q=""]]]]
271+```
264
272
265
273
266−
274+---
267−***
268### `++funk`
275### `++funk`
269
276
270Add to tape
277Add to tape
271
278
272Parser modifier: prepend text to `++tape` before applying parser.
279Parser modifier: prepend text to `++tape` before applying parser.
273
280
274−Accepts
281+#### Accepts
275−-------
276
282
277`pre` is a `++tape`
283`pre` is a `++tape`
278
284
279`sef` is a `++rule`
285`sef` is a `++rule`
280
286
281−Produces
287+#### Produces
282−--------
283
288
284A `++rule`.
289A `++rule`.
285
290
286−Source
291+#### Source
287−------
288
292
293+```
289 ++ funk :: add to tape first
294 ++ funk :: add to tape first
290 |* {pre/tape sef/rule}
295 |* {pre/tape sef/rule}
291 |= tub/nail
296 |= tub/nail
292 (sef p.tub (weld pre q.tub))
297 (sef p.tub (weld pre q.tub))
298+```
293
299
294−Examples
300+#### Examples
295−--------
296
301
302+```
297 > ((funk "abc prefix-" (jest 'abc')) [[1 1] "to be parsed"])
303 > ((funk "abc prefix-" (jest 'abc')) [[1 1] "to be parsed"])
298 [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=" prefix-to be parsed"]]]]
304 [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=" prefix-to be parsed"]]]]
305+
299 > ((funk "parse" (just 'a')) [[1 4] " me"])
306 > ((funk "parse" (just 'a')) [[1 4] " me"])
300 [p=[p=1 q=4] q=~]
307 [p=[p=1 q=4] q=~]
308+```
301
309
302
310
303−
311+---
304−***
305### `++here`
312### `++here`
306
313
307Place-based apply
314Place-based apply
@@ -310,21 +317,19 @@ Parser modifier. Similar to `++cook` in that it produces a parser that takes a
310(successful) result of `sef` and slams it through `hez`. `hez` accepts a
317(successful) result of `sef` and slams it through `hez`. `hez` accepts a
311`++pint` `a` and a noun `b`, which is what the parser parsed.
318`++pint` `a` and a noun `b`, which is what the parser parsed.
312
319
313−Accepts
320+#### Accepts
314−-------
315
321
316`hez` is a gate.
322`hez` is a gate.
317
323
318`sef` is a `++rule`
324`sef` is a `++rule`
319
325
320−Produces
326+#### Produces
321−--------
322
327
323A `++rule`.
328A `++rule`.
324
329
325−Source
330+#### Source
326−------
327
331
332+```
328 ++ here :: place-based apply
333 ++ here :: place-based apply
329 ~/ %here
334 ~/ %here
330 |* {hez/_|=({a/pint b/*} [a b]) sef/rule}
335 |* {hez/_|=({a/pint b/*} [a b]) sef/rule}
@@ -335,20 +340,23 @@ Source
335 vex
340 vex
336 [p=p.vex q=[~ u=[p=(hez [p.tub p.q.u.q.vex] p.u.q.vex) q=q.u.q.vex]]]
341 [p=p.vex q=[~ u=[p=(hez [p.tub p.q.u.q.vex] p.u.q.vex) q=q.u.q.vex]]]
337 ::
342 ::
343+```
338
344
339−Examples
345+#### Examples
340−--------
341
346
347+```
342 > (scan "abc" (star alf))
348 > (scan "abc" (star alf))
343 "abc"
349 "abc"
350+
344 > (scan "abc" (here |*(^ +<) (star alf)))
351 > (scan "abc" (here |*(^ +<) (star alf)))
345 [[[p=1 q=1] p=1 q=4] "abc"]
352 [[[p=1 q=1] p=1 q=4] "abc"]
353+
346 > (scan "abc" (star (here |*(^ +<) alf)))
354 > (scan "abc" (star (here |*(^ +<) alf)))
347 ~[[[[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]]
355 ~[[[[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+```
348
357
349
358
350−
359+---
351−***
352### `++ifix`
360### `++ifix`
353
361
354Infix
362Infix
@@ -356,21 +364,19 @@ Infix
356Parser modifier: surround with pair of `++rule`s, the output of which is
364Parser modifier: surround with pair of `++rule`s, the output of which is
357discarded.
365discarded.
358
366
359−Accepts
367+#### Accepts
360−-------
361
368
362`fel` is a pair of `++rule`s.
369`fel` is a pair of `++rule`s.
363
370
364`hof` is a `++rule`.
371`hof` is a `++rule`.
365
372
366−Produces
373+#### Produces
367−--------
368
374
369A `++rule`.
375A `++rule`.
370
376
371−Source
377+#### Source
372−------
373
378
379+```
374 ++ ifix
380 ++ ifix
375 |* {fel/{rule rule} hof/rule}
381 |* {fel/{rule rule} hof/rule}
376 ~! +<
382 ~! +<
@@ -378,37 +384,37 @@ Source
378 ~! +<:+.fel
384 ~! +<:+.fel
379 ;~(pfix -.fel ;~(sfix hof +.fel))
385 ;~(pfix -.fel ;~(sfix hof +.fel))
380 ::
386 ::
387+```
388+
389+#### Examples
381
390
382−Examples
391+```
383−--------
384−
385 > (scan "-40-" (ifix [hep hep] dem))
392 > (scan "-40-" (ifix [hep hep] dem))
386 q=40
393 q=40
394+
387 > (scan "4my4" (ifix [dit dit] (star alf)))
395 > (scan "4my4" (ifix [dit dit] (star alf)))
388 "my"
396 "my"
397+```
389
398
390
399
391−
400+---
392−***
393### `++jest`
401### `++jest`
394
402
395Match a cord
403Match a cord
396
404
397Match and consume a cord.
405Match and consume a cord.
398
406
399−Accepts
407+#### Accepts
400−-------
401
408
402`daf` is a `@t`.
409`daf` is a `@t`.
403
410
404−Produces
411+#### Produces
405−--------
406
412
407An `++edge`.
413An `++edge`.
408
414
409−Source
415+#### Source
410−------
411
416
417+```
412 ++ jest :: match a cord
418 ++ jest :: match a cord
413 |= daf/@t
419 |= daf/@t
414 |= tub/nail
420 |= tub/nail
@@ -420,45 +426,48 @@ Source
420 (fail tub)
426 (fail tub)
421 $(p.tub (lust i.q.tub p.tub), q.tub t.q.tub, daf (rsh 3 1 daf))
427 $(p.tub (lust i.q.tub p.tub), q.tub t.q.tub, daf (rsh 3 1 daf))
422 ::
428 ::
429+```
423
430
424−Examples
431+#### Examples
425−--------
426
432
433+```
427 > ((jest 'abc') [[1 1] "abc"])
434 > ((jest 'abc') [[1 1] "abc"])
428 [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=""]]]]
435 [p=[p=1 q=4] q=[~ [p='abc' q=[p=[p=1 q=4] q=""]]]]
436+
429 > (scan "abc" (jest 'abc'))
437 > (scan "abc" (jest 'abc'))
430 'abc'
438 'abc'
439+
431 > (scan "abc" (jest 'acb'))
440 > (scan "abc" (jest 'acb'))
432 ! {1 2}
441 ! {1 2}
433 ! 'syntax-error'
442 ! 'syntax-error'
434 ! exit
443 ! exit
444+
435 > ((jest 'john doe') [[1 1] "john smith"])
445 > ((jest 'john doe') [[1 1] "john smith"])
436 [p=[p=1 q=6] q=~]
446 [p=[p=1 q=6] q=~]
447+
437 > ((jest 'john doe') [[1 1] "john doe"])
448 > ((jest 'john doe') [[1 1] "john doe"])
438 [p=[p=1 q=9] q=[~ [p='john doe' q=[p=[p=1 q=9] q=""]]]]
449 [p=[p=1 q=9] q=[~ [p='john doe' q=[p=[p=1 q=9] q=""]]]]
450+```
439
451
440
452
441−
453+---
442−***
443### `++just`
454### `++just`
444
455
445Match a char
456Match a char
446
457
447Match and consume a single character.
458Match and consume a single character.
448
459
449−Accepts
460+#### Accepts
450−-------
451
461
452`daf` is a `++char`
462`daf` is a `++char`
453
463
454−Produces
464+#### Produces
455−--------
456
465
457A `++rule`.
466A `++rule`.
458
467
459−Source
468+#### Source
460−------
461
469
470+```
462 ++ just :: XX redundant, jest
471 ++ just :: XX redundant, jest
463 ~/ %just :: match a char
472 ~/ %just :: match a char
464 |= daf/char
473 |= daf/char
@@ -471,25 +480,28 @@ Source
471 (fail tub)
480 (fail tub)
472 (next tub)
481 (next tub)
473 ::
482 ::
483+```
474
484
485+#### Examples
475
486
476−Examples
487+```
477−--------
478−
479 > ((just 'a') [[1 1] "abc"])
488 > ((just 'a') [[1 1] "abc"])
480 [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
489 [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
490+
481 > (scan "abc" (just 'a'))
491 > (scan "abc" (just 'a'))
482 ! {1 2}
492 ! {1 2}
483 ! 'syntax-error'
493 ! 'syntax-error'
484 ! exit
494 ! exit
495+
485 > (scan "a" (just 'a'))
496 > (scan "a" (just 'a'))
497+
486 ~~a
498 ~~a
487 > (scan "%" (just '%'))
499 > (scan "%" (just '%'))
488 ~~~25.
500 ~~~25.
501+```
489
502
490
503
491−
504+---
492−***
493### `++knee`
505### `++knee`
494
506
495Recursive parsers
507Recursive parsers
@@ -497,34 +509,34 @@ Recursive parsers
497Used for recursive parsers, which would otherwise be infinite when
509Used for recursive parsers, which would otherwise be infinite when
498compiled.
510compiled.
499
511
500−Accepts
512+#### Accepts
501−-------
502
513
503`gar` is a noun.
514`gar` is a noun.
504
515
505`sef` is a gate that accepts a `++rule`
516`sef` is a gate that accepts a `++rule`
506
517
507−Produces
518+#### Produces
508−--------
509
519
510A `++rule`.
520A `++rule`.
511
521
512−Source
522+#### Source
513−------
514
523
524+```
515 ++ knee :: callbacks
525 ++ knee :: callbacks
516 |* {gar/* sef/_|.(*rule)}
526 |* {gar/* sef/_|.(*rule)}
517 |= tub/nail
527 |= tub/nail
518 ^- (like _gar)
528 ^- (like _gar)
519 ((sef) tub)
529 ((sef) tub)
520 ::
530 ::
531+```
521
532
522−Examples
533+#### Examples
523−--------
524
534
535+```
525 > |-(;~(plug prn ;~(pose $ (easy ~))))
536 > |-(;~(plug prn ;~(pose $ (easy ~))))
526 ! rest-loop
537 ! rest-loop
527 ! exit
538 ! exit
539+
528 > |-(;~(plug prn ;~(pose (knee *tape |.(^$)) (easy ~))))
540 > |-(;~(plug prn ;~(pose (knee *tape |.(^$)) (easy ~))))
529 < 1.obo
541 < 1.obo
530 [ c=c=tub=[p=[p=@ud q=@ud] q=""]
542 [ c=c=tub=[p=[p=@ud q=@ud] q=""]
@@ -542,10 +554,10 @@ Examples
542 >
554 >
543 > (scan "abcd" |-(;~(plug prn ;~(pose (knee *tape |.(^$)) (easy ~)))))
555 > (scan "abcd" |-(;~(plug prn ;~(pose (knee *tape |.(^$)) (easy ~)))))
544 [~~a "bcd"]
556 [~~a "bcd"]
557+```
545
558
546
559
547−
560+---
548−***
549### `++mask`
561### `++mask`
550
562
551Match char
563Match char
@@ -553,19 +565,17 @@ Match char
553Parser generator. Matches the next character if it is in a list of
565Parser generator. Matches the next character if it is in a list of
554characters.
566characters.
555
567
556−Accepts
568+#### Accepts
557−-------
558
569
559`bud` is a list of `++char`
570`bud` is a list of `++char`
560
571
561−Produces
572+#### Produces
562−--------
563
573
564A `++rule`.
574A `++rule`.
565
575
566−Source
576+#### Source
567−------
568
577
578+```
569 ++ mask :: match char in set
579 ++ mask :: match char in set
570 ~/ %mask
580 ~/ %mask
571 |= bud/(list char)
581 |= bud/(list char)
@@ -578,120 +588,123 @@ Source
578 (fail tub)
588 (fail tub)
579 (next tub)
589 (next tub)
580 ::
590 ::
591+```
581
592
582−Examples
593+#### Examples
583−--------
584
594
595+```
585 > (scan "a" (mask "cba"))
596 > (scan "a" (mask "cba"))
586 ~~a
597 ~~a
598+
587 > ((mask "abc") [[1 1] "abc"])
599 > ((mask "abc") [[1 1] "abc"])
588 [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
600 [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
601+
589 > ((mask "abc") [[1 1] "bbc"])
602 > ((mask "abc") [[1 1] "bbc"])
590 [p=[p=1 q=2] q=[~ [p=~~b q=[p=[p=1 q=2] q="bc"]]]]
603 [p=[p=1 q=2] q=[~ [p=~~b q=[p=[p=1 q=2] q="bc"]]]]
604+
591 > ((mask "abc") [[1 1] "dbc"])
605 > ((mask "abc") [[1 1] "dbc"])
592 [p=[p=1 q=1] q=~]
606 [p=[p=1 q=1] q=~]
607+```
593
608
594−
609+---
595−
596−***
597### `++more`
610### `++more`
598
611
599Parse list with delimiter
612Parse list with delimiter
600
613
601Parser modifier: Parse a list of matches using a delimiter `++rule`.
614Parser modifier: Parse a list of matches using a delimiter `++rule`.
602
615
603−Accepts
616+#### Accepts
604−-------
605
617
606`bus` is a `++rule`.
618`bus` is a `++rule`.
607
619
608`fel` is a `++rule`.
620`fel` is a `++rule`.
609
621
610−Produces
622+#### Produces
611−--------
612
623
613A `++rule`.
624A `++rule`.
614
625
615−Source
626+#### Source
616−------
617
627
628+```
618 ++ more
629 ++ more
619 |* {bus/rule fel/rule}
630 |* {bus/rule fel/rule}
620 ;~(pose (most bus fel) (easy ~))
631 ;~(pose (most bus fel) (easy ~))
621 ::
632 ::
633+```
634+
635+#### Examples
622
636
623−Examples
637+```
624−--------
625−
626 > (scan "" (more ace dem))
638 > (scan "" (more ace dem))
627 ~
639 ~
640+
628 > (scan "40 20" (more ace dem))
641 > (scan "40 20" (more ace dem))
629 [q=40 ~[q=20]]
642 [q=40 ~[q=20]]
643+
630 > (scan "40 20 60 1 5" (more ace dem))
644 > (scan "40 20 60 1 5" (more ace dem))
631 [q=40 ~[q=20 q=60 q=1 q=5]]
645 [q=40 ~[q=20 q=60 q=1 q=5]]
646+```
632
647
633
648
634−
649+---
635−***
636### `++most`
650### `++most`
637
651
638Parse list of at least one match
652Parse list of at least one match
639
653
640Parser modifier: parse a `++list` of at least one match using a delimiter `++rule`.
654Parser modifier: parse a `++list` of at least one match using a delimiter `++rule`.
641
655
642−Accepts
656+#### Accepts
643−-------
644
657
645`bus` is a `++rule`.
658`bus` is a `++rule`.
646
659
647`fel` is a `++rule`.
660`fel` is a `++rule`.
648
661
649−Produces
662+#### Produces
650−--------
651
663
652A `++rule`.
664A `++rule`.
653
665
654−Source
666+#### Source
655−------
656
667
668+```
657 ++ most
669 ++ most
658 |* {bus/rule fel/rule}
670 |* {bus/rule fel/rule}
659 ;~(plug fel (star ;~(pfix bus fel)))
671 ;~(plug fel (star ;~(pfix bus fel)))
660 ::
672 ::
673+```
674+
675+#### Examples
661
676
662−Examples
677+```
663−--------
664−
665 > (scan "40 20" (most ace dem))
678 > (scan "40 20" (most ace dem))
666 [q=40 ~[q=20]]
679 [q=40 ~[q=20]]
680+
667 > (scan "40 20 60 1 5" (most ace dem))
681 > (scan "40 20 60 1 5" (most ace dem))
668 [q=40 ~[q=20 q=60 q=1 q=5]]
682 [q=40 ~[q=20 q=60 q=1 q=5]]
683+
669 > (scan "" (most ace dem))
684 > (scan "" (most ace dem))
670 ! {1 1}
685 ! {1 1}
671 ! exit
686 ! exit
687+```
672
688
673
689
674−
690+---
675−***
676### `++next`
691### `++next`
677
692
678Consume char
693Consume char
679
694
680Consume any character, producing it as a result.
695Consume any character, producing it as a result.
681
696
682−Accepts
697+#### Accepts
683−-------
684
698
685`tub` is a `++nail`
699`tub` is a `++nail`
686
700
687−Produces
701+#### Produces
688−--------
689
702
690An `++edge`.
703An `++edge`.
691
704
692−Source
705+#### Source
693−------
694
706
707+```
695 ++ next :: consume a char
708 ++ next :: consume a char
696 |= tub/nail
709 |= tub/nail
697 ^- (like char)
710 ^- (like char)
@@ -700,18 +713,20 @@ Source
700 =+ zac=(lust i.q.tub p.tub)
713 =+ zac=(lust i.q.tub p.tub)
701 [zac [~ i.q.tub [zac t.q.tub]]]
714 [zac [~ i.q.tub [zac t.q.tub]]]
702 ::
715 ::
716+```
703
717
704−Examples
718+#### Examples
705−--------
706
719
720+```
707 > (next [[1 1] "ebc"])
721 > (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+
709 > (next [[1 1] "john jumps jones"])
724 > (next [[1 1] "john jumps jones"])
710 [p=[p=1 q=2] q=[~ [p=~~j q=[p=[p=1 q=2] q="ohn jumps jones"]]]]
725 [p=[p=1 q=2] q=[~ [p=~~j q=[p=[p=1 q=2] q="ohn jumps jones"]]]]
726+```
711
727
712
728
713−
729+---
714−***
715
730
716### `++plus`
731### `++plus`
717
732
@@ -719,37 +734,38 @@ List of at least one match.
719
734
720Parser modifier: parse `++list` of at least one match.
735Parser modifier: parse `++list` of at least one match.
721
736
722−Accepts
737+#### Accepts
723−-------
724
738
725`fel` is a `++rule`.
739`fel` is a `++rule`.
726
740
727−Produces
741+#### Produces
728−--------
729
742
730A `++rule`.
743A `++rule`.
731
744
732−Source
745+#### Source
733−------
734
746
747+```
735 ++ plus |*(fel/rule ;~(plug fel (star fel)))
748 ++ plus |*(fel/rule ;~(plug fel (star fel)))
749+```
736
750
751+#### Examples
737
752
738−Examples
753+```
739−--------
740−
741 > (scan ">>>>" (cook lent (plus gar)))
754 > (scan ">>>>" (cook lent (plus gar)))
742 4
755 4
756+
743 > (scan "- - " (plus ;~(pose ace hep)))
757 > (scan "- - " (plus ;~(pose ace hep)))
744 [~~- " - "]
758 [~~- " - "]
759+
745 > `tape`(scan "- - " (plus ;~(pose ace hep)))
760 > `tape`(scan "- - " (plus ;~(pose ace hep)))
746 "- - "
761 "- - "
762+
747 > `(pole ,@t)`(scan "- - " (plus ;~(pose ace hep)))
763 > `(pole ,@t)`(scan "- - " (plus ;~(pose ace hep)))
748 ['-' [' ' [' ' ['-' [' ' ~]]]]]
764 ['-' [' ' [' ' ['-' [' ' ~]]]]]
765+```
749
766
750
767
751−
768+---
752−***
753### `++sear`
769### `++sear`
754
770
755Conditional `++cook`
771Conditional `++cook`
@@ -757,19 +773,17 @@ Conditional `++cook`
757Conditional `++cook`. Slams the result through a gate that produces
773Conditional `++cook`. Slams the result through a gate that produces
758a unit; if that unit is empty, fail.
774a unit; if that unit is empty, fail.
759
775
760−Accepts
776+#### Accepts
761−-------
762
777
763`tub` is a `++nail`.
778`tub` is a `++nail`.
764
779
765−Produces
780+#### Produces
766−--------
767
781
768A `++rule`.
782A `++rule`.
769
783
770−Source
784+#### Source
771−------
772
785
786+```
773 ++ sear :: conditional cook
787 ++ sear :: conditional cook
774 |* {pyq/$-(* (unit)) sef/rule}
788 |* {pyq/$-(* (unit)) sef/rule}
775 |= tub/nail
789 |= tub/nail
@@ -781,40 +795,39 @@ Source
781 [p=p.vex q=~]
795 [p=p.vex q=~]
782 [p=p.vex q=[~ u=[p=u.gey q=q.u.q.vex]]]
796 [p=p.vex q=[~ u=[p=u.gey q=q.u.q.vex]]]
783 ::
797 ::
798+```
784
799
800+#### Examples
785
801
786−Examples
802+```
787−--------
788−
789 > ((sear |=(a/* ?@(a (some a) ~)) (just `a`)) [[1 1] "abc"])
803 > ((sear |=(a/* ?@(a (some a) ~)) (just `a`)) [[1 1] "abc"])
790 [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]]
804 [p=[p=1 q=2] q=[~ u=[p=97 q=[p=[p=1 q=2] q="bc"]]]]
805+
791 > ((sear |=(* ~) (just 'a')) [[1 1] "abc"])
806 > ((sear |=(* ~) (just 'a')) [[1 1] "abc"])
792 [p=[p=1 q=2] q=~]
807 [p=[p=1 q=2] q=~]
808+```
793
809
794
810
795−
811+---
796−***
797### `++shim`
812### `++shim`
798
813
799Char in range
814Char in range
800
815
801Match characters (`++char`) within a range.
816Match characters (`++char`) within a range.
802
817
803−Accepts
818+#### Accepts
804−-------
805
819
806`les` is an atom.
820`les` is an atom.
807
821
808`mos` is an atom.
822`mos` is an atom.
809
823
810−Produces
824+#### Produces
811−--------
812
825
813A `++rule`.
826A `++rule`.
814
827
815−Source
828+#### Source
816−------
817
829
830+```
818 ++ shim :: match char in range
831 ++ shim :: match char in range
819 ~/ %shim
832 ~/ %shim
820 |= {les/@ mos/@}
833 |= {les/@ mos/@}
@@ -827,20 +840,23 @@ Source
827 (fail tub)
840 (fail tub)
828 (next tub)
841 (next tub)
829 ::
842 ::
843+```
830
844
831−Examples
845+#### Examples
832−--------
833
846
847+```
834 > ((shim 'a' 'z') [[1 1] "abc"])
848 > ((shim 'a' 'z') [[1 1] "abc"])
835 [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
849 [p=[p=1 q=2] q=[~ [p=~~a q=[p=[p=1 q=2] q="bc"]]]]
850+
836 > ((shim 'a' 'Z') [[1 1] "abc"])
851 > ((shim 'a' 'Z') [[1 1] "abc"])
837 [p=[p=1 q=1] q=~]
852 [p=[p=1 q=1] q=~]
853+
838 > ((shim 'a' 'Z') [[1 1] "Abc"])
854 > ((shim 'a' 'Z') [[1 1] "Abc"])
839 [p=[p=1 q=2] q=[~ [p=~~~41. q=[p=[p=1 q=2] q="bc"]]]]
855 [p=[p=1 q=2] q=[~ [p=~~~41. q=[p=[p=1 q=2] q="bc"]]]]
856+```
840
857
841
858
842−
859+---
843−***
844### `++slug`
860### `++slug`
845
861
846Use gate to parse delimited list
862Use gate to parse delimited list
@@ -848,60 +864,57 @@ Use gate to parse delimited list
848Parser modifier: By composing with a gate, parse a delimited `++list` of
864Parser modifier: By composing with a gate, parse a delimited `++list` of
849matches.
865matches.
850
866
851−Accepts
867+#### Accepts
852−-------
853
868
854`bus` is a `++rule`.
869`bus` is a `++rule`.
855
870
856`fel` is a `++rule`.
871`fel` is a `++rule`.
857
872
858−Produces
873+#### Produces
859−--------
860
874
861A `++rule`.
875A `++rule`.
862
876
863−Source
877+#### Source
864−------
865
878
879+```
866 ++ slug
880 ++ slug
867 |* raq/_|*({a/* b/*} [a b])
881 |* raq/_|*({a/* b/*} [a b])
868 |* {bus/rule fel/rule}
882 |* {bus/rule fel/rule}
869 ;~((comp raq) fel (stir +<+.raq raq ;~(pfix bus fel)))
883 ;~((comp raq) fel (stir +<+.raq raq ;~(pfix bus fel)))
870 ::
884 ::
885+```
871
886
887+#### Examples
872
888
873−Examples
889+```
874−--------
875−
876 > (scan "20+5+110" ((slug add) lus dem))
890 > (scan "20+5+110" ((slug add) lus dem))
877 135
891 135
892+
878 > `@t`(scan "a b c" ((slug |=(a/[@ @t] (cat 3 a))) ace alp))
893 > `@t`(scan "a b c" ((slug |=(a/[@ @t] (cat 3 a))) ace alp))
879 'abc'
894 'abc'
895+```
880
896
881
897
882−
898+---
883−***
884### `++stag`
899### `++stag`
885
900
886Add label
901Add label
887
902
888Add a label to an edge parsed by a rule.
903Add a label to an edge parsed by a rule.
889
904
890−Accepts
905+#### Accepts
891−-------
892
906
893`gob` is a noun.
907`gob` is a noun.
894
908
895`sef` is a rule.
909`sef` is a rule.
896
910
897−Produces
911+#### Produces
898−--------
899
912
900A `++rule`.
913A `++rule`.
901
914
902−Source
915+#### Source
903−------
904
916
917+```
905 ++ stag :: add a label
918 ++ stag :: add a label
906 ~/ %stag
919 ~/ %stag
907 |* {gob/* sef/rule}
920 |* {gob/* sef/rule}
@@ -912,78 +925,83 @@ Source
912 vex
925 vex
913 [p=p.vex q=[~ u=[p=[gob p.u.q.vex] q=q.u.q.vex]]]
926 [p=p.vex q=[~ u=[p=[gob p.u.q.vex] q=q.u.q.vex]]]
914 ::
927 ::
928+```
915
929
916−Examples
930+#### Examples
917−--------
918
931
932+```
919 > ((stag %foo (just 'a')) [[1 1] "abc"])
933 > ((stag %foo (just 'a')) [[1 1] "abc"])
920 [p=[p=1 q=2] q=[~ u=[p=[%foo ~~a] q=[p=[p=1 q=2] q="bc"]]]]
934 [p=[p=1 q=2] q=[~ u=[p=[%foo ~~a] q=[p=[p=1 q=2] q="bc"]]]]
935+
921 > ((stag "xyz" (jest 'abc')) [[1 1] "abc"])
936 > ((stag "xyz" (jest 'abc')) [[1 1] "abc"])
922 [p=[p=1 q=4] q=[~ u=[p=["xyz" 'abc'] q=[p=[p=1 q=4] q=""]]]]
937 [p=[p=1 q=4] q=[~ u=[p=["xyz" 'abc'] q=[p=[p=1 q=4] q=""]]]]
938+
923 > ((stag 10.000 (shim 0 100)) [[1 1] "abc"])
939 > ((stag 10.000 (shim 0 100)) [[1 1] "abc"])
924 [p=[p=1 q=2] q=[~ u=[p=[10.000 ~~a] q=[p=[p=1 q=2] q="bc"]]]]
940 [p=[p=1 q=2] q=[~ u=[p=[10.000 ~~a] q=[p=[p=1 q=2] q="bc"]]]]
941+```
925
942
926
943
927−
944+---
928−***
929### `++star`
945### `++star`
930
946
931List of matches
947List of matches
932
948
933Parser modifier: parse `++list` of matches.
949Parser modifier: parse `++list` of matches.
934
950
935−Accepts
951+#### Accepts
936−-------
937
952
938`fel` is a `++rule`.
953`fel` is a `++rule`.
939
954
940−Produces
955+#### Produces
941−--------
942
956
957+```
943 ++ star :: 0 or more times
958 ++ star :: 0 or more times
944 |* fel/rule
959 |* fel/rule
945 (stir `(list _(wonk *fel))`~ |*({a/* b/*} [a b]) fel)
960 (stir `(list _(wonk *fel))`~ |*({a/* b/*} [a b]) fel)
961+```
962+
963+#### Examples
946
964
947−Examples
965+```
948−--------
949−
950 > (scan "aaaaa" (just 'a'))
966 > (scan "aaaaa" (just 'a'))
951 ! {1 2}
967 ! {1 2}
952 ! 'syntax-error'
968 ! 'syntax-error'
953 ! exit
969 ! exit
970+
954 > (scan "aaaaa" (star (just 'a')))
971 > (scan "aaaaa" (star (just 'a')))
955 "aaaaa"
972 "aaaaa"
973+
956 > (scan "abcdef" (star (just 'a')))
974 > (scan "abcdef" (star (just 'a')))
957 ! {1 2}
975 ! {1 2}
958 ! 'syntax-error'
976 ! 'syntax-error'
959 ! exit
977 ! exit
978+
960 > (scan "abcabc" (star (jest 'abc')))
979 > (scan "abcabc" (star (jest 'abc')))
961 <|abc abc|>
980 <|abc abc|>
981+
962 > (scan "john smith" (star (shim 0 200)))
982 > (scan "john smith" (star (shim 0 200)))
963 "john smith"
983 "john smith"
984+```
964
985
965
986
966−
987+---
967−***
968### `++stet`
988### `++stet`
969
989
970Add faces
990Add faces
971
991
972Add faces `[p q]` to range-parser pairs in a list.
992Add faces `[p q]` to range-parser pairs in a list.
973
993
974−Accepts
994+#### Accepts
975−-------
976
995
977`leh` is a list of range-parsers.
996`leh` is a list of range-parsers.
978
997
979−Produces
998+#### Produces
980−--------
981
999
982
1000
983
1001
984−Source
1002+#### Source
985−------
986
1003
1004+```
987 ++ stet
1005 ++ stet
988 |* leh/(list {?(@ {@ @}) rule})
1006 |* leh/(list {?(@ {@ @}) rule})
989 |-
1007 |-
@@ -991,11 +1009,12 @@ Source
991 ~
1009 ~
992 [i=[p=-.i.leh q=+.i.leh] t=$(leh t.leh)]
1010 [i=[p=-.i.leh q=+.i.leh] t=$(leh t.leh)]
993 ::
1011 ::
1012+```
994
1013
995−Examples
1014+#### Examples
996−--------
997
1015
1016+```
998− > (stet (limo [[5 (just 'a')] [1 (jest 'abc')] [[1 1] (shim 0 200)]
1017+ > (stet (limo [[5 (just 'a')] [1 (jest 'abc')] [[1 1] (shim 0 200)]
999 [[1 10] (cold %foo (just 'a'))]~]))
1018 [[1 10] (cold %foo (just 'a'))]~]))
1000 ~[
1019 ~[
1001 [p=5 q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
1020 [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
1010 ]
1029 ]
1011 > (stet (limo [[[1 1] (just 'a')] [[2 1] (shim 0 200)] ~]))
1030 > (stet (limo [[[1 1] (just 'a')] [[2 1] (shim 0 200)] ~]))
1012 ~[
1031 ~[
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>]>]>]
1014 [p=[2 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
1033 [p=[2 1] q=<1.lrk [tub=[p=[p=@ud q=@ud] q=""] <1.nqy [daf=@tD <394.imz 97.kdz 1.xlc %164>]>]>]
1015 ]
1034 ]
1035+```
1016
1036
1017
1037
1018−
1038+---
1019−***
1020### `++stew`
1039### `++stew`
1021
1040
1022Switch by first
1041Switch by first
1023
1042
1043+```
1024 ++ stew :: switch by first char
1044 ++ stew :: switch by first char
1025 ~/ %stew
1045 ~/ %stew
1026 |* leh/(list {p/?(@ {@ @}) q/rule}) :: char+range keys
1046 |* leh/(list {p/?(@ {@ @}) q/rule}) :: char+range keys
@@ -1065,7 +1085,7 @@ Switch by first
1065 $(hel l.hel)
1085 $(hel l.hel)
1066 $(hel r.hel)
1086 $(hel r.hel)
1067 ::
1087 ::
1068−
1088+```
1069
1089
1070
1090
1071Parser generator. From an associative `++list` of characters or character
1091Parser 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
1074
1094
1075
1095
1076
1096
1077−***
1097+---
1078### `++stir`
1098### `++stir`
1079
1099
1080Parse repeatedly
1100Parse repeatedly
@@ -1082,8 +1102,7 @@ Parse repeatedly
1082Parse with `++rule` as many times as possible, and fold over results with a
1102Parse with `++rule` as many times as possible, and fold over results with a
1083binary gate.
1103binary gate.
1084
1104
1085−Accepts
1105+#### Accepts
1086−-------
1087
1106
1088`rud` is a noun.
1107`rud` is a noun.
1089
1108
@@ -1091,14 +1110,13 @@ Accepts
1091
1110
1092`fel` is a rule.
1111`fel` is a rule.
1093
1112
1094−Produces
1113+#### Produces
1095−--------
1096
1114
1097A rule.
1115A rule.
1098
1116
1099−Source
1117+#### Source
1100−------
1101
1118
1119+```
1102 ++ stun :: parse several times
1120 ++ stun :: parse several times
1103 |* {lig/{@ @} fel/rule}
1121 |* {lig/{@ @} fel/rule}
1104 |= tub/nail
1122 |= tub/nail
@@ -1118,40 +1136,39 @@ Source
1118 ?~ q.wag
1136 ?~ q.wag
1119 wag
1137 wag
1120 [p.wag [~ [p.u.q.vex p.u.q.wag] q.u.q.wag]]
1138 [p.wag [~ [p.u.q.vex p.u.q.wag] q.u.q.wag]]
1139+```
1121
1140
1141+#### Examples
1122
1142
1123−Examples
1143+```
1124−--------
1125−
1126 > (scan "abc" (stir *@ add prn))
1144 > (scan "abc" (stir *@ add prn))
1127 294
1145 294
1146+
1128 > (roll "abc" add)
1147 > (roll "abc" add)
1129 b=294
1148 b=294
1149+```
1130
1150
1131
1151
1132−
1152+---
1133−***
1134### `++stun`
1153### `++stun`
1135
1154
1136Parse several times
1155Parse several times
1137
1156
1138Parse bounded number of times.
1157Parse bounded number of times.
1139
1158
1140−Accepts
1159+#### Accepts
1141−-------
1142
1160
1143`[les=@ mos=@]` is a cell of atoms indicating the bounds.
1161`[les=@ mos=@]` is a cell of atoms indicating the bounds.
1144
1162
1145`fel` is a `++rule`.
1163`fel` is a `++rule`.
1146
1164
1147−Produces
1165+#### Produces
1148−--------
1149
1166
1150A `++rule`.
1167A `++rule`.
1151
1168
1152−Source
1169+#### Source
1153−------
1154
1170
1171+```
1155 ++ stun :: parse several times
1172 ++ stun :: parse several times
1156 |* {lig/{@ @} fel/rule}
1173 |* {lig/{@ @} fel/rule}
1157 |= tub/nail
1174 |= tub/nail
@@ -1171,15 +1188,19 @@ Source
1171 ?~ q.wag
1188 ?~ q.wag
1172 wag
1189 wag
1173 [p.wag [~ [p.u.q.vex p.u.q.wag] q.u.q.wag]]
1190 [p.wag [~ [p.u.q.vex p.u.q.wag] q.u.q.wag]]
1191+```
1174
1192
1175−Examples
1193+#### Examples
1176−--------
1177
1194
1195+```
1178 > ((stun [5 10] prn) [1 1] "aquickbrownfoxran")
1196 > ((stun [5 10] prn) [1 1] "aquickbrownfoxran")
1179 [p=[p=1 q=11] q=[~ [p="aquickbrow" q=[p=[p=1 q=11] q="nfoxran"]]]]
1197 [p=[p=1 q=11] q=[~ [p="aquickbrow" q=[p=[p=1 q=11] q="nfoxran"]]]]
1198+
1180 > ((stun [5 10] prn) [1 1] "aquickbro")
1199 > ((stun [5 10] prn) [1 1] "aquickbro")
1181 [p=[p=1 q=10] q=[~ [p="aquickbro" q=[p=[p=1 q=10] q=""]]]]
1200 [p=[p=1 q=10] q=[~ [p="aquickbro" q=[p=[p=1 q=10] q=""]]]]
1201+
1182 > ((stun [5 10] prn) [1 1] "aqui")
1202 > ((stun [5 10] prn) [1 1] "aqui")
1183 [p=[p=1 q=5] q=~]
1203 [p=[p=1 q=5] q=~]
1204+```
1184
1205
1185−***
1206+---
docs/reference/library/4g.umd+55−47
@@ -1,9 +1,13 @@
1−---
2−navhome: /docs/
1+:- :~ navhome/'/docs/'
3−---
2+ sort/'34'
3+ title/'4g: Parsing (Outside Caller)'
4+ ==
5+
6+;>
4
7
5
8
6# 4g: parsing (outside caller)
9# 4g: parsing (outside caller)
10+
7### `++rash`
11### `++rash`
8
12
9Parse or crash
13Parse or crash
@@ -11,43 +15,44 @@ Parse or crash
11Parse a cord with a given `++rule` and crash if the `++cord` isn't entirely
15Parse a cord with a given `++rule` and crash if the `++cord` isn't entirely
12parsed.
16parsed.
13
17
14−Accepts
18+#### Accepts
15−-------
16
19
17`naf` is an atom.
20`naf` is an atom.
18
21
19`sab` is a `++rule`.
22`sab` is a `++rule`.
20
23
21−Produces
24+#### Produces
22−--------
23
25
24The value of the parse result, or crash.
26The value of the parse result, or crash.
25
27
26−Source
28+#### Source
27−------
28
29
30+```
29 ++ rash |*({naf/@ sab/rule} (scan (trip naf) sab)) ::
31 ++ rash |*({naf/@ sab/rule} (scan (trip naf) sab)) ::
32+```
30
33
34+#### Examples
31
35
32−Examples
36+```
33−--------
34−
35 > (rash 'I was the world in which I walked, and what I saw' (star (shim 0 200)))
37 > (rash 'I was the world in which I walked, and what I saw' (star (shim 0 200)))
36 "I was the world in which I walked, and what I saw"
38 "I was the world in which I walked, and what I saw"
39+
37 > (rash 'abc' (just 'a'))
40 > (rash 'abc' (just 'a'))
38 ! {1 2}
41 ! {1 2}
39 ! 'syntax-error'
42 ! 'syntax-error'
40 ! exit
43 ! exit
44+
41 > (rash 'abc' (jest 'abc'))
45 > (rash 'abc' (jest 'abc'))
42 'abc'
46 'abc'
47+
43− `> (rash 'abc' (jest 'ab'))
48+ > (rash 'abc' (jest 'ab'))
44 ! {1 3}
49 ! {1 3}
45 ! 'syntax-error'
50 ! 'syntax-error'
46 ! exit
51 ! exit
52+```
47
53
48
54
49−
55+---
50−***
51### `++rush`
56### `++rush`
52
57
53Parse or null
58Parse or null
@@ -55,41 +60,43 @@ Parse or null
55Parse a given with a given rule and produce null if the cord isn't
60Parse a given with a given rule and produce null if the cord isn't
56entirely parsed.
61entirely parsed.
57
62
58−Accepts
63+#### Accepts
59−-------
60
64
61`naf` is an atom.
65`naf` is an atom.
62
66
63`sab` is a rule.
67`sab` is a rule.
64
68
65−Produces
69+#### Produces
66−--------
67
70
68The value of the parse result, or null.
71The value of the parse result, or null.
69
72
70−Source
73+#### Source
71−------
72
74
75+```
73 ++ rush |*({naf/@ sab/rule} (rust (trip naf) sab))
76 ++ rush |*({naf/@ sab/rule} (rust (trip naf) sab))
77+```
74
78
79+#### Examples
75
80
76−Examples
81+```
77−--------
78−
79 > (rush 'I was the world in which I walked, and what I saw' (star (shim 0 200)))
82 > (rush 'I was the world in which I walked, and what I saw' (star (shim 0 200)))
80 [~ "I was the world in which I walked, and what I saw"]
83 [~ "I was the world in which I walked, and what I saw"]
84+
81 > (rush 'abc' (just 'a'))
85 > (rush 'abc' (just 'a'))
82 ~
86 ~
87+
83 > (rush 'abc' (jest 'abc'))
88 > (rush 'abc' (jest 'abc'))
84 [~ 'abc']
89 [~ 'abc']
90+
85 > (rush 'abc' (jest 'ac'))
91 > (rush 'abc' (jest 'ac'))
86 ~
92 ~
93+
87 > (rush 'abc' (jest 'ab'))
94 > (rush 'abc' (jest 'ab'))
88 ~
95 ~
96+```
89
97
90
98
91−
99+---
92−***
93### `++rust`
100### `++rust`
94
101
95Parse tape or null
102Parse tape or null
@@ -97,39 +104,39 @@ Parse tape or null
97Parse a `++tape` with a given `++rule` and produce null if the `++tape` isn't
104Parse a `++tape` with a given `++rule` and produce null if the `++tape` isn't
98entirely parsed.
105entirely parsed.
99
106
100−Accepts
107+#### Accepts
101−-------
102
108
103`los` is a `++tape`.
109`los` is a `++tape`.
104
110
105`sab` is a `++rule`.
111`sab` is a `++rule`.
106
112
107−Produces
113+#### Produces
108−--------
109
114
110A `(unit ,@t)`
115A `(unit ,@t)`
111
116
112−Source
117+#### Source
113−------
114
118
119+```
115 ++ rust |* {los/tape sab/rule}
120 ++ rust |* {los/tape sab/rule}
116 =+ vex=((full sab) [[1 1] los])
121 =+ vex=((full sab) [[1 1] los])
117 ?~(q.vex ~ [~ u=p.u.q.vex])
122 ?~(q.vex ~ [~ u=p.u.q.vex])
123+```
118
124
125+#### Examples
119
126
120−Examples
127+```
121−--------
122−
123 > (rust "I was the world in which I walked, and what I saw" (star (shim 0 200)))
128 > (rust "I was the world in which I walked, and what I saw" (star (shim 0 200)))
124 [~ "I was the world in which I walked, and what I saw"]
129 [~ "I was the world in which I walked, and what I saw"]
130+
125 > (rust "Or heard or felt came not but from myself;" (star (shim 0 200)))
131 > (rust "Or heard or felt came not but from myself;" (star (shim 0 200)))
126 [~ "Or heard or felt came not but from myself;"]
132 [~ "Or heard or felt came not but from myself;"]
133+
127 > (rust "And there I found myself more truly and more strange." (jest 'And there I'))
134 > (rust "And there I found myself more truly and more strange." (jest 'And there I'))
128 ~
135 ~
136+```
129
137
130
138
131−
139+---
132−***
133### `++scan`
140### `++scan`
134
141
135Parse tape or crash
142Parse tape or crash
@@ -137,39 +144,40 @@ Parse tape or crash
137Parse a `++tape` with a given `++rule` and crash if the `++tape` isn't entirely
144Parse a `++tape` with a given `++rule` and crash if the `++tape` isn't entirely
138parsed.
145parsed.
139
146
140−Accepts
147+#### Accepts
141−-------
142
148
143`los` is a tape.
149`los` is a tape.
144
150
145`sab` is a rule.
151`sab` is a rule.
146
152
147−Produces
153+#### Produces
148−--------
149
154
150Either a `++tape` or a crash.
155Either a `++tape` or a crash.
151
156
152−Source
157+#### Source
153−------
154
158
159+```
155 ++ scan |* {los/tape sab/rule}
160 ++ scan |* {los/tape sab/rule}
156 =+ vex=((full sab) [[1 1] los])
161 =+ vex=((full sab) [[1 1] los])
157 ?~ q.vex
162 ?~ q.vex
158 ~_ (show [%m '{%d %d}'] p.p.vex q.p.vex ~)
163 ~_ (show [%m '{%d %d}'] p.p.vex q.p.vex ~)
159 ~|('syntax-error' !!)
164 ~|('syntax-error' !!)
160 p.u.q.vex
165 p.u.q.vex
166+```
161
167
162−Examples
168+#### Examples
163−--------
164
169
170+```
165 > (scan "I was the world in which I walked, and what I saw" (star (shim 0 200)))
171 > (scan "I was the world in which I walked, and what I saw" (star (shim 0 200)))
166 "I was the world in which I walked, and what I saw"
172 "I was the world in which I walked, and what I saw"
173+
167 > (scan "Or heard or felt came not but from myself;" (star (shim 0 200)))
174 > (scan "Or heard or felt came not but from myself;" (star (shim 0 200)))
168 "Or heard or felt came not but from myself;"
175 "Or heard or felt came not but from myself;"
176+
169 > (scan "And there I found myself more truly and more strange." (jest 'And there I'))
177 > (scan "And there I found myself more truly and more strange." (jest 'And there I'))
170 ! {1 12}
178 ! {1 12}
171 ! 'syntax-error'
179 ! 'syntax-error'
172 ! exit
180 ! exit
181+```
173
182
174−
183+---
175−***
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.