on 6d45ede help sign in
728 lines 14 kB history raw
1---
2navhome: /docs
3---
6# 4o: molds and mold builders
7### `++abel`
9Biblical names in hoon are primarily aliases for the compiler.
11Source
12------
14 ++ abel typo :: original sin: type
16Examples
17--------
19 > *abel
20 %void
24***
25### `++aura`
27'type' of atom
29By convention, a short name for a category of atom. `++aura` is
30circularly defined, with [`@ta`]() being the `++aura` of the ASCII subset
31commonly used in urbit.
33Source
34------
36 ++ aura ,@ta :: atom format
38Examples
39--------
41See also: [`++base`](), [aura reference]()
43 > `aura`%ux
44 ~.ux
48***
50### `++axis`
52Nock axis
54A Nock axis inside a [noun](). After the leading 1, in binary, a `1` signfies
55right and `0` left.
57Source
58------
60 ++ axis ,@ :: tree address
62Examples
63--------
65 > *axis
66 0
68 > :: 0 is not actually a valid axis
69 > [[4 5] 6 7]
70 [[4 5] 6 7]
71 > `axis`0b110
72 6
75***
77### `++base`
79Base type
81A base type that [noun]()s are built from. A `++base` is either a noun, cell, boolean or
82null labelled with an [odor]().
84Source
85------
87 ++ base ?([%atom p=odor] %noun %cell %bean %null) :: axils, @ * ^ ? ~
89Examples
90--------
92 > *base
93 %null
95 > (ream '=|(^ !!)')
96 [%tsbr p=[%axil p=%cell] q=[%zpzp ~]]
97 > :: p.p is a ++base
98 > (ream '=|(@t !!)')
99 [%tsbr p=[%axil p=[%atom p=~.t]] q=[%zpzp ~]]
100 > (ream '=|(? !!)')
101 [%tsbr p=[%axil p=%bean] q=[%zpzp ~]]
104***
105### `++bean`
107Boolean
109`0`, `&`, or `%.y` are true, and `1`, `|`, and `%.n` are false.
111Source
112------
114 ++ bean ,? :: 0=&=yes, 1=|=no
116Examples
117--------
119 > *bean
120 %.y
122 > `bean`&
123 %.y
124 > `bean`|
125 %.n
129***
130### `++beer`
132Tape builder
134Used to build [tape]()s internally.
136Source
137------
139 ++ beer $|(@ [~ p=twig]) :: simple embed
141Examples
142--------
144 > `beer`'as'
145 29.537
146 > `beer`[~ (ream 'lan')]
147 [~ p=[%cnzz p=~[%lan]]]
150***
151### `++beet`
153XML interpolation cases
155Used internally.
157Source
158------
160 ++ beet $| @ :: advanced embed
161 $% [%a p=twig] :: take tape
162 [%b p=twig] :: take manx
163 [%c p=twig] :: take marl
164 [%d p=twig] :: take $+(marl marl)
165 [%e p=twig q=(list tuna)] :: element literal
166 == ::
170***
171### `++chum`
173Jet hint information
175Jet hint information that must be present in the body of a `~/` or `~%`
176rune. A `++chum` can optionally contain a kelvin version, jet vendor,
177and "{major}.{minor}" version number.
179Source
180------
182 ++ chum $? lef=term :: jet name
183 [std=term kel=@] :: kelvin version
184 [ven=term pro=term kel=@] :: vendor and product
185 [ven=term pro=term ver=@ kel=@] :: all of the above
186 == ::
188Examples
189--------
191XX there's a ++chum in zuse that's politely causing this not to work
193 > `chum`'hi'
194 lef=%hi
196 > (ream '~/(%lob.314 !!)')
197 [%sgfs p=[std=%lob kel=314] q=[%zpzp ~]]
201***
202### `++coil`
204Tuple of core information
206Variance `p`, subject type `q`, and `q`: optional compiled nock, and arms. Used as an
207intermediate step within Section 2fB. Converted by `++core` to %core type.
209Source
210------
212 ++ coil $: p=?(%gold %iron %lead %zinc) :: core type
213 q=type ::
214 r=[p=?(~ ^) q=(map term foot)] ::
215 == ::
219***
220### `++foot`
222Cases of arms by variance model.
224`%ash` arms are [`dry`]() and [geometric]().
226Source
227------
229 ++ foot $% [%ash p=twig] :: dry arm, geometric
230 [%elm p=twig] :: wet arm, generic
231 [%oak ~] :: XX not used
232 [%yew p=(map term foot)] :: XX not used
233 == ::
235Examples
236--------
238See also: [`++ap`](), [`++ut`]()
240 > *foot
241 [%yew p={}]
243 > (ream '|% ++ $ foo --')
244 [%brcn p={[p=%$ q=[%ash p=[%cnzz p=~[%foo]]]]}]
245 > +<+:(ream '|% ++ $ foo --')
246 t=~[%ash %cnzz %foo]
247 > (foot +<+:(ream '|% ++ $ foo --'))
248 [%ash p=[%cnzz p=~[%foo]]]
249 > (foot +<+:(ream '|% +- $ foo --'))
250 [%elm p=[%cnzz p=~[%foo]]]
252***
253### `++limb`
255 ++ limb $|(term $%([%& p=axis] [%| p=@ud q=term])) ::
257XX move to `++ut`
259Reference into subject by name/axis
261See also: section 2fC-2fD
263 > (ream '^^$')
264 [%cnzz p=~[[%.n p=2 q=%$]]]
265 > (limb &2:(ream '^^$'))
266 [%.n p=2 q=%$]
267 > (limb &2:(ream '^^^$'))
268 [%.n p=3 q=%$]
272***
273### `++line`
275XX move to `++ut`
277Source
278------
280 ++ line ,[p=[%leaf p=odor q=@] q=tile] :: %kelp case
283Examples
284--------
286 > (ream '$%([1 a] [%2 b])')
287 [ %bccm
288 p
289 [ %kelp
290 p
291 [ i=[p=[%leaf p=~.ud q=1] q=[%herb p=[%cnzz p=~[%a]]]]
292 t=~[[p=[%leaf p=~.ud q=2] q=[%herb p=[%cnzz p=~[%b]]]]]
293 ]
294 ]
295 ]
296 > &3:(ream '$%([1 a] [%2 b])')
297 p=[p=[%leaf p=%ud q=1] q=[%herb p=[%cnzz p=~[%a]]]]
298 > (line &3:(ream '$%([1 a] [%2 b])'))
299 [p=[%leaf p=~.ud q=1] q=[%herb p=[%cnzz p=~[%a]]]]
302***
303### `++metl`
305 ++ metl ?(%gold %iron %zinc %lead) :: core variance
307XX move to `++ut`
309See also: [`++coil`]()
313***
314### `++nock`
316Virtual machine. See [Nock doc]().
319Source
320------
322 ++ nock $& [p=nock q=nock] :: autocons
323 [%3 p=nock] :: cell test
324 [%4 p=nock] :: increment
325 [%5 p=nock q=nock] :: equality test
326 [%6 p=nock q=nock r=nock] :: if, then, else
327 [%7 p=nock q=nock] :: serial compose
328 [%8 p=nock q=nock] :: push onto subject
329 [%9 p=@ q=nock] :: select arm and fire
330 [%10 p=?(@ [p=@ q=nock]) q=nock] :: hint
331 [%11 p=nock] :: grab data from sky
332 == ::
334Examples
335--------
337 > !=([+(.) 20 -<])
338 [[4 0 1] [1 20] 0 4]
339 > (nock !=([+(.) 20]))
340 [p=[%4 p=[%0 p=1]] q=[%1 p=20]]
344***
345### `++noun`
347 ++ noun ,* :: any noun
349Used nowhere XX
351 > `noun`~[1 2 3]
352 [1 2 3 0]
356***
357### `++null`
359 ++ null ,~ :: null, nil, etc
361Used nowhere XX
363 > :type; *null
364 ~
365 %~
369***
370### `++port`
372XX move to `++ut`
374Type and location of core-shaped thing? XX Compiler Internals
376Source
377------
379 ++ port $: p=axis ::
380 $= q ::
381 $% [%& p=type] ::
382 [%| p=axis q=(list ,[p=type q=foot])] ::
383 == ::
384 == ::
386Examples
387--------
389 > *port
390 [p=0 q=[%.y p=%void]]
394***
395### `++span`
397ASCII atom
399A restricted text atom for canonical atom syntaxes. The prefix is `~.`.
400There are no escape sequences except `~~`, which means `~`, and `~-`,
401which means `_`. `-` and `.` encode themselves. No other characters
402besides numbers and lowercase letters are permitted.
404Source
405------
407 ++ span ,@ta :: text-atom (ASCII)
408Examples
409--------
410 > *span
411 ~.
413 > `@t`~.foo
414 'foo'
415 > `@t`~.foo.bar
416 'foo.bar'
417 > `@t`~.foo~~bar
418 'foo~bar'
419 > `@t`~.foo~-bar
420 'foo_bar'
421 > `@t`~.foo-bar
422 'foo-bar'
426***
427### `++tiki`
429XX move to `++ut`
431Source
432------
434 ++ tiki :: test case
436Examples
437--------
439A `++wing` or `++twig`.
441 > (ream '=+ a=4 ?-(a @ ~)')
442 [ %tsls
443 p=[%ktts p=p=%a q=[%dtzy p=%ud q=4]]
444 q
445 [ %wthz
446 p=[%.y p=~ q=~[%a]]
447 q=~[[p=[%axil p=[%atom p=~.]] q=[%bczp p=%null]]]
448 ]
449 ]
450 > (ream '=+ a=4 ?-(4 @ ~)')
451 [ %tsls
452 p=[%ktts p=p=%a q=[%dtzy p=%ud q=4]]
453 q
454 [ %wthz
455 p=[%.n p=~ q=[%dtzy p=%ud q=4]]
456 q=~[[p=[%axil p=[%atom p=~.]] q=[%bczp p=%null]]]
457 ]
458 ]
462***
463### `++toga`
465Tree of faces
467A [face](), or tree of faces. A `++toga` is applied to anything assigned
468using [`^=`]().
470XX move to `++ut` and rune doc (for \^= examples)
472Source
473------
475 ++ toga :: face control
476 [2 p=toga q=toga] :: cell toga
477 == ::
479Examples
480--------
482 > a=1
483 a=1
484 > (ream 'a=1')
485 [%ktts p=p=%a q=[%dtzy p=%ud q=1]]
486 > [a b]=[1 2 3]
487 [a=1 b=[2 3]]
488 > (ream '[a b]=[1 2 3]')
489 [ %ktts
490 p=[%2 p=p=%a q=p=%b]
491 q=[%cltr p=~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]]
492 ]
494 > [a ~]=[1 2 3]
495 [a=1 2 3]
496 > (ream '[a ~]=[1 2 3]')
497 [ %ktts
498 p=[%2 p=p=%a q=[%0 ~]]
499 q=[%cltr p=~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]]
500 ]
504***
505### `++tone`
507Intermediate Nock computation result
509Similar to [`++toon`](), but stack trace is not yet rendered.
511Source
512------
514 ++ tone $% [%0 p=*] :: success
516Examples
517--------
519 > (mink [[20 21] 0 3] ,~)
520 [%0 p=21]
522 > (mink [[0] !=(.^(cy//=main/1))] ,~)
523 [%1 p=~[[31.075 1.685.027.454 1.852.399.981 49 0]]]
524 > (path [31.075 1.685.027.454 1.852.399.981 49 0])
525 /cy/~zod/main/1
527 > (mink [[1 2] !=(~|(%hi +(.)))] ,~)
528 [%2 p=~[[~.yelp 26.984]]]
529 > (mink [[1 2] !=(!:(+(.)))] ,~)
530 [ %2
531 p
532 ~[
533 [ ~.spot
534 [ [ 1.685.027.454
535 7.959.156
536 \/159.445.990.350.374.058.574.398.238.344.143.957.205.628.479.572.65\/
537 8.112.403.878.526
538 \/ \/
539 0
540 ]
541 [1 20]
542 1
543 24
544 ]
545 ]
546 ]
547 ]
551***
552### `++tuna`
554XML template tree
556An XML template tree.
558Source
559------
561 ++ tuna :: tagflow
562 [%d p=twig] :: dynamic list
563 [%e p=twig q=(list tuna)] :: element
564 [%f p=(list tuna)] :: subflow
565 == ::
567Examples
568--------
570Leaf %a contains plain-text, %b an empty tag, %c a static list, %d a
571dynamic list, %e a full node element containing a twig and a list of
572tuna, and %f is a empty node.
574See also: [`++sail`]()
578***
579### `++tusk`
581List of expressions
583List of [`++twig`]()s. In [`:*`](), for example, your contents is
584a `++tusk`.
586Source
587------
589 ++ tusk (list twig) ::
591Examples
592--------
594 > (ream '[1 2 3]')
595 [%cltr p=~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]]
596 > (tusk +:(ream '[1 2 3]'))
597 ~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]
601***
602### `++twig`
604Expression
606An expression, or AST.
608See Twig section of Hoon reference
612***
613### `++tyke`
615List of 'maybe' twigs
617List of [`++unit`]() [`++twig`](), or gaps left to be inferred, in [`++path`]()
618parsing. When you use a path such as `/=main=/pub/src/doc` the path is in fact
619a `++tyke`, where the `=` are inferred from your current path.
622Source
623------
625 ++ tyke (list (unit twig)) ::
627Examples
628--------
630 > (scan "/==as=" porc:vast)
631 [0 ~[~ ~ [~ [%dtzy p=%tas q=29.537]] ~]]
632 > `tyke`+:(scan "/==as=" porc:vast)
633 ~[~ ~ [~ [%dtzy p=%tas q=29.537]] ~]
637***
638### `++typo`
640Pointer for `++type`
642Pointer for [`++type`](). `++typo` preserves the previous `++type` in your
643context when upating.
645Source
646------
648 ++ typo type :: old type
650Examples
651--------
653See also: `++seem`, `++vise`, `++type`
657***
658### `++tyre`
660List, term to twig
662Associative list of [++term]() [`++twig`](), used in [jet]() hint processing.
664Source
665------
667 ++ tyre (list ,[p=term q=twig]) ::
671***
672### `++vase`
674Typed data. A `++vase` is used wherever typed data is explicitly worked
675with.
678Source
679------
681 ++ vase ,[p=type q=*] :: type-value pair
683Examples
684--------
685See `%arvo` doc
687 > `vase`!>(~)
688 [p=[%cube p=0 q=[%atom p=%n]] q=0]
692***
693### `++vise`
695Convert during reboot
697Used to convert from previously-typed data during reboot.
699Source
700------
702 ++ vise ,[p=typo q=*] :: old vase
704Examples
705--------
707See also: [`++typo`](), [`++seer`]()
711***
712### `++wing`
714 ++ wing (list limb) ::
716Address in subject. A `++wing` is a path to a value in the subject. A
717term alone is the trivial case of a `++wing`.
719See also: `++twig`
721 > (ream 'a.+.c')
722 [%cnzz p=~[%a [%.y p=3] %c]]
723 > (wing +:(ream 'a.+.c'))
724 ~[%a [%.y p=3] %c]
728***