@@ -6,24 +6,25 @@ navhome: /docs/
6# 3g: molds and mold builders
6# 3g: molds and mold builders
7### `++coin`
7### `++coin`
9−Noun literal syntax cases
11−Noun literal syntax cases: atoms, jammed nouns, and nestable tuples.
10+Noun-literal syntax cases
12−Parsed and printed using `++so` and `++co` cores.
14−Source
12+Syntax cases for nouns-literal: atoms, jammed nouns, and nestable tuples. Parsed
15−------
13+and printed using `++so` and `++co` cores.
17− ++ coin $% {$$ p/dime} ::
15+#### Source
19− {$many p/(list coin)} ::
17+ ++ coin $% [$$ p=dime]
19+ [$many p=(list coin)]
22−Examples
23+#### Examples
25 > `coin`(need (slay '~s1'))
25 > `coin`(need (slay '~s1'))
26 [%$ p=[p=~.dr q=18.446.744.073.709.551.616]]
26 [%$ p=[p=~.dr q=18.446.744.073.709.551.616]]
27 > `coin`(need (slay '0x2b59'))
28 > `coin`(need (slay '0x2b59'))
28 [%$ p=[p=~.ux q=11.097]]
29 [%$ p=[p=~.ux q=11.097]]
@@ -34,8 +35,10 @@ Examples
35 > `@uv`(jam [3 4])
36 > `@uv`(jam [3 4])
37 > (slay '~02cd1')
39 > (slay '~02cd1')
38 [~ [%blob p=[3 4]]]
40 [~ [%blob p=[3 4]]]
@@ -44,27 +47,22 @@ Examples
45### `++dime`
48### `++dime`
47−Odor-atom pair
50+Aura-atom pair
49−Used in `++coin`. Convenience methods `++scot` and `++scow` (in
50−Section 2eL) print dimes as `++cord` and `++tape`, respectively.
51−`++slat`, `++slav`, and `++slaw` are used to parse atoms of
54−Source
52+Used in `++coin`. Convenience methods [`++scot`](../4m.md) and
55−------
53+[`++scow`](../4m.md) print dimes as `++cord` and `++tape`, respectively.
54+[`++slat`](../4m.md), [`++slav`](../4m.md), and [`++slaw`](../4m.md) are used
55+to parse atoms of specific auras.
57− ++ dime {p/@ta q/@} ::
57+#### Source
60−Examples
61+#### Examples
63 > +>:(slay '0x123')
63 > +>:(slay '0x123')
64 p=[p=~.ux q=291]
64 p=[p=~.ux q=291]
69### `++edge`
67### `++edge`
@@ -72,22 +70,23 @@ Parsing location metadata
73Optional result `p` and parsing continuation `q`.
71Optional result `p` and parsing continuation `q`.
78− ++ hair {p/@ud q/@ud} :: parsing trace
75+ ++ hair [p=@ud q=@ud]
81−Examples
78+#### Examples
84−See also: Section 2eD, `++rule`
87 [p=[p=0 q=0] q=~]
82 [p=[p=0 q=0] q=~]
88 > (tall:vast [1 1] "a b")
84 > (tall:vast [1 1] "a b")
89− [p=[p=1 q=2] q=[~ [p=[%cnzz p=~[%a]] q=[p=[p=1 q=2] q=" b"]]]]
85+ [p=[p=1 q=3] q=[~ u=[p=[%wing p=~[%a]] q=[p=[p=1 q=2] q=" b"]]]]
89+See also: [Section 2e](../2e.md), `++rule`
@@ -95,60 +94,58 @@ See also: Section 2eD, `++rule`
96Parsing line and column
95Parsing line and column
98−A pair of two [`@ud`]() used in parsing indicating line and column number.
97+A pair of two `@ud` used in parsing indicating line and column number.
103− ++ hair {p/@ud q/@ud} :: parsing trace
101+ ++ hair [p=@ud q=@ud]
106−Examples
104+#### Examples
110 [p=0 q=0]
107 [p=0 q=0]
112− > `hair`[1 1] :: parsing starts at [1 1] as a convention.
109+ > `hair`[1 1] :: parsing starts at [1 1] as a convention.
113 [p=1 q=1]
110 [p=1 q=1]
114 > ((plus ace) [1 1] " --")
112 > ((plus ace) [1 1] " --")
115 [p=[p=1 q=4] q=[~ u=[p=[~~. " "] q=[p=[p=1 q=4] q="--"]]]]
113 [p=[p=1 q=4] q=[~ u=[p=[~~. " "] q=[p=[p=1 q=4] q="--"]]]]
116 > `hair`p:((plus ace) [1 1] " --")
115 > `hair`p:((plus ace) [1 1] " --")
117 [p=1 q=4]
116 [p=1 q=4]
122### `++like`
120### `++like`
124−Mold generator for an edge
122+Generic edge
124+Generates an `++edge` with a parsed result set to a specific type.
126−`++like` generates an `++edge` with a parsed result set to a specific type.
126+#### Source
128−Source
128+ ++ like |* a=gate
129−------
129+ |= b=_`*`[(hair) ~]
133+ u=[p=(a +>-.b) q=[p=(hair -.b) q=(tape +.b)]]
131− ++ like |* a/gate :: generic edge
132− |= b/_`*`[(hair) ~] ::
137− u=[p=(a +>-.b) q=[p=(hair -.b) q=(tape +.b)]] ::
142 > *(like char)
138 > *(like char)
143 [p=[p=0 q=0] q=~]
139 [p=[p=0 q=0] q=~]
145 > (ace [1 1] " a")
141 > (ace [1 1] " a")
146− [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q="a"]]]]
142+ [p=[p=1 q=2] q=[~ u=[p=' ' q=[p=[p=1 q=2] q="a"]]]]
147 > `(like char)`(ace [1 1] " a")
144 > `(like char)`(ace [1 1] " a")
148 [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q="a"]]]]
145 [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q="a"]]]]
149− > `(like ,@)`(ace [1 1] " a")
150− [p=[p=1 q=2] q=[~ [p=32 q=[p=[p=1 q=2] q="a"]]]]
147+ > `(like ,@)`(ace [1 1] " a")
148+ [p=[p=1 q=2] q=[~ u=[p=32 q=[p=[p=1 q=2] q="a"]]]]
@@ -158,63 +155,55 @@ Location, remainder of parsed text
159Indicates parsing position `p`, and remaining text to be parsed `q`.
156Indicates parsing position `p`, and remaining text to be parsed `q`.
161−Source
158+#### Source
164− ++ nail {p/hair q/tape} :: parsing input
160+ ++ nail [p=hair q=tape]
167−Examples
163+#### Examples
170 > +<:;~(plug cab cab)
165 > +<:;~(plug cab cab)
171− c=tub=[p=[p=0 q=0] q=""]
166+ c=[p=[p=0 q=0] q=""]
172− > :: tub is a ++nail
177### `++path`
169### `++path`
179Filesystem path
171Filesystem path
181−A `++path` is a list of `++span`s aka `@ta`. Used in
173+A list of `++knot`s. `++knot` is another name for `@ta`.
182−`%clay` and `%eyre` extensively.
184−Source
175+#### Source
187− ++ path (list knot) :: filesys location
177+ ++ path (list knot)
190−Examples
180+#### Examples
193 > `path`"abc"
182 > `path`"abc"
187+Used in `%clay` and `%eyre` extensively.
199### `++pint`
190### `++pint`
201Parsing range
192Parsing range
203−Mostly used for stacktraces. A `++pint` is a pair of
204−`++hair`, indicating from `p` to `q`.
194+A `++pint` is a pair of `++hair`, indicating from `p` to `q`. Mostly used for
206−Source
197+#### Source
209− ++ pint {p/{p/@ q/@} q/{p/@ q/@}} :: line+column range
199+ ++ pint [p=[p=@ q=@] q=[p=@ q=@]]
212−Examples
202+#### Examples
204+ > !:(!!) :: !! always produces a crash
205+ /~zod/home/~2014.9.20..01.22.04..52e3/:<[1 4].[1 6]>
216− ! /~zod/try/~2014.9.20..01.22.04..52e3/:<[1 4].[1 6]>
217− > :: !! always produces a crash
218 > `pint`[[1 4] [1 6]]
207 > `pint`[[1 4] [1 6]]
219 [p=[p=1 q=4] q=[p=1 q=6]]
208 [p=[p=1 q=4] q=[p=1 q=6]]
@@ -225,115 +214,138 @@ Examples
226Parsing rule
215Parsing rule
228−`++rule` is an empty parsing rule, but it is used to check
229−that parsing rules match this with `_`.
217+An empty parsing rule, but used to check that parsing rules match this with `_`.
235− ++ rule _|=(nail *edge) :: parsing rule
220+#### Source
222+ ++ rule _|=(nail *edge)
241− > *rule
225+#### Examples
242− [p=[p=0 q=0] q=[~ [p=0 q=[p=[p=0 q=0] q=""]]]]
244− > ^+(rule [|=(a=nail [p.a ~])]:|6)
245− <1.dww [tub=[p=[p=@ud q=@ud] q=""] <101.jzo 1.ypj %164>]>
246− > (^+(rule [|=(a=nail [p.a ~ u=['a' a]])]:|6) [1 1] "hi")
247− [p=[p=1 q=1] q=[~ [p=97 q=[p=[p=1 q=1] q="hi"]]]]
248 > ([|=(a=nail [p.a ~ u=['a' a]])]:|6 [1 1] "hi")
227 > ([|=(a=nail [p.a ~ u=['a' a]])]:|6 [1 1] "hi")
249 [[p=1 q=1] ~ u=['a' p=[p=1 q=1] q="hi"]]
228 [[p=1 q=1] ~ u=['a' p=[p=1 q=1] q="hi"]]
254### `++spot`
232### `++spot`
256Stack trace line
234Stack trace line
258−A `++spot` is what we print after crashing.
236+The stack trace that is printed after crashing.
263− ++ spot {p/path q/pint} :: range in file
238+#### Source
240+ ++ spot [p=path q=pint]
266−Examples
242+#### Examples
269− > :into /=main=/bin/fail/hoon '!: !!'
244+ > !: !! :: !! always produces a crash
270− + /~zod/main/359/bin/fail/hoon
245+ /~zod/home/~2018.8.8..21.42.40..7852:<[1 5].[1 7]>
272− ! /~zod/main/~2014.9.22..18.40.56..ef04/bin/fail/:<[1 5].[1 7]>
252+Nock result, error report
254+Produces either success (`%0`), a block with list of requests blocked on (`%1`),
255+or failure with an error report (`%2`).
260+ ++ tone $% [$0 p=*] :: success
261+ [$1 p=(list)] :: blocks
262+ [$2 p=(list [@ta *])] :: error report
267+ > (mink [[20 21] 0 3] $~)
271+ > (mink [[1 2] !=(!:(+(.)))] ,~)
276+ [ [ \/72.245.008.048.359.254.300.063.028.130.093.488.830.539.186.242.06\/
277+ 3.318.457.928.725.368.447.417.075.673.617.723.940.025.940.705.343
278+ .057.601.925.133.611.559.292.046.932.324.629.048.702
281+ \/347.698.068.472.453.194.464.038.059.283.550.210.118.689.128.761.6\/
278### `++toon`
295### `++toon`
280−Nock computation result
297+Nock result, stack trace
282−Either success (`%0`), a block with list of requests blocked on (`%1`), or
299+Produces either success (`%0`), a block with list of requests blocked on (`%1`),
283−failure with stack trace (`%2`).
300+or failure with a stack trace (`%2`).
288− ++ toon $% {$0 p/*} :: success
303+#### Source
289− {$1 p/(list)} :: blocks
290− {$2 p/(list tank)} :: stack trace
305+ ++ toon $% [$0 p=*] :: success
306+ [$1 p=(list)] :: blocks
307+ [$2 p=(list tank)] :: stack trace
296 > (mock [[20 21] 0 3] $~)
313 > (mock [[20 21] 0 3] $~)
297 [%0 p=21]
314 [%0 p=21]
298− > (mock [[0] !=(.^(cy//=main/1))] ,~)
299− [%1 p=~[[31.075 1.685.027.454 1.852.399.981 49 0]]]
300− > (path [31.075 1.685.027.454 1.852.399.981 49 0])
303 > (mock [[1 2] !=(!:(+(.)))] ,~)
316 > (mock [[1 2] !=(!:(+(.)))] ,~)
304 [%2 p=~[[%leaf p="/~zod/try/~2014.9.23..18.34.32..d3c5/:<[1 20].[1 24]>"]]]
317 [%2 p=~[[%leaf p="/~zod/try/~2014.9.23..18.34.32..d3c5/:<[1 20].[1 24]>"]]]
309### `++wonk`
321### `++wonk`
311−XX Not a model?
323+Product from edge
313Pull result out of a `++edge`, or crash if there's no result.
325Pull result out of a `++edge`, or crash if there's no result.
315−Source
327+#### Source
318− ++ wonk |*(veq=edge ?~(q.veq !! p.u.q.veq)) ::
329+ ++ wonk |*(veq=edge ?~(q.veq !! p.u.q.veq))
320−Examples
331+#### Examples
323−See also: [`++edge`]()
325 > (wide:vast [1 1] "(add 2 2)")
333 > (wide:vast [1 1] "(add 2 2)")
326 [ p=[p=1 q=10]
334 [ p=[p=1 q=10]
329− [ p=[%cnhp p=[%cnzz p=~[%add]] q=~[[%dtzy p=%ud q=2] [%dtzy p=%ud q=2]]]
338+ [ p=[%cnhp p=[%wing p=~[%add]] q=~[[%sand p=%ud q=2] [%sand p=%ud q=2]]]
330 q=[p=[p=1 q=10] q=""]
339 q=[p=[p=1 q=10] q=""]
334 > (wonk (wide:vast [1 1] "(add 2 2)"))
344 > (wonk (wide:vast [1 1] "(add 2 2)"))
335− [%cnhp p=[%cnzz p=~[%add]] q=~[[%dtzy p=%ud q=2] [%dtzy p=%ud q=2]]]
345+ [%cnhp p=[%wing p=~[%add]] q=~[[%sand p=%ud q=2] [%sand p=%ud q=2]]]