@@ -9,137 +9,201 @@ navhome: /docs/
12−Atom representing a blocksize, by convention expressed as a power of 2.
12+Atom representing block size. A block of size `a` has a bitwidth of `2^a`.
17− ++ bloq @ :: blockclass
16+ ++ bloq @
19−Examples
18+#### Examples
22− > :: ++met measures how many bloqs long an atom is
20+ ::++met measures how many a-bloqs long an atom is. In other words, how
23− > (met 3 256)
21+ many bloqs of size a would be needed to represent b.
23+ > (met 3 256) ::one 3-bloq has a bidwidth of 8, which can represent 0-255
29+ > (met 3 65.535) ::two 3-bloqs together have a bidwidth of 16, which can represent 0-65,535
25− > :: 256 is 2 bloqs of 2^3
40+
41+ > (met 5 9.999.999.999)
49+You can think of `bloq` as a numeral system that can represent values of
50+`a^2^2`, where `a` is the size of a given block. That's because a block of size
51+`a` is `a^2` bits wide, and a binary number that is `b` bits wide can represent
54+A `bloq` of 0 has a bitwidth of 1. (2^0 bits; can represent 2 values.)
56+A `bloq` of 1 has a bitwidth of 2. (2^1 bits; can represent 4 values.)
58+A `bloq` of 2 has a bitwidth of 4. (2^2 bits; can represent 16 values.)
60+A `bloq` of 3 has a bitwidth of 8. (2^3 bits; can represent 256 values.)
30### `++each`
67### `++each`
32−Mold of fork between two
69+Mold of fork between two types
34−mold generator: produces a discriminated fork between two types.
71+A mold generator. Produces a discriminated fork between two types, defaulting to
40− |* {a/$-(* *) b/$-(* *)} :: either a or b
77+ |*([a=mold b=mold] $%([$| p=b] [$& p=a]))
41− $%({$& p/a} {$| p/b}) :: a default
44−Examples
80+#### Examples
47 > ? *(each cord time)
82 > ? *(each cord time)
48 ?({$.y p/@t} {$.n p/@da})
83 ?({$.y p/@t} {$.n p/@da})
49 [%.y p='']
84 [%.y p='']
87+ ?({$.y p/*} {$.n p/""})
52### `++gate`
91### `++gate`
56−A core with one arm, `$`--the empty name--which transforms a sample noun into a product
95+A core with one arm, `$`--the empty name--which transforms a sample noun into a
57−noun. If used dryly as a type, the subject must have a sample type of `*`.
96+product noun. If used dryly as a type, the subject must have a sample type of
63− ++ gate $-(* *) :: general gate
102+ ++ gate
66−Examples
106+#### Examples
69−See also: `++lift`, `++cork`
72− <1.ybc {* <110.jyx 1.ztu $151>}>
109+ <1.rdl {* <31.ohr 1.jmk $143>}>
73− <1.ybc {* <110.jyx 1.ztu $151>}>
110+ <1.rdl {* <31.ohr 1.jmk $143>}>
75 > (`gate`|=(a/* [a 'b']) 1)
112 > (`gate`|=(a/* [a 'b']) 1)
117+A `gate` is analogous to a function in other programming languages. We created
118+this new jargon because other constructs in Urbit are "functions" in the
121+See also: [`++lift`](../2a), [`++cork`](../2n)
81### `++list`
124### `++list`
85−mold generator. `++list` generates a mold of a null-termanated list of a
128+A mold generator. Generates a mold of a null-terminated list of a
86homogenous type.
129homogenous type.
92− ++ list |* a/$-(* *) :: null-term list
93− $@($~ {i/a t/(list a)}) ::
135+ |*(a=mold $@($~ (lest a)))
99−See also: `++turn`, `++snag`
138+#### Examples
101 > *(list)
140 > *(list)
103 > `(list @)`"abc"
143 > `(list @)`"abc"
104 ~[97 98 99]
144 ~[97 98 99]
105 > (snag 0 "abc")
146 > (snag 0 "abc")
149+ > `(list @)`[1 2 'j' ~]
154+See also: [`++turn`](../2b), [`++snag`](../2b)
111### `++lone`
157### `++lone`
113−`++lone` puts face of `p` on something.
159+Face on mold
115−XX unused
161+A mold generator. Puts face of `p` on the passed-in mold.
117−Source
163+#### Source
120− ++ lone |*(a/$-(* *) p/a) :: just one thing
165+ ++ lone
123### `++pair`
186### `++pair`
125Mold of pair of types
188Mold of pair of types
127−mold generator. Produces a tuple of two of the types passed in.
190+A mold generator. Produces a tuple of two of the types passed in.
130−Source
193+#### Source
133− ++ pair |*({a/$-(* *) b/$-(* *)} {p/a q/b}) :: just a pair
195+ ++ pair
196+ |*([a=mold b=mold] [p=a q=b])
137−Examples
200+#### Examples
140− > *(pair bean cord)
202+ > *(pair ? cord)
141 [p=%.y q='']
203 [p=%.y q='']
@@ -147,105 +211,93 @@ Examples
148Faceless list
212Faceless list
150−A `++list` without the faces `i` and `t`.
214+A mold generator. A `list` without the faces `i` and `t`.
153−------
219+ |*(a=mold $@($~ [a (pole a)]))
155− ++ pole |* a/$-(* *) :: nameless list
156− $@($~ {a (pole a)}) ::
160−Examples
225+ > =/(a "asdf" ?>(?=(^ a) `(lest @tD)`a))
161−--------
226+ [i='a' t=[i='s' t=[i='d' t=[i='f' t=~]]]]
163 > `(pole char)`"asdf"
228 > `(pole char)`"asdf"
164− [~~a [~~s [~~d [~~f ~]]]]
229+ ['a' ['s' ['d' ['f' ~]]]]
169### `++qual`
234### `++qual`
171−Mold of 4 type tuple
236+Mold of 4-type tuple
173−A `++qual` is a tuple of four of the types passed in.
238+A mold generator. Produces a tuple of four of the types passed in.
175−Source
240+#### Source
178− ++ qual |* {a/$-(* *) b/$-(* *) c/$-(* *) d/$-(* *)} :: just a quadruple
242+ ++ qual
243+ |* [a=mold b=mold c=mold d=mold]
179− {p/a q/b r/c s/d} ::
244+ [p=a q=b r=c s=d]
181−Examples
246+#### Examples
184 > *(qual date time tape cord)
248 > *(qual date time tape cord)
185 [p=[[a=%.y y=0] m=0 t=[d=0 h=0 m=0 s=0 f=~]] q=~292277024401-.1.1 r="" s='']
249 [p=[[a=%.y y=0] m=0 t=[d=0 h=0 m=0 s=0 f=~]] q=~292277024401-.1.1 r="" s='']
187−
251+ > *(qual (list @) @u @ud @ux)
188−
252+ [p=~ q=0 r=0 s=0x0]
192−For use with `=^` `:sip`.
194−Mold generator. Produces a tuple of `a` and the mold of `b`.
199− ++ quid |*({a/mold b/*} {a _b}) :: mixed for sip
210### `++quip`
256### `++quip`
212−For use with `=^` `:sip`.
258+Mold of pair of `list` and type
214−Mold generator. Produces a tuple of a list of `a` and the mold of `b`.
260+A mold generator. Produces a tuple of a list of `a` and the mold of `b`.
216−Source
262+#### Source
219− ++ quip |*({a/mold b/*} {(list a) _b}) :: list-mixed for sip
265+ |*([a=mold b=mold] [(list a) b])
221−Examples
267+#### Examples
224− > *(quip @ 'hi')
269+ > *(quip @ _'hi')
272+ > `(quip @ @ux)`[[1 2 3 4 ~] 0x10]
277+A common pattern in Hoon code is to return a `list` of changes, along with a
278+new state. You'll often see `quip` it used in Gall apps.
230### `++trap`
281### `++trap`
232Core with one arm `$`
283Core with one arm `$`
234−A trap is a core with one arm `++$`.
285+A trap is a core with one arm `$`.
236−Source
287+#### Source
239− ++ trap |*(a/_* _|?(*a)) :: makes perfect sense
289+ ++ trap
242−Examples
293+#### Examples
246− <1.mws 101.jzo 1.ypj %164>
247 > (*trap)
295 > (*trap)
296+ <1?dxy 1.oeg {a/<1|rbb {* <31.ohr 1.jmk $143>}> <31.ohr 1.jmk $143>}>
249 > (|.(42))
301 > (|.(42))
@@ -256,20 +308,18 @@ Examples
257Tree mold generator
309Tree mold generator
259−A `++tree` can be empty, or contain a node of a type and
311+A mold generator. A `tree` can be empty, or contain a node of a type and
260−left/right sub `++tree` of the same type. Pretty-printed with `{}`.
312+left/right sub `tree` of the same type. Pretty-printed with `{}`.
262−Source
314+#### Source
265− ++ tree |* a/$-(* *) :: binary tree
316+ ++ tree
266− $@($~ {n/a l/(tree a) r/(tree a)}) ::
317+ |*(a=mold $@($~ [n=a l=(tree a) r=(tree a)]))
269−Examples
320+#### Examples
272− > `(tree {@ tape})`[[1 "hi"] [[2 "bye"] ~ ~] ~]
322+ > `(tree [@ tape])`[[1 "hi"] [[2 "bye"] ~ ~] ~]
273 {[2 "bye"] [1 "hi"]}
323 {[2 "bye"] [1 "hi"]}
@@ -279,21 +329,21 @@ Examples
280Mold of three types
330Mold of three types
282−`++mold` of the tuple of the three types passed in.
332+A mold generator. A mold of the tuple of the three types passed in.
284−Source
334+#### Source
287− ++ trel |* {a/$-(* *) b/$-(* *) c/$-(* *)} :: just a triple
336+ ++ trel
288− {p/a q/b r/c} ::
337+ |*([a=mold b=mold c=mold] [p=a q=b r=c])
291−Examples
340+#### Examples
294 > *(trel @ud @t @s)
342 > *(trel @ud @t @s)
295 [p=0 q='' r=--0]
343 [p=0 q='' r=--0]
345+ > *(trel cord bloq tape)
@@ -301,32 +351,33 @@ Examples
304−mold generator. A `++unit` is either `~` or `[~ u=a]` where `a` is the
354+A mold generator. A `unit` is either `~` or `[~ u=a]`, where `a` is the
305type that was passed in.
355type that was passed in.
308−Source
358+#### Source
311− ++ unit |* a/$-(* *) :: maybe
361+ |*(a=mold $@($~ [$~ u=a]))
315−Examples
363+#### Examples
320 > ? *(unit time)
366 > ? *(unit time)
321− ?({$~ u/@da} $~)
367+ ?({$~ u/@da} $~)
324− > > =a |= a/@
370+ > =a |= a=@
325− ^- (unit @)
371+ ^- (unit @)
379+Using a `unit` allows you to specify something that may not be there.
381+See also: [`++bind`](../2b)