@@ -6,23 +6,22 @@ navhome: /docs/
66# 2q: molds and mold builders
77### `++char`
88
9−Char
9+Character
1010
11−A single character. odor `@tD` designates a single unicode byte. All
12−parsers consume `++tape`s, which are lists of `++char`.
11+A single character. Aura `@tD` designates a single unicode byte. All parsers
12+consume `tape`s, which are lists of `char`.
1313
1414
15−Source
16−------
15+#### Source
1716
18− ++ char @tD :: UTF-8 byte
17+ ++ char @tD
1918
20−Examples
21−--------
19+#### Examples
2220
2321 > *char
2422 ''
25− ~zod/try> (char 97)
23+
24+ > (char 97)
2625 'a'
2726
2827
@@ -32,123 +31,185 @@ Examples
3231
3332UTF-8 text
3433
35−One of Hoon's two string types (the other being `++tape`). A cord is an
36−atom of UTF-8 text. `++trip` and `++crip` convert between cord and
37−`++tape`.
34+One of Hoon's two string types (the other being `tape`). A cord is an
35+atom of UTF-8 text.
3836
39−Source
40−------
37+#### Source
4138
42− ++ cord @t :: text atom (UTF-8)
39+ ++ cord @t
4340
44−Examples
45−--------
41+#### Examples
4642
47−Odor `@t` designates a Unicode atom, little-endian: the first character
48−in the text is the low byte.
4943
5044 > `@ux`'foobar'
5145 0x7261.626f.6f66
5246
47+ > (cord 97)
48+ 'a'
49+
5350 > `@`'urbit'
5451 499.984.265.845
52+
5553 > (cord 499.984.265.845)
5654 'urbit'
5755
5856
57+#### Discussion
58+
59+Aura `@t` designates a Unicode atom, little-endian: the first character
60+in the text is the least-significant byte.
61+
62+[`trip`](../4b) converts from `cord` to `tape`, and [`crip`](../4b) converts
63+from `tape` to `cord`.
64+
65+
5966
6067***
6168### `++date`
6269
6370Point in time
6471
65−A boolean designating AD or BC, a year atom, a month
66−atom, and a `++tarp`, which is a day atom and a time.
67−
68−Source
69−------
72+A boolean designating AD or BC, a year atom, a month atom, and a `tarp`,
73+which is a day atom and a time.
7074
71− ++ date {{a/? y/@ud} m/@ud t/tarp} :: parsed date
75+#### Source
7276
77+ ++ date [[a=? y=@ud] m=@ud t=tarp]
7378
74−Examples
75−--------
7679
77−See also: `++year`, `++yore` `++stud`, `++dust`
80+#### Examples
7881
7982 > `date`(yore ~2014.6.6..21.09.15..0a16)
8083 [[a=%.y y=2.014] m=6 t=[d=6 h=21 m=9 s=15 f=~[0xa16]]]
8184
85+ > now
86+ ~2018.5.25..17.55.15..9ad8
87+
88+
89+
90+#### Discussion
91+
92+See also: [`year`](../3c), [`yore`](../3c) [`stud`](../2q), [`dust`](../2q)
93+
94+***
95+### `++knot`
96+
97+ASCII
98+
99+An atom type that only permits ASCII characters.
100+
101+#### Source
102+
103+++ knot @ta
104+
105+#### Examples
106+
107+ > (knot 105)
108+ ~.i
109+
110+
82111
83112***
84113### `++tang`
85114
86− ++ tang (list tank) :: general error
115+Generic print structure
116+
117+A list of `tank`s. It's for printing types and bottom-up printing of stack
118+traces.
87119
88−Unused XX
120+#### Source
89121
122+++ tang (list tank)
123+
124+#### Examples
125+
126+ > (~(win re [%palm ["1" "2" "3" "4"] [%leaf "foobar"] [%leaf "bazbud"] [%leaf "zzzzzzqaaa"] ~]) 0 50)
127+ <<"23foobar1bazbud1zzzzzzqaaa4">>
128+
129+ > (~(win re [%palm ["1" "2" "3" "4"] [%leaf "foobar"] [%leaf "bazbud"] [%leaf "zzzzzzqaaa"] ~]) 0 10)
130+ <<"2 foobar" " bazbud" "zzzzzzqaaa">>
131+
132+ > (~(win re [%rose ["1" "2" "3"] [%leaf "foobar"] [%leaf "bazbud"] ~]) 0 20)
133+ <<"2foobar1bazbud3">>
134+
135+ > (~(win re [%rose ["1" "2" "3"] [%leaf "foobar"] [%leaf "bazbud"] ~]) 0 10)
136+ <<"2 foobar" " bazbud" "3">>
90137
91138
92139***
93140### `++tank`
94141
95−Pretty-printing structure.
142+Pretty-printing structure
143+
144+A `tank` is one of three cases: a `%leaf` is simply a string (a printed line);
145+ a `%palm` is list of `tank` delimited by the strings in `p`, with back-steps at
146+new lines; and a `%rose` is a list of `tank` delimited by the strings in `p`
147+without back-steps at new lines.
96148
97−A `++tank` is one of three cases: a `%leaf`
98−is simply a string; a `%palm` is XX need more information; and a `%rose` is a
99−list of `++tank` delimted by the strings in `p`.
100149
150+#### Source
101151
102−Source
103−------
152+ ++ tank $% [$leaf p=tape]
153+ $: $palm
154+ p=[p=tape q=tape r=tape s=tape]
155+ q=(list tank)
156+ ==
157+ $: $rose
158+ p=[p=tape q=tape r=tape]
159+ q=(list tank)
160+ ==
161+ ==
104162
105− ++ tank $% {$leaf p/tape} :: printing formats
106− $: $palm :: backstep list
107− p/{p/tape q/tape r/tape s/tape} ::
108− q/(list tank) ::
109− == ::
110− $: $rose :: flat list
111− p/{p/tape q/tape r/tape} :: mid open close
112− q/(list tank) ::
113− == ::
114− == ::
163+#### Examples
115164
116−Examples
117−--------
118165
119− > >(bex 20) (bex 19)<
120− [%rose p=[p=" " q="[" r="]"] q=~[[%leaf p="1.048.576"] [%leaf p="524.288"]]]
121− > (wash [0 80] >(bex 20) (bex 19)<) :: at 80 cols
166+ > (wash [0 80] >(bex 20) (bex 19)<) :: at 80 cols
122167 <<"[1.048.576 524.288]">>
123− > (wash [0 15] >(bex 20) (bex 19)<) :: at 15 cols (two lines)
168+
169+ > (wash [0 15] >(bex 20) (bex 19)<) :: at 15 cols
124170 <<"[ 1.048.576" " 524.288" "]">>
125171
126− > [(bex 150) (bex 151)] :: at 80 cols
172+ > [(bex 150) (bex 151)] :: at 80 cols
127173 [ 1.427.247.692.705.959.881.058.285.969.449.495.136.382.746.624
128174 2.854.495.385.411.919.762.116.571.938.898.990.272.765.493.248
129175 ]
130176
177+ > (wash [0 40] >(bex 150) (bex 151)<)
178+ <<
179+ "[ \\/1.427.247.692.705.959.881.058.285.\\/"
180+ " 969.449.495.136.382.746.624"
181+ " \\/ \\/"
182+ " \\/2.854.495.385.411.919.762.116.571.\\/"
183+ " 938.898.990.272.765.493.248"
184+ " \\/ \\/"
185+ "]"
186+ >>
131187
132188
133−***
134189
190+***
135191### `++tape`
136192
137−List of chars
193+List of characters
138194
139−One of Hoon's two string types, the other being `++cord`. A tape is a
140−list of chars.
195+One of Hoon's two string types, the other being `++cord`. A tape is a list of
196+`char`.
141197
142−Source
143−------
198+#### Source
144199
145− ++ tape (list char) :: like a string
200+ ++ tape (list @tD)
146201
147−Examples
148−--------
202+#### Examples
149203
150− > `(list char)`"foobar"
204+ > `tape`"foobar"
151205 "foobar"
206+
207+ >`(list @t)`"foobar"
208+ <|f o o b a r|>
209+
210+ >`(list @tD)`"foobar"
211+ "foobar"
212+
152213 > `(list @)`"foobar"
153214 ~[102 111 111 98 97 114]
154215
@@ -156,26 +217,27 @@ Examples
156217***
157218### `++tarp`
158219
159−Day through second
220+Parsed time
221+
222+The time component of a `date`: day, hour, minute, second and a list of `@ux`
223+ for precision.
160224
161−The remaining part of a `++date`: day, hour, minute, second and a list
162−of `@ux` for precision.
225+#### Source
163226
164−Source
165−------
227+ ++ tarp [d=@ud h=@ud m=@ud s=@ud f=(list @ux)]
166228
167− ++ tarp {d/@ud h/@ud m/@ud s/@ud f/(list @ux)} :: parsed time
168229
230+#### Examples
169231
170−Examples
171−--------
172232
233+ > *tarp
234+ [d=0 h=0 m=0 s=0 f=~]
173235
174− > -<-
175− ~2014.9.20..00.43.33..b52a
176− > :: the time is always in your context at -<-
177− > (yell -<-)
178− [d=106.751.991.820.278 h=0 m=43 s=39 f=~[0x54d1]]
236+ > (yell now)
237+ [d=106.751.991.821.625 h=22 m=58 s=10 f=~[0x44ff]]
238+
239+ > `tarp`(yell ~2014.6.6..21.09.15..0a16)
240+ [d=106.751.991.820.172 h=21 m=9 s=15 f=~[0xa16]]
179241
180242 > (yell ~d20)
181243 [d=20 h=0 m=0 s=0 f=~]
@@ -185,42 +247,48 @@ Examples
185247***
186248### `++term`
187249
188−Hoon constants
250+Hoon constant
189251
190252A restricted text atom for Hoon constants. The only characters permitted are
191−lowercase ASCII, `-`, and `0-9`, the latter two of which can neither be the first or last
192−character. The syntax for `@tas` is the text itself, always preceded by `%`.
193−This means a term is always cubical. The empty `@tas` has a special syntax,
194−`$`.
253+lowercase ASCII letters, `-`, and `0-9`, the latter two of which cannot be the
254+first character. The syntax for `@tas` is the text itself, always preceded by
255+`%`. The empty `@tas` has a
256+special syntax, `$`.
195257
196258
197−Source
198−------
259+#### Source
199260
200− ++ term @tas :: Hoon ASCII subset
261+ ++ term @tas
201262
202−Examples
203−--------
263+#### Examples
204264
205265 > *term
206266 %$
207267
268+ > *%term
269+ %term
270+
208271 > %dead-fish9
209272 %dead-fish9
273+
210274 > -:!>(%dead-fish9)
211− [%cube p=271.101.667.197.767.630.546.276 q=[%atom p=%tas]]
275+ #t/$dead-fish9
212276
213277
214278
215279***
216280### `++wain`
217281
218− ++ wain (list cord) :: text lines (no \n)
282+List of strings
219283
220−A list of lines. A `++wain` is used instead of a single `++cord` with
221−`\n`.
284+A list of `cord`s. A `wain` is used instead of a single `cord` with `\n`.
222285
223−See also: `++lore`, `++role`
286+
287+#### Source
288+
289+ ++ wain (list cord)
290+
291+#### Examples
224292
225293 > `wain`/som/del/rok
226294 <|som del rok|>
@@ -229,28 +297,29 @@ See also: `++lore`, `++role`
229297***
230298### `++wall`
231299
232−List of lines
300+List of list of characters
233301
302+A list of `tape`s. `wall` is used instead of a single `tape` with `\n`.
234303
235−A `++wall` is used instead of a single `++tape` with
236−`\n`.
304+#### Source
237305
238−Source
239−------
306+ ++ wall (list tape)
240307
241− ++ wall (list tape) :: text lines (no \n)
308+#### Examples
242309
243−Examples
244−--------
245−
246−See also: `++wash`
247310
248311 > `wall`(wash [0 20] leaf+<(bex 256)>)
249312 <<
250− "115.792.089.237.316.195.423.570.985.008.687.907.853.269.984.665.640.564.039.457.584.007.913.129.639.936"
313+ "\\/115.792.089.237.\\/"
314+ " 316.195.423.570."
315+ " 985.008.687.907."
316+ " 853.269.984.665."
317+ " 640.564.039.457."
318+ " 584.007.913.129."
319+ " 639.936"
320+ "\\/ \\/"
251321 >>
252322
253323
254324
255−
256325***