on 65048fe help sign in
251 lines 4.9 kB history raw
1# 2q: molds and mold builders
2### `++char`
4Char
6A single character. odor `@tD` designates a single unicode byte. All
7parsers consume `++tape`s, which are lists of `++char`.
10Source
11------
13 ++ char @tD :: UTF-8 byte
15Examples
16--------
18 > *char
19 ''
20 ~zod/try> (char 97)
21 'a'
25***
26### `++cord`
28UTF-8 text
30One of Hoon's two string types (the other being `++tape`). A cord is an
31atom of UTF-8 text. `++trip` and `++crip` convert between cord and
32`++tape`.
34Source
35------
37 ++ cord @t :: text atom (UTF-8)
39Examples
40--------
42Odor `@t` designates a Unicode atom, little-endian: the first character
43in the text is the low byte.
45 > `@ux`'foobar'
46 0x7261.626f.6f66
48 > `@`'urbit'
49 499.984.265.845
50 > (cord 499.984.265.845)
51 'urbit'
55***
56### `++date`
58Point in time
60A boolean designating AD or BC, a year atom, a month
61atom, and a `++tarp`, which is a day atom and a time.
63Source
64------
66 ++ date {{a/? y/@ud} m/@ud t/tarp} :: parsed date
69Examples
70--------
72See also: `++year`, `++yore` `++stud`, `++dust`
74 > `date`(yore ~2014.6.6..21.09.15..0a16)
75 [[a=%.y y=2.014] m=6 t=[d=6 h=21 m=9 s=15 f=~[0xa16]]]
78***
79### `++tang`
81 ++ tang (list tank) :: general error
83Unused XX
87***
88### `++tank`
90Pretty-printing structure.
92A `++tank` is one of three cases: a `%leaf`
93is simply a string; a `%palm` is XX need more information; and a `%rose` is a
94list of `++tank` delimted by the strings in `p`.
97Source
98------
100 ++ tank $% {$leaf p/tape} :: printing formats
101 $: $palm :: backstep list
102 p/{p/tape q/tape r/tape s/tape} ::
103 q/(list tank) ::
104 == ::
105 $: $rose :: flat list
106 p/{p/tape q/tape r/tape} :: mid open close
107 q/(list tank) ::
108 == ::
109 == ::
111Examples
112--------
114 > >(bex 20) (bex 19)<
115 [%rose p=[p=" " q="[" r="]"] q=~[[%leaf p="1.048.576"] [%leaf p="524.288"]]]
116 > (wash [0 80] >(bex 20) (bex 19)<) :: at 80 cols
117 <<"[1.048.576 524.288]">>
118 > (wash [0 15] >(bex 20) (bex 19)<) :: at 15 cols (two lines)
119 <<"[ 1.048.576" " 524.288" "]">>
121 > [(bex 150) (bex 151)] :: at 80 cols
122 [ 1.427.247.692.705.959.881.058.285.969.449.495.136.382.746.624
123 2.854.495.385.411.919.762.116.571.938.898.990.272.765.493.248
124 ]
128***
130### `++tape`
132List of chars
134One of Hoon's two string types, the other being `++cord`. A tape is a
135list of chars.
137Source
138------
140 ++ tape (list char) :: like a string
142Examples
143--------
145 > `(list ,char)`"foobar"
146 "foobar"
147 > `(list ,@)`"foobar"
148 ~[102 111 111 98 97 114]
151***
152### `++tarp`
154Day through second
156The remaining part of a `++date`: day, hour, minute, second and a list
157of `@ux` for precision.
159Source
160------
162 ++ tarp {d/@ud h/@ud m/@ud s/@ud f/(list @ux)} :: parsed time
165Examples
166--------
169 > -<-
170 ~2014.9.20..00.43.33..b52a
171 > :: the time is always in your context at -<-
172 > (yell -<-)
173 [d=106.751.991.820.278 h=0 m=43 s=39 f=~[0x54d1]]
175 > (yell ~d20)
176 [d=20 h=0 m=0 s=0 f=~]
180***
181### `++term`
183Hoon constants
185A restricted text atom for Hoon constants. The only characters permitted are
186lowercase ASCII, `-`, and `0-9`, the latter two of which can neither be the first or last
187character. The syntax for `@tas` is the text itself, always preceded by `%`.
188This means a term is always cubical. The empty `@tas` has a special syntax,
189`$`.
192Source
193------
195 ++ term @tas :: Hoon ASCII subset
197Examples
198--------
200 > *term
201 %$
203 > %dead-fish9
204 %dead-fish9
205 > -:!>(%dead-fish9)
206 [%cube p=271.101.667.197.767.630.546.276 q=[%atom p=%tas]]
210***
211### `++wain`
213 ++ wain (list cord) :: text lines (no \n)
215A list of lines. A `++wain` is used instead of a single `++cord` with
216`\n`.
218See also: `++lore`, `++role`
220 > `wain`/som/del/rok
221 <|som del rok|>
224***
225### `++wall`
227List of lines
230A `++wall` is used instead of a single `++tape` with
231`\n`.
233Source
234------
236 ++ wall (list tape) :: text lines (no \n)
238Examples
239--------
241See also: `++wash`
243 > `wall`(wash [0 20] leaf+<(bex 256)>)
244 <<
245 "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"
246 >>
251***