on 140ac0e help sign in
51 lines 835 B history raw
1### `++rep`
3Assemble single
5Produces an atom by assembling a list of atoms `b` using block size `a`.
7Accepts
8-------
10`a` is a block size (see `++bloq`).
12`b` is a list of atoms.
14Produces
15--------
17An atom.
19Source
20------
22 ++ rep :: assemble single
23 ~/ %rep
24 |= {a/bloq b/(list @)}
25 ^- @
26 =+ c=0
27 |-
28 ?~ b 0
29 (con (lsh a c (end a 1 i.b)) $(c +(c), b t.b))
31Examples
32--------
34 ~zod/try=> `@ub`(rep 2 (limo [1 2 3 4 ~]))
35 0b100.0011.0010.0001
36 ~zod/try=> (rep 0 (limo [0 0 1 ~]))
37 4
38 ~zod/try=> (rep 0 (limo [0 0 0 1 ~]))
39 8
40 ~zod/try=> (rep 0 (limo [0 1 0 0 ~]))
41 2
42 ~zod/try=> (rep 0 (limo [0 1 0 1 ~]))
43 10
44 ~zod/try=> (rep 0 (limo [0 1 0 1 0 1 ~]))
45 42
46 ~zod/try=> `@ub`42
47 0b10.1010
51***