on 8564483 help sign in
256 lines 4.9 kB history raw
1---
2navhome: /docs
3---
6# 2q: molds and mold builders
7### `++char`
9Char
11A single character. odor `@tD` designates a single unicode byte. All
12parsers consume `++tape`s, which are lists of `++char`.
15Source
16------
18 ++ char @tD :: UTF-8 byte
20Examples
21--------
23 > *char
24 ''
25 ~zod/try> (char 97)
26 'a'
30***
31### `++cord`
33UTF-8 text
35One of Hoon's two string types (the other being `++tape`). A cord is an
36atom of UTF-8 text. `++trip` and `++crip` convert between cord and
37`++tape`.
39Source
40------
42 ++ cord @t :: text atom (UTF-8)
44Examples
45--------
47Odor `@t` designates a Unicode atom, little-endian: the first character
48in the text is the low byte.
50 > `@ux`'foobar'
51 0x7261.626f.6f66
53 > `@`'urbit'
54 499.984.265.845
55 > (cord 499.984.265.845)
56 'urbit'
60***
61### `++date`
63Point in time
65A boolean designating AD or BC, a year atom, a month
66atom, and a `++tarp`, which is a day atom and a time.
68Source
69------
71 ++ date {{a/? y/@ud} m/@ud t/tarp} :: parsed date
74Examples
75--------
77See also: `++year`, `++yore` `++stud`, `++dust`
79 > `date`(yore ~2014.6.6..21.09.15..0a16)
80 [[a=%.y y=2.014] m=6 t=[d=6 h=21 m=9 s=15 f=~[0xa16]]]
83***
84### `++tang`
86 ++ tang (list tank) :: general error
88Unused XX
92***
93### `++tank`
95Pretty-printing structure.
97A `++tank` is one of three cases: a `%leaf`
98is simply a string; a `%palm` is XX need more information; and a `%rose` is a
99list of `++tank` delimted by the strings in `p`.
102Source
103------
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 == ::
116Examples
117--------
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
122 <<"[1.048.576 524.288]">>
123 > (wash [0 15] >(bex 20) (bex 19)<) :: at 15 cols (two lines)
124 <<"[ 1.048.576" " 524.288" "]">>
126 > [(bex 150) (bex 151)] :: at 80 cols
127 [ 1.427.247.692.705.959.881.058.285.969.449.495.136.382.746.624
128 2.854.495.385.411.919.762.116.571.938.898.990.272.765.493.248
129 ]
133***
135### `++tape`
137List of chars
139One of Hoon's two string types, the other being `++cord`. A tape is a
140list of chars.
142Source
143------
145 ++ tape (list char) :: like a string
147Examples
148--------
150 > `(list ,char)`"foobar"
151 "foobar"
152 > `(list ,@)`"foobar"
153 ~[102 111 111 98 97 114]
156***
157### `++tarp`
159Day through second
161The remaining part of a `++date`: day, hour, minute, second and a list
162of `@ux` for precision.
164Source
165------
167 ++ tarp {d/@ud h/@ud m/@ud s/@ud f/(list @ux)} :: parsed time
170Examples
171--------
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]]
180 > (yell ~d20)
181 [d=20 h=0 m=0 s=0 f=~]
185***
186### `++term`
188Hoon constants
190A restricted text atom for Hoon constants. The only characters permitted are
191lowercase ASCII, `-`, and `0-9`, the latter two of which can neither be the first or last
192character. The syntax for `@tas` is the text itself, always preceded by `%`.
193This means a term is always cubical. The empty `@tas` has a special syntax,
194`$`.
197Source
198------
200 ++ term @tas :: Hoon ASCII subset
202Examples
203--------
205 > *term
206 %$
208 > %dead-fish9
209 %dead-fish9
210 > -:!>(%dead-fish9)
211 [%cube p=271.101.667.197.767.630.546.276 q=[%atom p=%tas]]
215***
216### `++wain`
218 ++ wain (list cord) :: text lines (no \n)
220A list of lines. A `++wain` is used instead of a single `++cord` with
221`\n`.
223See also: `++lore`, `++role`
225 > `wain`/som/del/rok
226 <|som del rok|>
229***
230### `++wall`
232List of lines
235A `++wall` is used instead of a single `++tape` with
236`\n`.
238Source
239------
241 ++ wall (list tape) :: text lines (no \n)
243Examples
244--------
246See also: `++wash`
248 > `wall`(wash [0 20] leaf+<(bex 256)>)
249 <<
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"
251 >>
256***