Urbit / Docs

4o: molds and mold builders

++abel

Biblical names in hoon are primarily aliases for the compiler.

Source

    ++  abel  typo                                      ::  original sin: type

Examples

    > *abel
    %void

++aura

'type' of atom

By convention, a short name for a category of atom. ++aura is circularly defined, with @ta being the ++aura of the ASCII subset commonly used in urbit.

Source

    ++  aura  ,@ta                                          ::  atom format

Examples

See also: ++base, aura reference

    > `aura`%ux
    ~.ux

++axis

Nock axis

A Nock axis inside a noun. After the leading 1, in binary, a 1 signfies right and 0 left.

Source

    ++  axis  ,@                                            ::  tree address

Examples

    > *axis
    0

    > :: 0 is not actually a valid axis
    > [[4 5] 6 7]
    [[4 5] 6 7]
    > `axis`0b110
    6

++base

Base type

A base type that nouns are built from. A ++base is either a noun, cell, boolean or null labelled with an odor.

Source

    ++  base  ?([%atom p=odor] %noun %cell %bean %null)     ::  axils, @ * ^ ? ~

Examples

    > *base
    %null

    > (ream '=|(^ !!)')
    [%tsbr p=[%axil p=%cell] q=[%zpzp ~]]
    > :: p.p is a ++base
    > (ream '=|(@t !!)')
    [%tsbr p=[%axil p=[%atom p=~.t]] q=[%zpzp ~]]
    > (ream '=|(? !!)')
    [%tsbr p=[%axil p=%bean] q=[%zpzp ~]]

++bean

Boolean

0, &, or %.y are true, and 1, |, and %.n are false.

Source

    ++  bean  ,?                                            ::  0=&=yes, 1=|=no

Examples

    > *bean
    %.y

    > `bean`&
    %.y
    > `bean`|
    %.n

++beer

Tape builder

Used to build tapes internally.

Source

    ++  beer  $|(@ [~ p=hoon])                              ::  simple embed

Examples

    > `beer`'as'
    29.537
    > `beer`[~ (ream 'lan')]
    [~ p=[%cnzz p=~[%lan]]]

++beet

XML interpolation cases

Used internally.

Source

    ++  beet  $|  @                                         ::  advanced embed
              $%  [%a p=hoon]                               ::  take tape
                  [%b p=hoon]                               ::  take manx
                  [%c p=hoon]                               ::  take marl
                  [%d p=hoon]                               ::  take $+(marl marl)
                  [%e p=hoon q=(list tuna)]                 ::  element literal
              ==                                            ::

++chum

Jet hint information

Jet hint information that must be present in the body of a ~/ or ~% rune. A ++chum can optionally contain a kelvin version, jet vendor, and "{major}.{minor}" version number.

Source

    ++  chum  $?  lef=term                                  ::  jet name
                  [std=term [email protected]]                          ::  kelvin version
                  [ven=term pro=term [email protected]]                 ::  vendor and product
                  [ven=term pro=term [email protected] [email protected]]           ::  all of the above
              ==                                            ::

Examples

XX there's a ++chum in zuse that's politely causing this not to work

    > `chum`'hi'
    lef=%hi

    > (ream '~/(%lob.314 !!)')
    [%sgfs p=[std=%lob kel=314] q=[%zpzp ~]]

++coil

Tuple of core information

Variance p, subject type q, and q: optional compiled nock, and arms. Used as an intermediate step within Section 2fB. Converted by ++core to %core type.

Source

    ++  coil  $:  p=?(%gold %iron %lead %zinc)              ::  core type
                  q=type                                    ::
                  r=[p=?(~ ^) q=(map term foot)]            ::
              ==                                            ::

++foot

Cases of arms by variance model.

%ash arms are dry and geometric.

Source

    ++  foot  $%  [%ash p=hoon]                           ::  dry arm, geometric
                  [%elm p=hoon]                           ::  wet arm, generic
                  [%oak ~]                                ::  XX not used
                  [%yew p=(map term foot)]                ::  XX not used
              ==                                          ::

Examples

See also: ++ap, ++ut

    > *foot
    [%yew p={}]

    > (ream '|%  ++  $  foo  --')
    [%brcn p={[p=%$ q=[%ash p=[%cnzz p=~[%foo]]]]}]
    > +<+:(ream '|%  ++  $  foo  --')
    t=~[%ash %cnzz %foo]
    > (foot +<+:(ream '|%  ++  $  foo  --'))
    [%ash p=[%cnzz p=~[%foo]]]
    > (foot +<+:(ream '|%  +-  $  foo  --'))
    [%elm p=[%cnzz p=~[%foo]]]

