+++ title = "2q: Molds and Mold-Builders" weight = 20 template = "doc.html" +++ ### `++char` Character A single character. Aura `@tD` designates a single UTF-8 byte. All parsers consume `tape`s, which are lists of `char`. #### Source ```hoon ++ char @tD ``` #### Examples ``` > *char '' > `@tD`97 'a' ``` --- ### `++cord` UTF-8 text One of Hoon's two string types (the other being `tape`). A cord is an atom of UTF-8 text. #### Source ```hoon ++ cord @t ``` #### Examples ``` > *cord '' > `@ux`'foobar' 0x7261.626f.6f66 > `@t`97 'a' > `@`'urbit' 499.984.265.845 > `@t`499.984.265.845 'urbit' ``` #### Discussion Aura `@t` designates a Unicode atom, little-endian: the first character in the text is the least-significant byte. [`trip`](/docs/hoon/reference/stdlib/4b) converts from `cord` to `tape`, and [`crip`](/docs/hoon/reference/stdlib/4b) converts from `tape` to `cord`. --- ### `++date` Point in time A boolean designating AD or BC, a year atom, a month atom, and a `tarp`, which is a day atom and a time. #### Source ```hoon ++ date [[a=? y=@ud] m=@ud t=tarp] ``` #### Examples ``` > *date [[a=%.y y=0] m=0 t=[d=0 h=0 m=0 s=0 f=~]] > `date`(yore ~2014.6.6..21.09.15..0a16) [[a=%.y y=2.014] m=6 t=[d=6 h=21 m=9 s=15 f=~[0xa16]]] > now ~2018.5.25..17.55.15..9ad8 ``` #### Discussion See also: [`year`](/docs/hoon/reference/stdlib/3c), [`yore`](/docs/hoon/reference/stdlib/3c) --- ### `++knot` ASCII An atom type that only permits ASCII characters. #### Source ```hoon ++ knot @ta ``` #### Examples ``` > *knot ~. > `@ta`105 ~.i ``` --- ### `++tang` Generic print structure A list of `tank`s. It's for printing types and bottom-up printing of stack traces. #### Source ```hoon ++ tang (list tank) ``` #### Examples ``` > *tang ~ > (~(win re [%palm ["1" "2" "3" "4"] [%leaf "foobar"] [%leaf "bazbud"] [%leaf "zzzzzzqaaa"] ~]) 0 50) <<"23foobar1bazbud1zzzzzzqaaa4">> > (~(win re [%palm ["1" "2" "3" "4"] [%leaf "foobar"] [%leaf "bazbud"] [%leaf "zzzzzzqaaa"] ~]) 0 10) <<"2 foobar" " bazbud" "zzzzzzqaaa">> > (~(win re [%rose ["1" "2" "3"] [%leaf "foobar"] [%leaf "bazbud"] ~]) 0 20) <<"2foobar1bazbud3">> > (~(win re [%rose ["1" "2" "3"] [%leaf "foobar"] [%leaf "bazbud"] ~]) 0 10) <<"2 foobar" " bazbud" "3">> ``` --- ### `++tank` Pretty-printing structure A `tank` is one of three cases: a `%leaf` is simply a string (a printed line); a `%palm` is list of `tank` delimited by the strings in `p`, with back-steps at new lines; and a `%rose` is a list of `tank` delimited by the strings in `p` without back-steps at new lines. #### Source ```hoon ++ tank $% [$leaf p=tape] $: $palm p=[p=tape q=tape r=tape s=tape] q=(list tank) == $: $rose p=[p=tape q=tape r=tape] q=(list tank) == == ``` #### Examples ``` > *tank [%rose p=[p="" q="" r=""] q=~] > (wash [0 80] >(bex 20) (bex 19)<) :: at 80 cols <<"[1.048.576 524.288]">> > (wash [0 15] >(bex 20) (bex 19)<) :: at 15 cols <<"[ 1.048.576" " 524.288" "]">> > [(bex 150) (bex 151)] :: at 80 cols [ 1.427.247.692.705.959.881.058.285.969.449.495.136.382.746.624 2.854.495.385.411.919.762.116.571.938.898.990.272.765.493.248 ] > (wash [0 40] >(bex 150) (bex 151)<) << "[ \\/1.427.247.692.705.959.881.058.285.\\/" " 969.449.495.136.382.746.624" " \\/ \\/" " \\/2.854.495.385.411.919.762.116.571.\\/" " 938.898.990.272.765.493.248" " \\/ \\/" "]" >> ``` --- ### `++tape` List of characters One of Hoon's two string types, the other being `++cord`. A tape is a list of `char`. #### Source ```hoon ++ tape (list @tD) ``` #### Examples ``` > *tape "" > `tape`"foobar" "foobar" >`(list @t)`"foobar" <|f o o b a r|> >`(list @tD)`"foobar" "foobar" > `(list @)`"foobar" ~[102 111 111 98 97 114] ``` --- ### `++tarp` Parsed time The time component of a `date`: day, hour, minute, second and a list of `@ux` for precision. #### Source ```hoon ++ tarp [d=@ud h=@ud m=@ud s=@ud f=(list @ux)] ``` #### Examples ``` > *tarp [d=0 h=0 m=0 s=0 f=~] > (yell now) [d=106.751.991.821.625 h=22 m=58 s=10 f=~[0x44ff]] > `tarp`(yell ~2014.6.6..21.09.15..0a16) [d=106.751.991.820.172 h=21 m=9 s=15 f=~[0xa16]] > (yell ~d20) [d=20 h=0 m=0 s=0 f=~] ``` --- ### `++term` Hoon constant A restricted text atom for Hoon constants. The only characters permitted are lowercase ASCII letters, `-`, and `0-9`, the latter two of which cannot be the first character. The syntax for `@tas` is the text itself, always preceded by `%`. The empty `@tas` has a special syntax, `$`. #### Source ```hoon ++ term @tas ``` #### Examples ``` > *term %$ > *%term %term > %dead-fish9 %dead-fish9 > -:!>(%dead-fish9) #t/$dead-fish9 ``` --- ### `++wain` List of strings A list of `cord`s. A `wain` is used instead of a single `cord` with `\n`. #### Source ```hoon ++ wain (list cord) ``` #### Examples ``` > *wain <||> > `wain`/som/del/rok <|som del rok|> ``` --- ### `++wall` List of list of characters A list of `tape`s. `wall` is used instead of a single `tape` with `\n`. #### Source ```hoon ++ wall (list tape) ``` #### Examples ``` > *wall <<>> > `wall`(wash [0 20] leaf+<(bex 256)>) << "\\/115.792.089.237.\\/" " 316.195.423.570." " 985.008.687.907." " 853.269.984.665." " 640.564.039.457." " 584.007.913.129." " 639.936" "\\/ \\/" >> ``` ---