on master help sign in
Merge pull request #273 from urbit/rmariani-patch-9
e8793abrmariani
docs/hoon/library/2c.md+260−188
@@ -10,38 +10,34 @@ Binary exponent
10
10
11Computes the result of `2^a`, producing an atom.
11Computes the result of `2^a`, producing an atom.
12
12
13−Accepts
13+#### Accepts
14−-------
15
14
16`a` is an atom.
15`a` is an atom.
17
16
18−Produces
17+#### Produces
19−--------
20
18
21An atom.
19An atom.
22
20
23−Source
21+#### Source
24−------
25
22
26− ++ bex :: binary exponent
23+ ++ bex
27 ~/ %bex
24 ~/ %bex
28− |= a/@
25+ |= a=@
29 ^- @
26 ^- @
30 ?: =(0 a) 1
27 ?: =(0 a) 1
31 (mul 2 $(a (dec a)))
28 (mul 2 $(a (dec a)))
32
29
33−Examples
30+#### Examples
34−--------
35
31
36 > (bex 4)
32 > (bex 4)
37 16
33 16
34+
38 > (bex (add 19 1))
35 > (bex (add 19 1))
39 1.048.576
36 1.048.576
37+
40 > (bex 0)
38 > (bex 0)
41 1
39 1
42
40
43−
44−
45***
41***
46
42
47### `++can`
43### `++can`
@@ -49,44 +45,51 @@ Examples
49Assemble
45Assemble
50
46
51Produces an atom from a list `b` of length-value pairs `p` and `q`,
47Produces an atom from a list `b` of length-value pairs `p` and `q`,
52−where `p` is the length in bloqs of size `a`, and `q` is an atomic
48+where `p` is the length in blocks of size `a`, and `q` is an atomic
53value.
49value.
54
50
55−Accepts
51+#### Accepts
56−-------
57
52
58−`a` is a block size (see `++bloq`).
53+`a` is a block size (see [`++bloq`](../1c)).
59
54
60−`b` is a `++list` of length value pairs, `p` and `q`.
55+`b` is a `list` of length-value pairs, `p` and `q`.
61
56
62−Produces
57+#### Produces
63−--------
64
58
65An atom.
59An atom.
66
60
67−Source
61+#### Source
68−------
69
62
70− ++ can :: assemble
63+ ++ can
71 ~/ %can
64 ~/ %can
72− |= [a/bloq b/(list [p=@ q=@])]
65+ |= [a=bloq b=(list [p=@ q=@])]
73 ^- @
66 ^- @
74 ?~ b 0
67 ?~ b 0
75− (mix (end a p.i.b q.i.b) (lsh a p.i.b $(b t.b)))
68+ (add (end a p.i.b q.i.b) (lsh a p.i.b $(b t.b)))
76
69
77−Examples
70+#### Examples
78−--------
71+
72+ > `@ub`21 :: @ub is the binary aura
73+ 0b1.0101
74+
75+ > `@ub`(can 3 ~[[1 21]])
76+ 0b1.0101
77+
78+ > `@ub`(can 3 ~[[1 1]])
79+ 0b1
79
80
80− > `@ub`(can 3 ~[[1 1]])
81− 0b1
82 > `@ub`(can 0 ~[[1 255]])
81 > `@ub`(can 0 ~[[1 255]])
83 0b1
82 0b1
83+
84− > `@ux`(can 3 [3 0xc1] [1 0xa] ~)
84+ > `@ux`(can 3 [3 0xc1] [1 0xa] ~) :: @ux is the hexadecimal aura
85 0xa00.00c1
85 0xa00.00c1
86+
86 > `@ux`(can 3 [3 0xc1] [1 0xa] [1 0x23] ~)
87 > `@ux`(can 3 [3 0xc1] [1 0xa] [1 0x23] ~)
87 0x23.0a00.00c1
88 0x23.0a00.00c1
89+
88 > `@ux`(can 4 [3 0xc1] [1 0xa] [1 0x23] ~)
90 > `@ux`(can 4 [3 0xc1] [1 0xa] [1 0x23] ~)
89 0x23.000a.0000.0000.00c1
91 0x23.000a.0000.0000.00c1
92+
90 > `@ux`(can 3 ~[[1 'a'] [2 'bc']])
93 > `@ux`(can 3 ~[[1 'a'] [2 'bc']])
91 0x63.6261
94 0x63.6261
92
95
@@ -96,54 +99,60 @@ Examples
96
99
97Concatenate
100Concatenate
98
101
99−Concatenates two atoms, `b` and `c`, according to bloq size `a`, producing an
102+Concatenates two atoms, `b` and `c`, according to block size `a`, producing an
100atom.
103atom.
101
104
102−Accepts
105+#### Accepts
103−-------
104
106
105−`a` is a block size (see `++bloq`).
107+`a` is a block size (see [`++bloq`](../1c)).
106
108
107`b` is an atom.
109`b` is an atom.
108
110
109`c` is an atom.
111`c` is an atom.
110
112
111−Produces
113+#### Produces
112−--------
113
114
114An atom.
115An atom.
115
116
116−Source
117+#### Source
117−------
118
118
119− ++ cat :: concatenate
119+ ++ cat
120 ~/ %cat
120 ~/ %cat
121− |= {a/bloq b/@ c/@}
121+ |= [a=bloq b=@ c=@]
122 (add (lsh a (met a b) c) b)
122 (add (lsh a (met a b) c) b)
123
123
124
124
125−Examples
125+#### Examples
126−--------
127
126
128− > `@ub`(cat 3 1 0)
127+ > `@ub`(cat 3 1 0) :: @ub is the binary aura
129 0b1
128 0b1
129+
130 > `@ub`(cat 0 1 1)
130 > `@ub`(cat 0 1 1)
131 0b11
131 0b11
132+
132 > `@ub`(cat 0 2 1)
133 > `@ub`(cat 0 2 1)
133 0b110
134 0b110
135+
134 > `@ub`(cat 2 1 1)
136 > `@ub`(cat 2 1 1)
135 0b1.0001
137 0b1.0001
138+
136 > `@ub`256
139 > `@ub`256
137 0b1.0000.0000
140 0b1.0000.0000
141+
138 > `@ub`255
142 > `@ub`255
139 0b1111.1111
143 0b1111.1111
144+
140 > `@ub`(cat 3 256 255)
145 > `@ub`(cat 3 256 255)
141 0b1111.1111.0000.0001.0000.0000
146 0b1111.1111.0000.0001.0000.0000
147+
142 > `@ub`(cat 2 256 255)
148 > `@ub`(cat 2 256 255)
143 0b1111.1111.0001.0000.0000
149 0b1111.1111.0001.0000.0000
150+
144 > (cat 3 256 255)
151 > (cat 3 256 255)
145 16.711.936
152 16.711.936
146
153
154+ > (cat 2 256 255)
155+ 1.044.736
147
156
148
157
149***
158***
@@ -151,47 +160,53 @@ Examples
151
160
152Slice
161Slice
153
162
154−Slices `c` blocks of size `a` that are `b` blocks from the end of `d`.
163+Slices `c` blocks of size `a` that are positioned `b` blocks from the end of
164+`d`. That slice is produced as an atom.
155
165
156−Accepts
166+#### Accepts
157−-------
158
167
159−`a` is a block size (see ++bloq).
168+`a` is a block size (see [`++bloq`](../1c)).
160
169
161`b` is an atom.
170`b` is an atom.
162
171
163`c` is an atom.
172`c` is an atom.
164
173
174+`d` is an atom.
175+
165−Produces
176+#### Produces
166−--------
167
177
168An atom.
178An atom.
169
179
170−Source
180+#### Source
171−------
172
181
173− ++ cut :: slice
182+ ++ cut
174 ~/ %cut
183 ~/ %cut
175− |= {a/bloq {b/@u c/@u} d/@}
184+ |= [a=bloq [b=@u c=@u] d=@]
176 (end a c (rsh a b d))
185 (end a c (rsh a b d))
177
186
178−Examples
187+#### Examples
179−--------
180
188
181 > (cut 0 [1 1] 2)
189 > (cut 0 [1 1] 2)
182 1
190 1
191+
183 > (cut 0 [2 1] 4)
192 > (cut 0 [2 1] 4)
184 1
193 1
194+
185 > `@t`(cut 3 [0 3] 'abcdefgh')
195 > `@t`(cut 3 [0 3] 'abcdefgh')
186 'abc'
196 'abc'
197+
187− > `@t`(cut 3 [1 3] 'abcdefgh')
198+ > `@t`(cut 3 [1 3] 'abcdefgh') :: @t is the cord aura
188 'bcd'
199 'bcd'
200+
189− > `@ub`(cut 0 [0 3] 0b1111.0000.1101)
201+ > `@ub`(cut 0 [0 3] 0b1111.0000.1101) :: @ub is the binary aura
190 0b101
202 0b101
203+
191 > `@ub`(cut 0 [0 6] 0b1111.0000.1101)
204 > `@ub`(cut 0 [0 6] 0b1111.0000.1101)
192 0b1101
205 0b1101
206+
193 > `@ub`(cut 0 [4 6] 0b1111.0000.1101)
207 > `@ub`(cut 0 [4 6] 0b1111.0000.1101)
194 0b11.0000
208 0b11.0000
209+
195 > `@ub`(cut 0 [3 6] 0b1111.0000.1101)
210 > `@ub`(cut 0 [3 6] 0b1111.0000.1101)
196 0b10.0001
211 0b10.0001
197
212
@@ -204,48 +219,60 @@ Tail
204
219
205Produces an atom by taking the last `b` blocks of size `a` from `c`.
220Produces an atom by taking the last `b` blocks of size `a` from `c`.
206
221
207−Accepts
222+#### Accepts
208−-------
209
223
210−`a` is a block size (see `++bloq`).
224+`a` is a block size (see [`++bloq`](../1c)).
211
225
212`b` is an atom.
226`b` is an atom.
213
227
214`c` is an atom.
228`c` is an atom.
215
229
216−Produces
230+#### Produces
217−--------
218
231
219An atom.
232An atom.
220
233
221
234
222−Source
235+#### Source
223−------
224
236
225− ++ end :: tail
237+ ++ end
226 ~/ %end
238 ~/ %end
227− |= {a/bloq b/@u c/@}
239+ |= [a=bloq b=@u c=@]
228 (mod c (bex (mul (bex a) b)))
240 (mod c (bex (mul (bex a) b)))
229
241
230
242
231−Examples
243+#### Examples
232−--------
244+
245+ > (end 2 2 255)
246+ 255
247+
248+ > (end 3 1 255)
249+ 255
250+
251+ > (end 3 1 256)
252+ 0
233
253
234− > `@ub`12
254+ > `@ub`12 :: @ub is the binary aura
235 0b1100
255 0b1100
256+
236 > `@ub`(end 0 3 12)
257 > `@ub`(end 0 3 12)
237 0b100
258 0b100
259+
238 > (end 0 3 12)
260 > (end 0 3 12)
239 4
261 4
262+
240 > `@ub`(end 1 3 12)
263 > `@ub`(end 1 3 12)
241 0b1100
264 0b1100
265+
242 > (end 1 3 12)
266 > (end 1 3 12)
243 12
267 12
244− > `@ux`'abc'
268+
269+ > `@ux`'abc' :: @ux is the hexademical aura
245 0x63.6261
270 0x63.6261
271+
246 > `@ux`(end 3 2 'abc')
272 > `@ux`(end 3 2 'abc')
247 0x6261
273 0x6261
274+
248− > `@t`(end 3 2 'abc')
275+ > `@t`(end 3 2 'abc') :: @t is the cord aura
249 'ab'
276 'ab'
250
277
251
278
@@ -257,25 +284,22 @@ Fill bloqstream
257
284
258Produces an atom by repeating `c` for `b` blocks of size `a`.
285Produces an atom by repeating `c` for `b` blocks of size `a`.
259
286
260−Accepts
287+#### Accepts
261−-------
262
288
263−`a` is a block size (see `++bloq`).
289+`a` is a block size (see [`++bloq`](../1c)).
264
290
265`b` is an atom.
291`b` is an atom.
266
292
267`c` is an atom.
293`c` is an atom.
268
294
269−Produces
295+#### Produces
270−--------
271
296
272An atom.
297An atom.
273
298
274−Source
299+#### Source
275−------
276
300
277− ++ fil :: fill bloqstream
301+ ++ fil
278− |= {a/bloq b/@u c/@}
302+ |= [a=bloq b=@u c=@]
279 =+ n=0
303 =+ n=0
280 =+ d=c
304 =+ d=c
281 |- ^- @
305 |- ^- @
@@ -284,18 +308,23 @@ Source
284 $(d (add c (lsh a 1 d)), n +(n))
308 $(d (add c (lsh a 1 d)), n +(n))
285
309
286
310
287−Examples
311+#### Examples
288−--------
289
312
290− > `@t`(fil 3 5 %a)
313+ > `@t`(fil 3 5 %a) :: @t is the cord (string) aura
291 'aaaaa'
314 'aaaaa'
315+
292 > `@t`(fil 5 10 %ceeb)
316 > `@t`(fil 5 10 %ceeb)
293 'ceebceebceebceebceebceebceebceebceebceeb'
317 'ceebceebceebceebceebceebceebceebceebceeb'
318+
294 > `@t`(fil 4 10 %eced)
319 > `@t`(fil 4 10 %eced)
295 'ʇʇʇʇʇʇʇʇʇʇed'
320 'ʇʇʇʇʇʇʇʇʇʇed'
321+
296− > `@tas`(fil 4 10 %bf)
322+ > `@tas`(fil 4 10 %bf) :: @tas is the term aura
297 %bfbfbfbfbfbfbfbfbfbf
323 %bfbfbfbfbfbfbfbfbfbf
298
324
325+ > `@ub`(fil 2 6 1) :: @ub is the binary aura
326+ 0b1.0001.0001.0001.0001.0001
327+
299
328
300
329
301***
330***
@@ -305,42 +334,43 @@ Left-shift
305
334
306Produces an atom by left-shifting `c` by `b` blocks of size `a`.
335Produces an atom by left-shifting `c` by `b` blocks of size `a`.
307
336
308−Accepts
337+#### Accepts
309−-------
310
338
311−`a` is a block size (see `++bloq`).
339+`a` is a block size (see [`++bloq`](../1c)).
312
340
313`b` is an atom.
341`b` is an atom.
314
342
315`c` is an atom.
343`c` is an atom.
316
344
317−Produces
345+#### Produces
318−--------
319
346
320An atom.
347An atom.
321
348
322−Source
349+#### Source
323−------
324
350
325− ++ lsh :: left-shift
351+ ++ lsh
326 ~/ %lsh
352 ~/ %lsh
327− |= {a/bloq b/@u c/@}
353+ |= [a=bloq b=@u c=@]
328 (mul (bex (mul (bex a) b)) c)
354 (mul (bex (mul (bex a) b)) c)
329
355
330
356
331−Examples
357+#### Examples
332−--------
333
358
334− > `@ub`1
359+ > `@ub`1 :: @ub is the binary aura
335 0b1
360 0b1
361+
336 > `@ub`(lsh 0 1 1)
362 > `@ub`(lsh 0 1 1)
337 0b10
363 0b10
364+
338 > (lsh 0 1 1)
365 > (lsh 0 1 1)
339 2
366 2
367+
340 > `@ub`255
368 > `@ub`255
341 0b1111.1111
369 0b1111.1111
370+
342 > `@ub`(lsh 3 1 255)
371 > `@ub`(lsh 3 1 255)
343 0b1111.1111.0000.0000
372 0b1111.1111.0000.0000
373+
344 > (lsh 3 1 255)
374 > (lsh 3 1 255)
345 65.280
375 65.280
346
376
@@ -353,33 +383,37 @@ Measure
353
383
354Computes the number of blocks of size `a` in `b`, producing an atom.
384Computes the number of blocks of size `a` in `b`, producing an atom.
355
385
386+#### Accepts
387+
356−`a` is a block size (see `++bloq`).
388+`a` is a block size (see [`++bloq`](../1c)).
357
389
358`b` is an atom.
390`b` is an atom.
359
391
360−Source
392+#### Source
361−------
362
393
363− ++ met :: measure
394+ ++ met
364 ~/ %met
395 ~/ %met
365− |= {a/bloq b/@}
396+ |= [a=bloq b=@]
366 ^- @
397 ^- @
367 =+ c=0
398 =+ c=0
368 |-
399 |-
369 ?: =(0 b) c
400 ?: =(0 b) c
370 $(b (rsh a 1 b), c +(c))
401 $(b (rsh a 1 b), c +(c))
371
402
372−Examples
403+#### Examples
373−--------
374
404
375 > (met 0 1)
405 > (met 0 1)
376 1
406 1
407+
377 > (met 0 2)
408 > (met 0 2)
378 2
409 2
410+
379 > (met 3 255)
411 > (met 3 255)
380 1
412 1
413+
381 > (met 3 256)
414 > (met 3 256)
382 2
415 2
416+
383 > (met 3 'abcde')
417 > (met 3 'abcde')
384 5
418 5
385
419
@@ -390,43 +424,57 @@ Examples
390
424
391Assemble non-zero
425Assemble non-zero
392
426
393−Concatenates a list of atoms `b` using blocksize `a`, producing an atom.
427+Concatenates a list of atoms `b` using block size `a`, producing an atom.
394
428
395−Accepts
429+#### Accepts
396−-------
397
430
398−`a` is a block size (see `++bloq`).
431+`a` is a block size (see [`++bloq`](../1c)).
399
432
400−`b` is a `++list` of atoms.
433+`b` is a `list` of atoms.
401
434
402−Produces
435+#### Produces
403−--------
404
436
405An atom.
437An atom.
406
438
407−Source
439+#### Source
408−------
409
440
410− ++ rap :: assemble nonzero
441+ ++ rap
411 ~/ %rap
442 ~/ %rap
412− |= {a/bloq b/(list @)}
443+ |= [a=bloq b=(list @)]
413 ^- @
444 ^- @
445+ =+ ~
414 ?~ b 0
446 ?~ b 0
415 (cat a i.b $(b t.b))
447 (cat a i.b $(b t.b))
416
448
417−Examples
449+#### Examples
418−--------
419
450
420− > `@ub`(rap 2 (limo [1 2 3 4 ~]))
451+ > `@ub`(rap 2 [1 2 3 4 ~]) :: @ub is the binary aura
421 0b100.0011.0010.0001
452 0b100.0011.0010.0001
453+
422− > `@ub`(rap 1 (limo [1 2 3 4 ~]))
454+ > `@ub`(rap 1 [1 2 3 4 ~])
423 0b1.0011.1001
455 0b1.0011.1001
456+
424− > (rap 0 (limo [0 0 0 ~]))
457+ > (rap 0 [0 0 0 ~])
425 0
458 0
459+
426− > (rap 0 (limo [1 0 1 ~]))
460+ > (rap 0 [1 0 1 ~])
427 3
461 3
428
462
463+ > `@ub`3
464+ 0b11
465+
466+ > (rap 0 [0 1 0 0 1 2 ~])
467+ 11
468+
469+ > (rap 0 [1 1 2 ~])
470+ 11
471+
472+ > `@ub`11
473+ 0b1011
474+
475+#### Discussion
429
476
477+Any element of the value `0` is not included in concatenation.
430
478
431***
479***
432### `++rep`
480### `++rep`
@@ -435,48 +483,59 @@ Assemble single
435
483
436Produces an atom by assembling a list of atoms `b` using block size `a`.
484Produces an atom by assembling a list of atoms `b` using block size `a`.
437
485
438−Accepts
486+#### Accepts
439−-------
440
487
441−`a` is a block size (see `++bloq`).
488+`a` is a block size (see [`++bloq`](../1c)).
442
489
443`b` is a list of atoms.
490`b` is a list of atoms.
444
491
445−Produces
492+#### Produces
446−--------
447
493
448An atom.
494An atom.
449
495
450−Source
496+#### Source
451−------
452
497
453− ++ rep :: assemble single
498+ ++ rep
454 ~/ %rep
499 ~/ %rep
455− |= {a/bloq b/(list @)}
500+ |= [a=bloq b=(list @)]
456 ^- @
501 ^- @
457 =+ c=0
502 =+ c=0
458 |-
503 |-
459 ?~ b 0
504 ?~ b 0
460− (con (lsh a c (end a 1 i.b)) $(c +(c), b t.b))
505+ (add (lsh a c (end a 1 i.b)) $(c +(c), b t.b))
461
506
462−Examples
507+#### Examples
463−--------
464
508
465− > `@ub`(rep 2 (limo [1 2 3 4 ~]))
509+ > `@ub`(rep 2 [1 2 3 4 ~]) :: @ub is the binary aura
466 0b100.0011.0010.0001
510 0b100.0011.0010.0001
511+
467− > (rep 0 (limo [0 0 1 ~]))
512+ > (rep 0 [0 0 1 ~])
468 4
513 4
514+
469− > (rep 0 (limo [0 0 0 1 ~]))
515+ > (rep 0 [0 0 0 1 ~])
470 8
516 8
517+
518+ > `@ub`(rep 0 [0 0 0 1 ~])
519+ 0b1000
520+
521+ > `@ub`8
522+ 0b1000
523+
471− > (rep 0 (limo [0 1 0 0 ~]))
524+ > (rep 0 [0 1 0 0 ~])
472 2
525 2
526+
473− > (rep 0 (limo [0 1 0 1 ~]))
527+ > (rep 0 [0 1 0 1 ~])
474 10
528 10
529+
475− > (rep 0 (limo [0 1 0 1 0 1 ~]))
530+ > (rep 0 [1 0 1 0 1 ~])
476− 42
531+ 21
532+
477− > `@ub`42
533+ > `@ub`21
478 0b10.1010
534 0b10.1010
479
535
536+ > `@ub`(rep 3 [12 166 8 34 ~])
537+ 0b10.0010.0000.1000.1010.0110.0000.1100
538+
480
539
481
540
482***
541***
@@ -486,45 +545,51 @@ Disassemble
486
545
487Produces a list of atoms from the bits of `b` using block size `a`.
546Produces a list of atoms from the bits of `b` using block size `a`.
488
547
489−Accepts
548+#### Accepts
490−-------
491
549
492−`a` is a block size (see `++bloq`).
550+`a` is a block size (see [`++bloq`](../1c)).
493
551
494`b` is an atom.
552`b` is an atom.
495
553
496−Produces
554+#### Produces
497−--------
498
555
499A list of atoms.
556A list of atoms.
500
557
501−Source
558+#### Source
502−------
503
559
504− ++ rip :: disassemble
560+ ++ rip
505 ~/ %rip
561 ~/ %rip
506− |= {a/bloq b/@}
562+ |= [a=bloq b=@]
507 ^- (list @)
563 ^- (list @)
508 ?: =(0 b) ~
564 ?: =(0 b) ~
509 [(end a 1 b) $(b (rsh a 1 b))]
565 [(end a 1 b) $(b (rsh a 1 b))]
510
566
511−Examples
567+#### Examples
512−--------
513
568
514− > `@ub`155
569+ > `@ub`155 :: @ub is the binary aura
515 0b1001.1011
570 0b1001.1011
571+
516 > (rip 0 155)
572 > (rip 0 155)
517 ~[1 1 0 1 1 0 0 1]
573 ~[1 1 0 1 1 0 0 1]
574+
518 > (rip 2 155)
575 > (rip 2 155)
519 ~[11 9]
576 ~[11 9]
577+
578+ > (rip 0 11)
579+ ~[1 1 0 1]
580+
520 > (rip 1 155)
581 > (rip 1 155)
521 ~[3 2 1 2]
582 ~[3 2 1 2]
583+
522 > `@ub`256
584 > `@ub`256
523 0b1.0000.0000
585 0b1.0000.0000
586+
524 > (rip 0 256)
587 > (rip 0 256)
525 ~[0 0 0 0 0 0 0 0 1]
588 ~[0 0 0 0 0 0 0 0 1]
589+
526 > (rip 2 256)
590 > (rip 2 256)
527 ~[0 0 1]
591 ~[0 0 1]
592+
528 > (rip 3 256)
593 > (rip 3 256)
529 ~[0 1]
594 ~[0 1]
530
595
@@ -537,51 +602,57 @@ Right-shift
537
602
538Right-shifts `c` by `b` blocks of size `a`, producing an atom.
603Right-shifts `c` by `b` blocks of size `a`, producing an atom.
539
604
540−Accepts
605+#### Accepts
541−-------
542
606
543−`a` is a block size (see `++bloq`).
607+`a` is a block size (see [`++bloq`](../1c)).
544
608
545`b` is an atom.
609`b` is an atom.
546
610
547`c` is an atom.
611`c` is an atom.
548
612
549−Produces
613+#### Produces
550−--------
551
614
552An atom.
615An atom.
553
616
554−Source
617+#### Source
555−------
556
618
557− ++ rsh :: right-shift
619+ ++ rsh
558 ~/ %rsh
620 ~/ %rsh
559− |= {a/bloq b/@u c/@}
621+ |= [a=bloq b=@u c=@]
560 (div c (bex (mul (bex a) b)))
622 (div c (bex (mul (bex a) b)))
561
623
562−Examples
624+#### Examples
563−--------
564
625
565− > `@ub`145
626+ > `@ub`145 :: @ub is the binary aura
566 0b1001.0001
627 0b1001.0001
628+
567 > `@ub`(rsh 1 1 145)
629 > `@ub`(rsh 1 1 145)
568 0b10.0100
630 0b10.0100
631+
569 > (rsh 1 1 145)
632 > (rsh 1 1 145)
570 36
633 36
634+
571 > `@ub`(rsh 2 1 145)
635 > `@ub`(rsh 2 1 145)
572 0b1001
636 0b1001
637+
573 > (rsh 2 1 145)
638 > (rsh 2 1 145)
574 9
639 9
640+
575 > `@ub`10
641 > `@ub`10
576 0b1010
642 0b1010
643+
577 > `@ub`(rsh 0 1 10)
644 > `@ub`(rsh 0 1 10)
578 0b101
645 0b101
646+
579 > (rsh 0 1 10)
647 > (rsh 0 1 10)
580 5
648 5
649+
581 > `@ux`'abc'
650 > `@ux`'abc'
582 0x63.6261
651 0x63.6261
652+
583 > `@t`(rsh 3 1 'abc')
653 > `@t`(rsh 3 1 'abc')
584 'bc'
654 'bc'
655+
585 > `@ux`(rsh 3 1 'abc')
656 > `@ux`(rsh 3 1 'abc')
586 0x6362
657 0x6362
587
658
@@ -592,39 +663,39 @@ Examples
592
663
593Reverse block order
664Reverse block order
594
665
595−Switches little endian to big and vice versa: produces an atom by
666+Switches little-endian to big-endian and vice versa: produces an atom by
596reversing the block order of `b` using block size `a`.
667reversing the block order of `b` using block size `a`.
597
668
598
669
599−Accepts
670+#### Accepts
600−-------
601
671
602−`a` is a block size (see `++bloq`).
672+`a` is a block size (see [`++bloq`](../1c)).
603
673
604`b` is an atom.
674`b` is an atom.
605
675
606−Produces
676+#### Produces
607−--------
608
677
609An atom
678An atom
610
679
611−Source
680+#### Source
612−------
613
681
614− ++ swap |=({a/bloq b/@} (rep a (flop (rip a b)))) :: reverse bloq order
682+ ++ swp |=([a=bloq b=@] (rep a (flop (rip a b))))
615
683
616−Examples
684+#### Examples
617−--------
618
685
619− > `@ub`24
686+ > `@ub`24 :: @ub is the binary aura
620 0b1.1000
687 0b1.1000
688+
621− > (swap 0 24)
689+ > (swp 0 24)
622 3
690 3
691+
623 > `@ub`3
692 > `@ub`3
624 0b11
693 0b11
625− > (swap 0 0)
694+
695+ > (swp 0 0)
626 0
696 0
697+
627− > (swap 0 128)
698+ > (swp 0 128)
628 1
699 1
629
700
630
701
@@ -636,38 +707,39 @@ Binary logarithm
636
707
637Computes the base-2 logarithm of `a`, producing an atom.
708Computes the base-2 logarithm of `a`, producing an atom.
638
709
639−Accepts
710+#### Accepts
640−-------
641
711
642`a` is an atom.
712`a` is an atom.
643
713
644−Produces
714+#### Produces
645−--------
646
715
647An atom.
716An atom.
648
717
649−Source
718+#### Source
650−------
651
719
652− ++ xeb :: binary logarithm
720+ ++ xeb
653 ~/ %xeb
721 ~/ %xeb
654− |= a/@
722+ |= a=@
655 ^- @
723 ^- @
656 (met 0 a)
724 (met 0 a)
657
725
658−Examples
726+#### Examples
659−--------
660
727
661 > (xeb 31)
728 > (xeb 31)
662 5
729 5
730+
663 > (xeb 32)
731 > (xeb 32)
664 6
732 6
733+
665 > (xeb 49)
734 > (xeb 49)
666 6
735 6
736+
667 > (xeb 0)
737 > (xeb 0)
668 0
738 0
739+
669 > (xeb 1)
740 > (xeb 1)
670 1
741 1
742+
671 > (xeb 2)
743 > (xeb 2)
672 2
744 2
673
745