++limb

    ++  limb  $|(term $%([%& p=axis] [%| [email protected] q=term]))    ::

XX move to ++ut

Reference into subject by name/axis

See also: section 2fC-2fD

    > (ream '^^$')
    [%cnzz p=~[[%.n p=2 q=%$]]]
    > (limb &2:(ream '^^$'))
    [%.n p=2 q=%$]
    > (limb &2:(ream '^^^$'))
    [%.n p=3 q=%$]

++line

XX move to ++ut

Source

    ++  line  ,[p=[%leaf p=odor [email protected]] q=tile]                ::  %kelp case

Examples

    > (ream '$%([1 a] [%2 b])')
    [ %bccm
        p
      [ %kelp
          p
        [ i=[p=[%leaf p=~.ud q=1] q=[%herb p=[%cnzz p=~[%a]]]]
          t=~[[p=[%leaf p=~.ud q=2] q=[%herb p=[%cnzz p=~[%b]]]]]
        ]
      ]
    ]
    > &3:(ream '$%([1 a] [%2 b])')
    p=[p=[%leaf p=%ud q=1] q=[%herb p=[%cnzz p=~[%a]]]]
    > (line &3:(ream '$%([1 a] [%2 b])'))
    [p=[%leaf p=~.ud q=1] q=[%herb p=[%cnzz p=~[%a]]]]

++metl

    ++  metl  ?(%gold %iron %zinc %lead)                    ::  core variance

XX move to ++ut

See also: ++coil


++nock

Virtual machine. See Nock.

Source

        ++  nock  $&  [p=nock q=nock]                           ::  autocons
                  [%3 p=nock]                               ::  cell test
                  [%4 p=nock]                               ::  increment
                  [%5 p=nock q=nock]                        ::  equality test
                  [%6 p=nock q=nock r=nock]                 ::  if, then, else
                  [%7 p=nock q=nock]                        ::  serial compose
                  [%8 p=nock q=nock]                        ::  push onto subject
                  [%9 [email protected] q=nock]                           ::  select arm and fire
                  [%10 p=?(@ [[email protected] q=nock]) q=nock]          ::  hint
                  [%11 p=nock]                              ::  grab data from sky
              ==                                            ::

Examples

    > !=([+(.) 20 -<])
    [[4 0 1] [1 20] 0 4]
    > (nock !=([+(.) 20]))
    [p=[%4 p=[%0 p=1]] q=[%1 p=20]]

++hor

Horizontal hash order

If a and b are atoms, they are computed as samples of gor, producing a flag.

If a and b are cells, hor checks to see if their heads are equal. If their heads are equal, gor is computed on their tails, producing a flag. If their heads are not equal, gor is computed on their heads, producing a flag.

If a is an atom and b is not, then %.y is produced. If b is an atom and a is not, %.n is produced.

Accepts

a is a noun.

b is a noun.

Produces

A flag.

Source

    ++  hor
      ~/  %hor
      |=  [a=* b=*]
      ^-  ?
      ?:  ?=(@ a)
        ?.  ?=(@ b)  &
        (gor a b)
      ?:  ?=(@ b)  |
      ?:  =(-.a -.b)
        (gor +.a +.b)
      (gor -.a -.b)

Examples

    > (hor . 1)
    %.n

    > (hor 1 2)
    %.y

    > (hor "abc" "cba")
    %.y

    > (hor 'c' 'd')
    %.n

    > (hor 100 [1 1])
    %.y

    > (hor [1 1] 100)
    %.n

    > (hor 500.000.000 "foo")
    %.y

    > (hor "foo" 500.000.000)
    %.n

    > (hor 0 "foo")
    %.y

    > (gor `(list @)`[0 ~] 1)
    %.n

    > (hor `(list @)`[50 500 5.000 ~] 1)
    %.n

Discussion

Sets (+set, +in) use hor for their horizontal order and vor for their vertical order. See apt:in to see how a set verifies its correctness. vor is used to verify.


++lor

Leg order

Computes whether the corresponding legs of a and b are in ascending numeric order, producing a flag.

Accepts

a is a noun.

b is a noun.

Accepts

A flag.

Source

    ++  lor
      ~/  %lor
      |=  [a=* b=*]
      ^-  ?
      ?:  =(a b)  &
      [email protected]  a
        ?^  b  &
        (lth a b)
      ?:  =(-.a -.b)
        $(a +.a, b +.b)
      $(a -.a, b -.b)

