2title = "2p: Serialization"
11Produces a noun unpacked from atom `a`. The inverse of [+jam](#jam).
31 |- ^- [p=@ q=* r=(map @ *)]
32 ?: =(0 (cut 0 [b 1] a))
34 [+(p.c) q.c (~(put by m) b q.c)]
36 ?: =(0 (cut 0 [+(b) 1] a))
38 =+ v=$(b (add p.u c), m r.u)
40 [(add 2 (add p.u p.v)) w (~(put by r.v) b w)]
42 [(add 2 p.d) (need (~(get by m) q.d)) m]
61Produces an atom packed from noun `a`. The inverse of [+cue](#cue).
81 |- ^- [p=@ q=@ r=(map * @)]
84 => .(m (~(put by m) a b))
87 [(add 1 p.d) (lsh 0 q.d) m]
90 =+ e=$(a +.a, b (add b p.d), m r.d)
91 [(add 2 (add p.d p.e)) (mix 1 (lsh [0 2] (cat 0 q.d q.e))) r.e]
92 ?: ?&(?=(@ a) (lte (met 0 a) (met 0 u.c)))
94 [(add 1 p.d) (lsh 0 q.d) m]
96 [(add 2 p.d) (mix 3 (lsh [0 2] q.d)) m]
131Produces a cell whose tail `q` is atom `a` with a bit representation of
132its length prepended to it (as the least significant bits). The head `p`
133is the length of `q` in bits.
141A cell of two atoms, `p` and `q`.
155 (cat 0 (bex c) (mix (end [0 (dec c)] b) (lsh [0 (dec c)] a)))
164> (met 0 q:(mat 0xaaa))
1680b1010.1010.1010.1001.0000
170> =a =-(~&(- -) `@ub`0xaaa)
173> =b =-(~&(- -) `@ub`(xeb a))
176> =b =-(~&(- -) `@ub`(met 0 a))
179> =c =-(~&(- -) (xeb b))
182> [`@ub`a `@ub`(end 0 (dec c) b) `@ub`(bex c)]
183[0b1010.1010.1010 0b100 0b1.0000]
188`mat` is only used internally as a helper to [`jam`](#jam).
196The inverse of `mat`. Accepts a cell of index `a` and a bitstring `b`
197and produces the cell whose tail `q` is the decoded atom at index `a`
198and whose head is the length of the encoded atom `q`, by which the
199offset `a` is advanced.
205`b` is a bitstring as an atom.
209A cell of two atoms, `p` and `q`.
221 ?. =(0 (cut 0 [(add a c) 1] b))
227 =+ e=(add (bex (dec c)) (cut 0 [d (dec c)] b))
228 [(add (add c c) e) (cut 0 [(add d (dec c)) e] b)]
2350b1.0101.0101.0101.0010.0000
237> (rub 1 0b1.0101.0101.0101.0010.0000)
240> `@ux`q:(rub 1 0b1.0101.0101.0101.0010.0000)
246`rub` is only used internally as a helper to [`cue`](#cue).
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list