on b93c19b help sign in
385 lines 6.8 kB history raw
1+++
2title = "3g: Molds and Mold-Builders"
3weight = 27
4template = "doc.html"
5+++
6### `++coin`
9Noun-literal syntax cases
11Syntax cases for nouns-literal: atoms, jammed nouns, and nestable tuples. Parsed
12and printed using `++so` and `++co` cores.
14#### Source
16```
17 ++ coin $% [$$ p=dime]
18 [$blob p=*]
19 [$many p=(list coin)]
20 ==
21```
23---
24#### Examples
26```
27 > `coin`(need (slay '~s1'))
28 [%$ p=[p=~.dr q=18.446.744.073.709.551.616]]
30 > `coin`(need (slay '0x2b59'))
31 [%$ p=[p=~.ux q=11.097]]
33 > ~(rend co [%many ~[[%$ %ud 1] [%$ %tas 'a'] [%$ %s -2]]])
34 "._1_a_-2__"
35 > ._1_a_-2__
36 [1 %a -2]
38 > `@uv`(jam [3 4])
39 0v2cd1
41 > (slay '~02cd1')
42 [~ u=[%blob p=[3 4]]]
44 > ~02cd1
45 [3 4]
46```
49---
50### `++dime`
52Aura-atom pair
54Used in `++coin`. Convenience methods [`++scot`](@/docs/reference/library/4m.md) and
55[`++scow`](@/docs/reference/library/4m.md) print dimes as `++cord` and `++tape`, respectively.
56[`++slat`](@/docs/reference/library/4m.md), [`++slav`](@/docs/reference/library/4m.md), and [`++slaw`](@/docs/reference/library/4m.md) are used
57to parse atoms of specific auras.
59#### Source
61```
62 ++ dime [p=@ta q=@]
63```
65#### Examples
67```
68 > +>:(slay '0x123')
69 p=[p=~.ux q=291]
70```
72---
73### `++edge`
75Parsing location metadata
77Optional result `p` and parsing continuation `q`.
79#### Source
81```
82 ++ hair [p=@ud q=@ud]
83```
85#### Examples
87```
88 > *edge
89 [p=[p=0 q=0] q=~]
91 > (tall:vast [1 1] "a b")
92 [p=[p=1 q=3] q=[~ u=[p=[%wing p=~[%a]] q=[p=[p=1 q=2] q=" b"]]]]
93```
95#### Discussion
97See also: [Section 2e](@/docs/reference/library/2e.md), `++rule`
100---
101### `++hair`
103Parsing line and column
105A pair of two `@ud` used in parsing indicating line and column number.
107#### Source
109```
110 ++ hair [p=@ud q=@ud]
111```
113#### Examples
115```
116 > *hair
117 [p=0 q=0]
119 > `hair`[1 1] :: parsing starts at [1 1] as a convention.
120 [p=1 q=1]
122 > ((plus ace) [1 1] " --")
123 [p=[p=1 q=4] q=[~ u=[p=[~~. " "] q=[p=[p=1 q=4] q="--"]]]]
125 > `hair`p:((plus ace) [1 1] " --")
126 [p=1 q=4]
127```
129---
130### `++like`
132Generic edge
134Generates an `++edge` with a parsed result set to a specific type.
136#### Source
138```
139 ++ like |* a=gate
140 |= b=_`*`[(hair) ~]
141 :- p=(hair -.b)
142 ^= q
143 :- ~
144 u=[p=(a +>-.b) q=[p=(hair -.b) q=(tape +.b)]]
145```
147#### Examples
149```
150 > *(like char)
151 [p=[p=0 q=0] q=~]
153 > (ace [1 1] " a")
154 [p=[p=1 q=2] q=[~ u=[p=' ' q=[p=[p=1 q=2] q="a"]]]]
156 > `(like char)`(ace [1 1] " a")
157 [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q="a"]]]]
159 > `(like ,@)`(ace [1 1] " a")
160 [p=[p=1 q=2] q=[~ u=[p=32 q=[p=[p=1 q=2] q="a"]]]]
161```
163---
164### `++nail`
166Location, remainder of parsed text
168Indicates parsing position `p`, and remaining text to be parsed `q`.
170#### Source
172```
173 ++ nail [p=hair q=tape]
174```
176#### Examples
178```
179 > +<:;~(plug cab cab)
180 c=[p=[p=0 q=0] q=""]
181```
183---
184### `++path`
186Filesystem path
188A list of `++knot`s. `++knot` is another name for `@ta`.
190#### Source
192```
193 ++ path (list knot)
194```
196#### Examples
198```
199 > `path`"abc"
200 /a/b/c
201```
203#### Discussion
205Used in `%clay` and `%eyre` extensively.
207---
208### `++pint`
210Parsing range
212A `++pint` is a pair of `++hair`, indicating from `p` to `q`. Mostly used for
213stack traces.
215#### Source
217```
218 ++ pint [p=[p=@ q=@] q=[p=@ q=@]]
219```
221#### Examples
223```
224 > !:(!!) :: !! always produces a crash
225 /~zod/home/~2014.9.20..01.22.04..52e3/:<[1 4].[1 6]>
227 > `pint`[[1 4] [1 6]]
228 [p=[p=1 q=4] q=[p=1 q=6]]
229```
232---
233### `++rule`
235Parsing rule
237An empty parsing rule, but used to check that parsing rules match this with `_`.
240#### Source
242```
243 ++ rule _|=(nail *edge)
244```
246#### Examples
248```
249 > ([|=(a=nail [p.a ~ u=['a' a]])]:|6 [1 1] "hi")
250 [[p=1 q=1] ~ u=['a' p=[p=1 q=1] q="hi"]]
251```
253---
254### `++spot`
256Stack trace line
258The stack trace that is printed after crashing.
260#### Source
262```
263 ++ spot [p=path q=pint]
264```
266#### Examples
268```
269 > !: !! :: !! always produces a crash
270 /~zod/home/~2018.8.8..21.42.40..7852:<[1 5].[1 7]>
271 ! exit
272```
274---
275### `++tone`
277Nock result, error report
279Produces either success (`%0`), a block with list of requests blocked on (`%1`),
280or failure with an error report (`%2`).
283#### Source
285```
286 ++ tone $% [$0 p=*] :: success
287 [$1 p=(list)] :: blocks
288 [$2 p=(list [@ta *])] :: error report
289 ==
290```
292#### Examples
294```
295 > (mink [[20 21] 0 3] $~)
296 [%0 p=21]
299 > (mink [[1 2] !=(!:(+(.)))] ,~)
300 [ %2
301 p
302 ~[
303 [ ~.spot
304 [ [ \/72.245.008.048.359.254.300.063.028.130.093.488.830.539.186.242.06\/
305 3.318.457.928.725.368.447.417.075.673.617.723.940.025.940.705.343
306 .057.601.925.133.611.559.292.046.932.324.629.048.702
307 \/ \/
308 1.701.670.760
309 \/347.698.068.472.453.194.464.038.059.283.550.210.118.689.128.761.6\/
310 88.459.326.078
311 \/ \/
312 0
313 ]
314 [1 20]
315 1
316 24
317 ]
318 ]
319 ]
320```
322---
323### `++toon`
325Nock result, stack trace
327Produces either success (`%0`), a block with list of requests blocked on (`%1`),
328or failure with a stack trace (`%2`).
331#### Source
333```
334 ++ toon $% [$0 p=*] :: success
335 [$1 p=(list)] :: blocks
336 [$2 p=(list tank)] :: stack trace
337 ==
338```
340#### Examples
342```
343 > (mock [[20 21] 0 3] $~)
344 [%0 p=21]
346 > (mock [[1 2] !=(!:(+(.)))] ,~)
347 [%2 p=~[[%leaf p="/~zod/try/~2014.9.23..18.34.32..d3c5/:<[1 20].[1 24]>"]]]
348```
350---
351### `++wonk`
353Product from edge
355Pull result out of a `++edge`, or crash if there's no result.
357#### Source
359```
360 ++ wonk |*(veq=edge ?~(q.veq !! p.u.q.veq))
361```
363#### Examples
365```
366 > (wide:vast [1 1] "(add 2 2)")
367 [ p=[p=1 q=10]
368 q
369 [ ~
370 u
371 [ p=[%cnhp p=[%wing p=~[%add]] q=~[[%sand p=%ud q=2] [%sand p=%ud q=2]]]
372 q=[p=[p=1 q=10] q=""]
373 ]
374 ]
375 ]
377 > (wonk (wide:vast [1 1] "(add 2 2)"))
378 [%cnhp p=[%wing p=~[%add]] q=~[[%sand p=%ud q=2] [%sand p=%ud q=2]]]
379```
381#### Discussion
383See also: `++edge`
385---