Examples

    > (lor 1 2)
    %.y

    > (lor 2 1)
    %.n

    > (lor 9 [1 2])
    %.y

    > (lor `(list @)`[1 2 3 ~] `(list @)`[1 2 3 4 ~])
    %.y

    > (lor `(list @)`[1 2 3 ~] `(list @)`[1 2 2 ~])
    %.n

    > (lor `(list @)`[1 2 3 ~] `(list @)`[2 2 ~])
    %.y

    > (lor [2 2 5] [1 5 9 8])
    %.n

    > (lor [1 5 8] [1 5 9 8])
    %.y

    > (lor [1 2 3] [1 2])
    !! exit

Discussion

lor is no longer used internally.


++vor

Vertical order

Computes whether the double-hashes (mug (mug a)) and (mug (mug b)) are in ascending numeric order, producing a flag. If the double-mug hashes are equal, a and b are compared by dor instead.

mug is the the 31-bit nonzero FNV-1a hash algorithm.

Accepts

a is a noun

b is a noun

Produces

A flag.

Source

    ++  vor
      ~/  %vor
      |=  [a=* b=*]
      ^-  ?
      =+  [c=(mug (mug a)) d=(mug (mug b))]
      ?:  =(c d)
        (dor a b)
      (lth c d)

Examples

    > (vor 'f' 'g')
    %.y

    > [(mug 'f') (mug 'g')]
    [1.661.740.952 1.644.963.335]

    > [(mug (mug 'f')) (mug (mug 'g'))]
    [261.421.509 1.861.258.547]

    > (vor 'a' 'z')
    %.n

    > (vor 43.326 41.106)
    %.n

Discussion

Maps, sets, and queues all use vor to check for vertical ordering. Maps and sets also use gor and hor for horizontal order, respectively, but queues use vertical ordering alone.

Since hashing removes correlation, double-mugging with vor removes correlation with single-mugged hor. Vertical order becomes uncorrelated with horizontal order.


++noun

    ++  noun  ,*                                            ::  any noun

Used nowhere XX

    > `noun`~[1 2 3]
    [1 2 3 0]

++null

    ++  null  ,~                                            ::  null, nil, etc

Used nowhere XX

    > :type; *null
    ~
    %~

++port

XX move to ++ut

Type and location of core-shaped thing? XX Compiler Internals

Source

    ++  port  $:  p=axis                                    ::
                  $=  q                                     ::
                  $%  [%& p=type]                           ::
                      [%| p=axis q=(list ,[p=type q=foot])] ::
                  ==                                        ::
              ==                                            ::

Examples

    > *port
    [p=0 q=[%.y p=%void]]

++span

ASCII atom

A restricted text atom for canonical atom syntaxes. The prefix is ~.. There are no escape sequences except ~~, which means ~, and ~-, which means _. - and . encode themselves. No other characters besides numbers and lowercase letters are permitted.

Source

        ++  span  ,@ta                                     ::  text-atom (ASCII)

Examples

    > *span
    ~.

    > `@t`~.foo
    'foo'
    > `@t`~.foo.bar
    'foo.bar'
    > `@t`~.foo~~bar
    'foo~bar'
    > `@t`~.foo~-bar
    'foo_bar'
    > `@t`~.foo-bar
    'foo-bar'

++tiki

XX move to ++ut

Source

        ++  tiki                                                ::  test case

Examples

A `++wing` or `++hoon`.

    > (ream '=+  a=4  ?-(a @ ~)')
    [ %tsls
      p=[%ktts p=p=%a q=[%dtzy p=%ud q=4]]
        q
      [ %wthz
        p=[%.y p=~ q=~[%a]]
        q=~[[p=[%axil p=[%atom p=~.]] q=[%bczp p=%null]]]
      ]
    ]
    > (ream '=+  a=4  ?-(4 @ ~)')
    [ %tsls
      p=[%ktts p=p=%a q=[%dtzy p=%ud q=4]]
        q
      [ %wthz
        p=[%.n p=~ q=[%dtzy p=%ud q=4]]
        q=~[[p=[%axil p=[%atom p=~.]] q=[%bczp p=%null]]]
      ]
    ]

++toga

Tree of faces

A face, or tree of faces. A ++toga is applied to anything assigned using ^=.

XX move to ++ut and rune doc (for ^= examples)

Source

        ++  toga                                                ::  face control
                  [2 p=toga q=toga]                         ::  cell toga
              ==                                            ::

