@@ -4,35 +4,33 @@ weight = 1
4template = "doc.html"
4template = "doc.html"
5aliases = ["docs/reference/hoon-expressions/rune/constants/"]
5aliases = ["docs/reference/hoon-expressions/rune/constants/"]
7The simplest expressions in every language are constants:
8The 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
9se, because they have interpolations.)
10se, because they have interpolations.)
13−### `:_ "Cold Atom"`
12+## "Cold Atom"
15−`[%rock p=term q=@]`; a constant, cold atom.
14+A constant, cold atom.
17−A cold atom is one whose type is inferred to be of a single atom constant.
19−##### Produces
16+#### Syntax
21−A cold (fixed) atom `q` with aura `p`.
18+Any [warm atom](#warm) form, prefixed with `%`.
23−##### Syntax
20+#### AST
25−Irregular: any [warm atom](#warm) form, prefixed with `%`.
22+```hoon
27−Irregular: e.g., `%hi`. Character constraints: `a-z`
26+#### Discussion
28−lowercase to start, `a-z` or `0-9` thereafter, with infix
29−hyphens (`hep`), "kebab-case."
31−Irregular: `~`.
28+A cold atom is one whose type is inferred to be of a single atom constant.
33−##### Examples
30+#### Examples
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,
38> (ream '%hi')
36> (ream '%hi')
@@ -45,20 +43,22 @@ We can see the contrast with warm atoms by using the compiler parser function, `
45[%rock p=%ud q=12]
43[%rock p=%ud q=12]
48−### `:_` "Paths"
48+## "Paths"
50−`[%path p=(list (each @ta hoon))]`: path with interpolation.
50+Path with interpolation.
52−##### Produces
52+#### Syntax
54−A null-terminated list of the items in `p`, which are either constant
54+`/this/is/a/path`
55−`@ta` atoms (`knots`), or expressions producing a `knot`.
57−##### Syntax
56+#### Produces
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`.
61−##### Examples
61+#### Examples
64> `path`/this/is/a/path
64> `path`/this/is/a/path
@@ -74,19 +74,19 @@ Irregular: `/this/is/a/path`.
77−### `:_` "Strings with Interpolation"
77+---
79−`[%knit p=(list (each @t hoon))]`: text string with interpolation.
79+## "Strings with Interpolation"
81−##### Produces
81+Text string with interpolation.
85−##### Syntax
85+A [$tape](/docs/hoon/reference/stdlib/2q#tape)
87−Irregular: `"abcdefg"`.
87+`"abcdefg"`
89−Irregular: `"abc{(weld "lmnop" "xyz")}defg"`.
89+`"abc{(weld "lmnop" "xyz")}defg"`
92> "abcdefg"
92> "abcdefg"
@@ -99,7 +99,17 @@ Irregular: `"abc{(weld "lmnop" "xyz")}defg"`.
99[%knit p=~[97 98 99 100 101 102 103]]
99[%knit p=~[97 98 99 100 101 102 103]]
105+[%knit p=(list woof)]
102−##### Examples
112+#### Examples
@@ -122,11 +132,63 @@ String with interpolated prettyprinting:
122"hello, %world."
132"hello, %world."
125−### `:_` "Warm Atoms" {#warm}
137+## "Warm Atoms" {#warm}
139+A constant, warm atom.
146+Aura Meaning Example Literal Syntax
147+-------------------------------------------------------------------------
149+@c Unicode codepoint ~-~45fed
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) &
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
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
127−`[%sand p=term q=@]`; a constant, warm atom.
185+[%sand p=term q=*]
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
@@ -136,9 +198,10 @@ A 'warm' atom is one whose type is inferred to be general, i.e., not just a sing
139−##### Produces
201+#### Produces
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:
144> (ream '12')
207> (ream '12')
@@ -147,47 +210,3 @@ A warm (variable) atom `q` with aura `p`. Use the Hoon compiler parser function
147> (ream '\'Hello!\'')
210> (ream '\'Hello!\'')
148[%sand p=%t q=36.762.444.129.608]
211[%sand p=%t q=36.762.444.129.608]
151−##### Syntax by example
153−Irregular. A table of examples:
157−@da 128-bit absolute date ~2016.4.23..20.09.26..f27b..dead..beef..babe
159−@dr 128-bit relative date ~s17 (17 seconds)
162−@f loobean & (0, yes)
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)
173−@sd signed decimal --2 (2)
175−@sv signed base32 --0v68 (200)
177−@sw signed base64 --0w38 (200)
179−@sx signed hexadecimal --0x2 (2)
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)
187−@uv unsigned base32 0v3ic5h.6urr6
188−@uw unsigned base64 0wsC5.yrSZC
189−@ux unsigned hexadecimal 0xcafe.babe
192−The `@uv` characters are `0-9`, `a-v`. The `@uw` characters are
193−`0-9`, `a-z`, `A-Z`, `-` and `~`.