@@ -7,17 +7,53 @@ aliases = ["docs/reference/hoon-expressions/rune/dot/"]
8Anything Nock can do, Hoon can do also. These runes are used for carrying out Nock operations in Hoon.
8Anything Nock can do, Hoon can do also. These runes are used for carrying out Nock operations in Hoon.
10−## Runes
10+## `.^` "dotket"
12−### `.^` "dotket"
12+Load from the Arvo namespace (scry) with a fake Nock instruction: Nock 12.
14−`[%dtkt p=spec q=hoon]`: load from the Arvo namespace with a fake Nock instruction: 'Nock `12`''.
14+#### AST
16−##### Produces
20+#### Produces
18The noun `q`, cast to the type `p`.
22The noun `q`, cast to the type `p`.
26+Two arguments, with the second optionally split into an arbitrary number of
29+While this rune technically takes a fixed number of arguments, `q` is usually
30+split into at least two parts, and the tall form of this rune must be terminated
31+with a `==`. Note also that the `==` does not make the arguments into a list as
32+you might expect, so `q` must be explicitly null-terminated if its elements are
20−##### Discussion
56+#### Discussion
22Nock has no `12` instruction! But the virtual Nock
58Nock has no `12` instruction! But the virtual Nock
23used to run userspace code does. Nock `12` loads from a
59used to run userspace code does. Nock `12` loads from a
@@ -29,7 +65,7 @@ Ordinarily a Hoon expression has access to no information but whatever can be fo
30In principle `.^` takes two subexpressions, but in practice `q` is often given in two parts: the first part includes the vane to be queried (e.g., `%a` for Ames, `%b` for Behn, `%c` for Clay, etc.) and the kind of request. The second part is a path that corresponds to the kind of request.
66In principle `.^` takes two subexpressions, but in practice `q` is often given in two parts: the first part includes the vane to be queried (e.g., `%a` for Ames, `%b` for Behn, `%c` for Clay, etc.) and the kind of request. The second part is a path that corresponds to the kind of request.
32−##### Examples
68+#### Examples
34In the dojo we can ask Clay -- the Arvo filesystem -- for a listing of the files at our current path, `%`:
70In the dojo we can ask Clay -- the Arvo filesystem -- for a listing of the files at our current path, `%`:
@@ -37,17 +73,14 @@ In the dojo we can ask Clay -- the Arvo filesystem -- for a listing of the files
37> .^(arch %cy %)
73> .^(arch %cy %)
42− [p=~.app q=~]
76+ { [p=~.app q=~]
47 [p=~.sur q=~]
77 [p=~.sur q=~]
50 [p=~.gen q=~]
78 [p=~.gen q=~]
@@ -67,38 +100,57 @@ You can modify the time of the file listing quite simply and ask for a listing f
67> .^(arch %cy /(scot %p our)/base/(scot %da (sub now ~h5)))
100> .^(arch %cy /(scot %p our)/base/(scot %da (sub now ~h5)))
72− [p=~.app q=~]
103+ { [p=~.app q=~]
77 [p=~.sur q=~]
104 [p=~.sur q=~]
80 [p=~.gen q=~]
105 [p=~.gen q=~]
85`our` is the value for your ship's name.
115`our` is the value for your ship's name.
87−### `.+` "dotlus"
117+## `.+` "dotlus"
89−`[%dtls p=hoon]`: increment an atom with Nock `4`.
119+Increment an atom with Nock `4`.
91−##### Produces
127+#### Produces
93`p` plus `1` if `p` is an atom; otherwise, crashes. The product atom has no aura.
129`p` plus `1` if `p` is an atom; otherwise, crashes. The product atom has no aura.
95−##### Syntax
131+#### Regular syntax
97−Regular: **1-fixed**.
147+#### Irregular syntax
99−Irregular: `+(6)` is `.+(6)`.
149+```hoon
101−##### Examples
153+#### Examples
@@ -114,19 +166,38 @@ Irregular: `+(6)` is `.+(6)`.
117−### `.*` "dottar"
169+## `.*` "dottar"
171+Evaluate with Nock `2`.
119−`[%dttr p=hoon q=hoon]`: evaluate with Nock `2`.
176+[%dttr p=hoon q=hoon]
121−##### Produces
179+#### Produces
123Nock of formula `q` and subject `p`, with type `%noun`.
181Nock of formula `q` and subject `p`, with type `%noun`.
125−##### Syntax
183+#### Regular syntax
127−Regular: **2-fixed**.
185+Two arguments, fixed.
129−##### Discussion
200+#### Discussion
131`.*(p q)` is used to run Nock formula `q` on the subject `p` from within Hoon.
202`.*(p q)` is used to run Nock formula `q` on the subject `p` from within Hoon.
@@ -135,7 +206,7 @@ Keep in mind that `p` and `q` can be arbitrary Hoon expressions, as long as they
135Note also that `.*` ("dottar") can be used to bypass the type system. It's
206Note also that `.*` ("dottar") can be used to bypass the type system. It's
136therefore possible to use Hoon as a typeless language.
207therefore possible to use Hoon as a typeless language.
138−##### Examples
209+#### Examples
141> .*([20 30] [0 2])
212> .*([20 30] [0 2])
@@ -157,32 +228,52 @@ therefore possible to use Hoon as a typeless language.
160−### `.=` "dottis" {#dottis}
231+## `.=` "dottis" {#dottis}
233+Test for equality with Nock `5`.
162−`[%dtts p=hoon q=hoon]`: test for equality with Nock `5`.
238+[%dtts p=hoon q=hoon]
164−##### Produces
241+#### Produces
166`%.y` if `p` equals `q`; otherwise `%.n`.
243`%.y` if `p` equals `q`; otherwise `%.n`.
168−##### Syntax
245+#### Regular syntax
247+Two arguments, fixed.
170−Regular: **2-fixed**.
256+Wide-form:
172−Irregular: `=(a b)` is `.=(a b)`.
258+```hoon
174−##### Discussion
262+#### Irregular syntax
176−The test for equality includes a type check. Either the type of `p` must nest under the type of `q`, or _vice versa_. Otherwise the result is a crash.
264+```hoon
178Like Nock equality, `.=` ("dottis") tests whether two nouns are the same,
270Like Nock equality, `.=` ("dottis") tests whether two nouns are the same,
179−ignoring invisible pointer structure. Because in a conventional
271+ignoring invisible pointer structure. Because in a conventional noun
180−noun implementation each noun has a lazy short hash, comparisons
272+implementation each noun has a lazy short hash, comparisons are fast unless the
181−are fast unless the hash needs to be computed, or we are comparing
273+hash needs to be computed, or we are comparing separate copies of identical
182−separate copies of identical nouns. (Comparing large duplicates
183−is a common cause of performance bugs.)
274+nouns. (Comparing large duplicates is a common cause of performance bugs.)
185−##### Examples
276+#### Examples
@@ -198,22 +289,44 @@ is a common cause of performance bugs.)
200> =(12 [12 14])
291> =(12 [12 14])
204−### `.?` "dotwut"
295+## `.?` "dotwut"
297+Test for cell or atom with Nock `3`.
206−`[%dtwt p=hoon]`: test for cell or atom with Nock `3`.
302+[%dtwt p=hoon]
208−##### Produces
305+#### Produces
210`%.y` if `p` is a cell; otherwise `%.n`.
307`%.y` if `p` is a cell; otherwise `%.n`.
212−##### Syntax
309+#### Regular syntax
325+#### Irregular syntax
214−Regular: **1-fixed**.
327+None.
216−##### Examples
329+#### Examples