Examples

    > a=1
    a=1
    > (ream 'a=1')
    [%ktts p=p=%a q=[%dtzy p=%ud q=1]]
    > [a b]=[1 2 3]
    [a=1 b=[2 3]]
    > (ream '[a b]=[1 2 3]')
    [ %ktts
      p=[%2 p=p=%a q=p=%b]
      q=[%cltr p=~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]]
    ]

    > [a ~]=[1 2 3]
    [a=1 2 3]
    > (ream '[a ~]=[1 2 3]')
    [ %ktts
      p=[%2 p=p=%a q=[%0 ~]]
      q=[%cltr p=~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]]
    ]

++tone

Intermediate Nock computation result

Similar to ++toon, but stack trace is not yet rendered.

Source

        ++  tone  $%  [%0 p=*]                                  ::  success

Examples

    > (mink [[20 21] 0 3] ,~)
    [%0 p=21]

    > (mink [[0] !=(.^(cy//=main/1))] ,~)
    [%1 p=~[[31.075 1.685.027.454 1.852.399.981 49 0]]]
    > (path [31.075 1.685.027.454 1.852.399.981 49 0])
    /cy/~zod/main/1

    > (mink [[1 2] !=(~|(%hi +(.)))] ,~)
    [%2 p=~[[~.yelp 26.984]]]
    > (mink [[1 2] !=(!:(+(.)))] ,~)
    [ %2
        p
      ~[
        [ ~.spot
          [ [ 1.685.027.454
              7.959.156
              \/159.445.990.350.374.058.574.398.238.344.143.957.205.628.479.572.65\/
                8.112.403.878.526
              \/                                                                  \/
              0
            ]
            [1 20]
            1
            24
          ]
        ]
      ]
    ]

++tuna

XML template tree

An XML template tree.

Source

        ++  tuna                                                ::  tagflow
                  [%d p=hoon]                               ::  dynamic list
                  [%e p=hoon q=(list tuna)]                 ::  element
                  [%f p=(list tuna)]                        ::  subflow
              ==                                            ::

Examples

Leaf %a contains plain-text, %b an empty tag, %c a static list, %d a dynamic list, %e a full node element containing a hoon and a list of tuna, and %f is a empty node.

See also: ++sail


++tusk

List of expressions

List of ++hoons. In :*, for example, your contents is a ++tusk.

Source

        ++  tusk  (list hoon)                                   ::

Examples

    > (ream '[1 2 3]')
    [%cltr p=~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]]
    > (tusk +:(ream '[1 2 3]'))
    ~[[%dtzy p=%ud q=1] [%dtzy p=%ud q=2] [%dtzy p=%ud q=3]]

++hoon

Expression

An expression, or AST.

See Rune section of Hoon reference


++tyke

List of 'maybe' hoons

List of ++unit ++hoon, or gaps left to be inferred, in ++path parsing. When you use a path such as /=main=/pub/src/doc the path is in fact a ++tyke, where the = are inferred from your current path.

Source

        ++  tyke  (list (unit hoon))                            ::

Examples

    > (scan "/==as=" porc:vast)
    [0 ~[~ ~ [~ [%dtzy p=%tas q=29.537]] ~]]
    > `tyke`+:(scan "/==as=" porc:vast)
    ~[~ ~ [~ [%dtzy p=%tas q=29.537]] ~]

++typo

Pointer for ++type

Pointer for ++type. ++typo preserves the previous ++type in your context when upating.

Source

        ++  typo  type                                          ::  old type

Examples

See also: ++seem, ++vise, ++type


++tyre

List, term hoon

Associative list of ++term ++hoon, used in jet hint processing.

Source

        ++  tyre  (list ,[p=term q=hoon])                       ::

++vase

Typed data. A ++vase is used wherever typed data is explicitly worked with.

Source

        ++  vase  ,[p=type q=*]                                 ::  type-value pair

Examples

    > `vase`!>(~)
    [p=[%cube p=0 q=[%atom p=%n]] q=0]

++vise

Convert during reboot

Used to convert from previously-typed data during reboot.

Source

    ++  vise  ,[p=typo q=*]                                 ::  old vase

Examples

See also: ++typo, ++seer


++wing

    ++  wing  (list limb)                                   ::

Address in subject. A ++wing is a path to a value in the subject. A term alone is the trivial case of a ++wing.

See also: ++hoon

    > (ream 'a.+.c')
    [%cnzz p=~[%a [%.y p=3] %c]]
    > (wing +:(ream 'a.+.c'))
    ~[%a [%.y p=3] %c]