@@ -4,35 +4,33 @@ weight = 1
44template = "doc.html"
55aliases = ["docs/reference/hoon-expressions/rune/constants/"]
66+++
7+
78The simplest expressions in every language are constants:
8−atoms, strings, paths. (Strings and paths aren't all constants per
9+atoms, strings, paths. (Strings and paths aren't all constants per
910se, because they have interpolations.)
1011
11−## Expressions
12−
13−### `:_ "Cold Atom"`
12+## "Cold Atom"
1413
15−`[%rock p=term q=@]`; a constant, cold atom.
16−
17−A cold atom is one whose type is inferred to be of a single atom constant.
14+A constant, cold atom.
1815
19−##### Produces
16+#### Syntax
2017
21−A cold (fixed) atom `q` with aura `p`.
18+Any [warm atom](#warm) form, prefixed with `%`.
2219
23−##### Syntax
20+#### AST
2421
25−Irregular: any [warm atom](#warm) form, prefixed with `%`.
22+```hoon
23+[%rock p=term q=*]
24+```
2625
27−Irregular: e.g., `%hi`. Character constraints: `a-z`
28−lowercase to start, `a-z` or `0-9` thereafter, with infix
29−hyphens (`hep`), "kebab-case."
26+#### Discussion
3027
31−Irregular: `~`.
28+A cold atom is one whose type is inferred to be of a single atom constant.
3229
33−##### Examples
30+#### Examples
3431
35−We can see the contrast with warm atoms by using the compiler parser function, `ream`:
32+We can see the contrast with warm atoms by using the compiler parser function,
33+`ream`:
3634
3735```
3836> (ream '%hi')
@@ -45,20 +43,22 @@ We can see the contrast with warm atoms by using the compiler parser function, `
4543[%rock p=%ud q=12]
4644```
4745
48−### `:_` "Paths"
46+---
47+
48+## "Paths"
4949
50−`[%path p=(list (each @ta hoon))]`: path with interpolation.
50+Path with interpolation.
5151
52−##### Produces
52+#### Syntax
5353
54−A null-terminated list of the items in `p`, which are either constant
55−`@ta` atoms (`knots`), or expressions producing a `knot`.
54+`/this/is/a/path`
5655
57−##### Syntax
56+#### Produces
5857
59−Irregular: `/this/is/a/path`.
58+A null-terminated list of the items, which are either constant `@ta` atoms
59+(`knots`), or expressions producing a `knot`.
6060
61−##### Examples
61+#### Examples
6262
6363```
6464> `path`/this/is/a/path
@@ -74,19 +74,19 @@ Irregular: `/this/is/a/path`.
7474~
7575```
7676
77−### `:_` "Strings with Interpolation"
77+---
7878
79−`[%knit p=(list (each @t hoon))]`: text string with interpolation.
79+## "Strings with Interpolation"
8080
81−##### Produces
81+Text string with interpolation.
8282
83−A tape.
83+#### Syntax
8484
85−##### Syntax
85+A [$tape](/docs/hoon/reference/stdlib/2q#tape)
8686
87−Irregular: `"abcdefg"`.
87+`"abcdefg"`
8888
89−Irregular: `"abc{(weld "lmnop" "xyz")}defg"`.
89+`"abc{(weld "lmnop" "xyz")}defg"`
9090
9191```
9292> "abcdefg"
@@ -99,7 +99,17 @@ Irregular: `"abc{(weld "lmnop" "xyz")}defg"`.
9999[%knit p=~[97 98 99 100 101 102 103]]
100100```
101101
102−##### Examples
102+#### AST
103+
104+```hoon
105+[%knit p=(list woof)]
106+```
107+
108+#### Produces
109+
110+A tape.
111+
112+#### Examples
103113
104114String:
105115
@@ -122,11 +132,63 @@ String with interpolated prettyprinting:
122132"hello, %world."
123133```
124134
125−### `:_` "Warm Atoms" {#warm}
135+---
136+
137+## "Warm Atoms" {#warm}
138+
139+A constant, warm atom.
140+
141+#### Syntax
142+
143+A table of examples:
144+
145+```
146+Aura Meaning Example Literal Syntax
147+-------------------------------------------------------------------------
148+@ empty aura
149+@c Unicode codepoint ~-~45fed
150+@d date
151+ @da absolute date ~2018.5.14..22.31.46..1435
152+ @dr relative date (ie, timespan) ~h5.m30.s12
153+@f Loobean (for compiler, not castable) &
154+@i Internet address
155+ @if IPv4 address .195.198.143.90
156+ @is IPv6 address .0.0.0.0.0.1c.c3c6.8f5a
157+@n nil (for compiler, not castable) ~
158+@p phonemic base (ship name) ~sorreg-namtyv
159+@q phonemic base, unscrambled .~litsyn-polbel
160+@r IEEE-754 floating-point
161+ @rh half precision (16 bits) .~~3.14
162+ @rs single precision (32 bits) .6.022141e23
163+ @rd double precision (64 bits) .~6.02214085774e23
164+ @rq quad precision (128 bits) .~~~6.02214085774e23
165+@s signed integer, sign bit low
166+ @sb signed binary --0b11.1000
167+ @sd signed decimal --1.000.056
168+ @sv signed base32 -0v1df64.49beg
169+ @sw signed base64 --0wbnC.8haTg
170+ @sx signed hexadecimal -0x5f5.e138
171+@t UTF-8 text (cord) 'howdy'
172+ @ta ASCII text (knot) ~.howdy
173+ @tas ASCII text symbol (term) %howdy
174+@u unsigned integer
175+ @ub unsigned binary 0b11.1000
176+ @ud unsigned decimal 1.000.056
177+ @uv unsigned base32 0v1df64.49beg
178+ @uw unsigned base64 0wbnC.8haTg
179+ @ux unsigned hexadecimal 0x5f5.e138
180+```
181+
182+#### AST
126183
127−`[%sand p=term q=@]`; a constant, warm atom.
184+```hoon
185+[%sand p=term q=*]
186+```
187+
188+#### Discussion
128189
129−A 'warm' atom is one whose type is inferred to be general, i.e., not just a single atom type.
190+A 'warm' atom is one whose type is inferred to be general, i.e., not just a
191+single atom type.
130192
131193```
132194> `@`12
@@ -136,9 +198,10 @@ A 'warm' atom is one whose type is inferred to be general, i.e., not just a sing
136198nest-fail
137199```
138200
139−##### Produces
201+#### Produces
140202
141−A warm (variable) atom `q` with aura `p`. Use the Hoon compiler parser function `ream` to take a closer look:
203+A warm (variable) atom `q` with aura `p`. Use the Hoon compiler parser function
204+`ream` to take a closer look:
142205
143206```
144207> (ream '12')
@@ -147,47 +210,3 @@ A warm (variable) atom `q` with aura `p`. Use the Hoon compiler parser function
147210> (ream '\'Hello!\'')
148211[%sand p=%t q=36.762.444.129.608]
149212```
150−
151−##### Syntax by example
152−
153−Irregular. A table of examples:
154−
155−```
156−@c UTF-32 ~-foobar
157−@da 128-bit absolute date ~2016.4.23..20.09.26..f27b..dead..beef..babe
158− ~2016.4.23
159−@dr 128-bit relative date ~s17 (17 seconds)
160− ~m20 (20 minutes)
161− ~d42 (42 days)
162−@f loobean & (0, yes)
163− | (1, no)
164−@p ~zod (0)
165−@rd 64-bit IEEE float .~3.14 (pi)
166− .~-3.14 (negative pi)
167−@rs 32-bit IEEE float .3.14 (pi)
168− .-3.14 (negative pi)
169−@rq 128-bit IEEE float .~~~3.14 (pi)
170−@rh 16-bit IEEE float .~~3.14 (pi)
171−@sb signed binary --0b10 (2)
172− -0b101 (-5)
173−@sd signed decimal --2 (2)
174− -5 (-5)
175−@sv signed base32 --0v68 (200)
176− -0vfk (-500)
177−@sw signed base64 --0w38 (200)
178− -0w7Q (500)
179−@sx signed hexadecimal --0x2 (2)
180− -0x5 -5
181−@t UTF-8 text (cord) 'foobar'
182−@ta ASCII text (knot) ~.foobar
183−@ub unsigned binary 0b10 (2)
184−@uc bitcoin address 0c1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa
185−@ud unsigned decimal 42 (42)
186− 1.420 (1420)
187−@uv unsigned base32 0v3ic5h.6urr6
188−@uw unsigned base64 0wsC5.yrSZC
189−@ux unsigned hexadecimal 0xcafe.babe
190−```
191−
192−The `@uv` characters are `0-9`, `a-v`. The `@uw` characters are
193−`0-9`, `a-z`, `A-Z`, `-` and `~`.