on 4fdc19d help sign in
1320 lines 17 kB history raw
1+++
2title = "4b: Text Processing"
3weight = 29
4template = "doc.html"
5+++
7## `++at`
9Basic printing
11Container core for basic atom printing functions.
13**Note that these are largely deprecated, using outdated syntax, character
14mappings and encodings, and should generally not be used.**
16#### Accepts
18`a` is a `@`.
20#### Source
22```hoon
23++ at
24 |_ a=@
25```
27---
29### `++r:at`
31Print term, number or hex
33If `a` is composed of the letters `a` through `z` and `-`, print as `@tas`
34syntax. If `a` is an atom of two bytes or less, print as an integer with
35comma-separated thousands. Otherwise, print `a` as `@ux` syntax.
37#### Accepts
39`a` is a `@`, and is the sample of `++at`.
41#### Produces
43A `tape`.
45#### Source
47```hoon
48++ r
49 ?: ?& (gte (met 3 a) 2)
50 |-
51 ?: =(0 a)
52 &
53 =+ vis=(end 3 a)
54 ?& ?|(=('-' vis) ?&((gte vis 'a') (lte vis 'z')))
55 $(a (rsh 3 a))
56 ==
57 ==
58 rtam
59 ?: (lte (met 3 a) 2)
60 rud
61 rux
62```
64#### Examples
66```
67> ~(r at 'foo-bar')
68"%foo-bar"
69```
71```
72> ~(r at 0xbeef)
73"48,879"
74```
76```
77> ~(r at 0xdead.beef)
78"0xdead-beef"
79```
81---
83### `++rf:at`
85Print loobean
87If `a` is a loobean, print as `|`/`&`, otherwise crash.
89#### Accepts
91`a` is a `@`, and is the sample of `++at`.
93#### Produces
95A `tape`.
97#### Source
99```hoon
100++ rf `tape`[?-(a %& '&', %| '|', * !!) ~]
101```
103#### Examples
105```
106> ~(rf at %.y)
107"&"
108```
110```
111> ~(rf at %.n)
112"|"
113```
115```
116> ~(rf at 'foo')
117dojo: hoon expression failed
118```
120---
122### `++rn:at`
124Print null
126If `a` is null, print `~`, otherwise crash.
128#### Accepts
130`a` is a `@`, and is the sample of `++at`.
132#### Produces
134A `tape`.
136#### Source
138```hoon
139++ rn `tape`[?>(=(0 a) '~') ~]
140```
142#### Examples
144```
145> ~(rn at ~)
146"~"
147```
149```
150> ~(rn at 'foo')
151dojo: hoon expression failed
152```
154### `++rt:at`
156Print cord, including escape characters
158Print `a` with `cord` syntax, including escape characters.
160#### Accepts
162`a` is a `@`, and the sample of `++at`.
164#### Produces
166A `tape`.
168#### Source
170```hoon
171++ rt `tape`['\'' (weld (mesc (trip a)) `tape`['\'' ~])]
172```
174#### Examples
176```
177> ~(rt at 'foo')
178"'foo'"
179```
181```
182> ~(rt at 'fo\\o')
183"'fo\\\\o'"
184```
186```
187> ~(rt at 'fo\'o')
188"'fo\\0x27/o'"
189```
191---
193### `++rta:at`
195Same as `++rt:at`
197#### Source
199```hoon
200++ rta rt
201```
203---
205### `++rtam:at`
207Print cord with `@tas` syntax
209Treat `a` as `cord`, print it with `%` prefix.
211#### Accepts
213`a` is a `@`, and is the sample of `++at`.
215#### Produces
217A `tape`.
219#### Source
221```hoon
222++ rtam `tape`['%' (trip a)]
223```
225#### Examples
227```
228> ~(rtam at 'foo')
229"%foo"
230```
232```
233> ~(rtam at '12')
234"%12"
235```
237```
238> ~(rtam at '!!!')
239"%!!!"
240```
242---
244### `++rub:at`
246Print binary
248Print `a` as `@ub` syntax, except with `-` separators rather than `.` separators.
250#### Accepts
252`a` is a `@`, and is the sample of `++at`.
254#### Produces
256A `tape`.
258#### Source
260```hoon
261++ rub `tape`['0' 'b' (rum 2 ~ |=(b=@ (add '0' b)))]
262```
264#### Examples
266```
267> ~(rub at 0xbeef)
268"0b1011-1110-1110-1111"
269```
271---
273### `++rud:at`
275Print atom as integer
277Print atom `a` as an integer, with commas separating thousands.
279#### Accepts
281`a` is a `@`.
283#### Produces
285A `tape`.
287#### Source
289```hoon
290++ rud (rum 10 ~ |=(b=@ (add '0' b)))
291```
293#### Examples
295```
296> ~(rud at 0xbeef)
297"48,879"
298```
300---
302### `++rum:at`
304Print base-n
306Print `a` as base `b` with suffix `c` and using gate `d` to convert blocks to
307characters. Each set of four characters will be separated by `-`, except for
308base 10 which will be printed with commas separating thousands.
310#### Accepts
312- `a` is a `@`, and is the sample of `++at`
313- `b` is a `@`, denoting the the base.
314- `c` is a `tape`, and will be appended to the end of the result.
315- `d` is a `gate` that takes `@` and produces `@`.
317#### Produces
319A `tape`.
321#### Source
323```hoon
324++ rum
325 |= [b=@ c=tape d=$-(@ @)]
326 ^- tape
327 ?: =(0 a)
328 [(d 0) c]
329 =+ e=0
330 |- ^- tape
331 ?: =(0 a)
332 c
333 =+ f=&(!=(0 e) =(0 (mod e ?:(=(10 b) 3 4))))
334 %= $
335 a (div a b)
336 c [(d (mod a b)) ?:(f [?:(=(10 b) ',' '-') c] c)]
337 e +(e)
338 ==
339```
341#### Examples
343```
344> (~(rum at 0xdead.beef) 10 ~ |=(b=@ (add '0' b)))
345"3,735,928,559"
346```
348```
349> (~(rum at 0xdead.beef) 10 " m/s" |=(b=@ (add '0' b)))
350"3,735,928,559 m/s"
351```
353```
354> (~(rum at 0xdead.beef) 2 ~ |=(b=@ (add '0' b)))
355"1101-1110-1010-1101-1011-1110-1110-1111"
356```
358---
360### `++rup:at`
362Print `@p` (outdated)
364Print `a` as an `@p`, but with outdated syntax and number<->syllable mapping. This
365function almost certainly should not be used.
367#### Accepts
369`a` is a `@`.
371#### Produces
373A `tape`.
375#### Source
377```hoon
378++ rup
379 =+ b=(met 3 a)
380 ^- tape
381 :- '-'
382 |- ^- tape
383 ?: (gth (met 5 a) 1)
384 %+ weld
385 $(a (rsh 5 a), b (sub b 4))
386 `tape`['-' '-' $(a (end 5 a), b 4)]
387 ?: =(0 b)
388 ['~' ~]
389 ?: (lte b 1)
390 (trip (tos:po a))
391 |- ^- tape
392 ?: =(2 b)
393 =+ c=(rsh 3 a)
394 =+ d=(end 3 a)
395 (weld (trip (tod:po c)) (trip (tos:po (mix c d))))
396 =+ c=(rsh [3 2] a)
397 =+ d=(end [3 2] a)
398 (weld ^$(a c, b (met 3 c)) `tape`['-' $(a (mix c d), b 2)])
399```
401#### Examples
403```
404> ~(rup at 0xdead.beef)
405"-rylsal-sellac"
406```
408```
409> ~(rup at ~sampel-palnet)
410"-sellod-lebdiv"
411```
413```
414> ~(rup at ~zod)
415"-~"
416```
418---
420### `++ruv:at`
422Print base-64
424Print `a` as **outdated** base-64 syntax, with `0v` rather than `0w` prefix,
425different character mappings and separators.
427#### Accepts
429`a` is a `@`, and is the sample of `++at`.
431#### Produces
433A `tape`.
435#### Source
437```hoon
438++ ruv
439 ^- tape
440 :+ '0'
441 'v'
442 %^ rum
443 64
444 ~
445 |= b=@
446 ?: =(63 b)
447 '+'
448 ?: =(62 b)
449 '-'
450 ?:((lth b 26) (add 65 b) ?:((lth b 52) (add 71 b) (sub b 4)))
451```
453#### Examples
455```
456> ~(ruv at 0xdead.beef)
457"0vDe-rb7v"
458```
460Note this is how it should be rendered:
462```
463> `@uw`0xdead.beef
4640w3.uHrXL
465```
467---
469### `++rux:at`
471Print hexadecimal
473Print `a` as `@ux` except with `-` separators rather than `.`s.
475#### Accepts
477`a` is a `@`, and is the sample of `++at`.
479#### Produces
481A `tape`.
483#### Source
485```hoon
486++ rux `tape`['0' 'x' (rum 16 ~ |=(b=@ (add b ?:((lth b 10) 48 87))))]
487```
489#### Examples
491```
492> ~(rux at 0xdead.beef)
493"0xdead-beef"
494```
496---
498## `++cass`
500To lowercase
502Turn all occurences of uppercase letters in any `tape` into lowercase
503letters. Returns a `tape`.
505#### Accepts
507`vib` is a `tape`.
509#### Produces
511A `tape`.
513#### Source
515```hoon
516++ cass
517 |= vib=tape
518 ^- tape
519 (turn vib |=(a=@ ?.(&((gte a 'A') (lte a 'Z')) a (add 32 a))))
520```
522#### Examples
524```
525> (cass "JOHN DOE")
526"john doe"
528> (cass "abc ABC 123 !@#")
529"abc abc 123 !@#"
531> (cass "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsQqRrVvWwXxYyZz")
532"aabbccddeeffgghhiijjkkllmmnnooppqqrrssqqrrvvwwxxyyzz"
533```
535---
537## `++crip`
539Tape to cord
541Produce a `cord` from a `tape`.
543#### Accepts
545`a` is a `tape`.
547#### Produces
549A `cord`.
551#### Source
553```hoon
554++ crip |=(a=tape `@t`(rap 3 a))
555```
557#### Examples
559```
560> (crip "john doe")
561'john doe'
563> (crip "abc 123 !@#")
564'abc 123 !@#'
566> `@ud`(crip "abc")
5676.513.249
568```
570---
572## `++cuss`
574To uppercase
576Turn all occurences of lowercase letters in any `tape` into uppercase
577letters. Returns a `tape`.
579#### Accepts
581`vib` is a `tape`.
583#### Produces
585A `tape`.
587#### Source
589```hoon
590++ cuss
591 |= vib=tape
592 ^- tape
593 (turn vib |=(a=@ ?.(&((gte a 'a') (lte a 'z')) a (sub a 32))))
594```
596#### Examples
598```
599> (cuss "john doe")
600"JOHN DOE"
602> (cuss "abc ABC 123 !@#")
603"ABC ABC 123 !@#"
605> (cuss "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsQqRrVvWwXxYyZz")
606"AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSQQRRVVWWXXYYZZ"
607```
609---
611## `++mesc`
613Escape special chars
615Escape special characters.
617#### Accepts
619`vib` is a `tape`.
621#### Produces
623A `tape`.
625#### Source
627```hoon
628++ mesc
629 |= vib=tape
630 ^- tape
631 ?~ vib
632 ~
633 ?: =('\\' i.vib)
634 ['\\' '\\' $(vib t.vib)]
635 ?: ?|((gth i.vib 126) (lth i.vib 32) =(`@`39 i.vib))
636 ['\\' (welp ~(rux at i.vib) '/' $(vib t.vib))]
637 [i.vib $(vib t.vib)]
638```
640#### Examples
642```
643> (mesc "ham lus")
644"ham lus"
645> (mesc "bas\\hur")
646"bas\\\\hur"
647> (mesc "as'saß")
648"as\0x27/sa\0xc3/\0x9f/"
649```
651---
653## `++runt`
655Prepend `n` times
657Add `a` repetitions of character `b` to the head of `tape` `c`.
659#### Accepts
661`[a b]` are atoms.
663`c` is a `tape`.
665#### Produces
667A `tape`.
669#### Source
671```hoon
672++ runt
673 |= [[a=@ b=@] c=tape]
674 ^- tape
675 ?: =(0 a)
676 c
677 [b $(a (dec a))]
678```
680#### Examples
682```
683> (runt [2 '/'] "ham")
684"//ham"
686> (runt [10 'a'] "")
687"aaaaaaaaaa"
688```
690---
692## `++sand`
694Soft-cast by aura
696Check characters in `b` are valid for aura `a`. Produce a `unit` of `a` if valid
697and a null `unit` if not. Takes `a` and produces a gate that takes `b`.
699#### Accepts
701`a` is a `@ta`, and specifies the aura like `%tas` or `%ta`.
703`b` is an atom.
705#### Produces
707A `(unit @)`.
709#### Source
711```hoon
712++ sand
713 |= a=@ta
714 (flit (sane a))
715```
717#### Examples
719```
720> `(unit @ta)`((sand %ta) 'sym-som')
721[~ ~.sym-som]
722```
724```
725> `(unit @ta)`((sand %ta) 'err!')
727```
729---
731## `++sane`
733Check aura validity
735Check validity of `a` by aura `b`. Takes `b` and produces a gate that takes `a`.
737#### Accepts
739`a` is a `@ta`, and specifies the aura like `%tas` or `%ta`.
741`b` is an atom.
743#### Produces
745A `?`.
747#### Source
749```hoon
750++ sane
751 |= a=@ta
752 |= b=@ ^- ?
753 ?. =(%t (end 3 a))
754 :: XX more and better sanity
755 ::
756 &
757 =+ [inx=0 len=(met 3 b)]
758 ?: =(%tas a)
759 |- ^- ?
760 ?: =(inx len) &
761 =+ cur=(cut 3 [inx 1] b)
762 ?& ?| &((gte cur 'a') (lte cur 'z'))
763 &(=('-' cur) !=(0 inx) !=(len inx))
764 &(&((gte cur '0') (lte cur '9')) !=(0 inx))
765 ==
766 $(inx +(inx))
767 ==
768 ?: =(%ta a)
769 |- ^- ?
770 ?: =(inx len) &
771 =+ cur=(cut 3 [inx 1] b)
772 ?& ?| &((gte cur 'a') (lte cur 'z'))
773 &((gte cur '0') (lte cur '9'))
774 |(=('-' cur) =('~' cur) =('_' cur) =('.' cur))
775 ==
776 $(inx +(inx))
777 ==
778 |- ^- ?
779 ?: =(0 b) &
780 =+ cur=(end 3 b)
781 ?: &((lth cur 32) !=(10 cur)) |
782 =+ len=(teff cur)
783 ?& |(=(1 len) =+(i=1 |-(|(=(i len) &((gte (cut 3 [i 1] b) 128) $(i +(i)))))))
784 $(b (rsh [3 len] b))
785 ==
786```
788#### Examples
790```
791> ((sane %tas) %mol)
792%.y
794> ((sane %tas) 'lam')
795%.y
797> ((sane %tas) 'more ace')
798%.n
799```
801---
803## `++taft`
805UTF8 to UTF32
807Convert `cord` `a` to a UTF32 `@c`.
809#### Accepts
811`a` is a `@t`.
813#### Produces
815A `@c`.
817#### Source
819```hoon
820++ taft
821 |= a=@t
822 ^- @c
823 %+ rap 5
824 |- ^- (list @c)
825 =+ b=(teff a)
826 ?: =(0 b) ~
827 =+ ^= c
828 %+ can 0
829 %+ turn
830 ^- (list [p=@ q=@])
831 ?+ b !!
832 %1 [[0 7] ~]
833 %2 [[8 6] [0 5] ~]
834 %3 [[16 6] [8 6] [0 4] ~]
835 %4 [[24 6] [16 6] [8 6] [0 3] ~]
836 ==
837 |=([p=@ q=@] [q (cut 0 [p q] a)])
838 ?> =((tuft c) (end [3 b] a))
839 [c $(a (rsh [3 b] a))]
840```
842#### Examples
844```
845> (taft 'foobar')
846~-foobar
848> `@ux`'foobar'
8490x7261.626f.6f66
851> `@ux`~-foobar
8520x72.0000.0061.0000.0062.0000.006f.0000.006f.0000.0066
853```
855---
857## `++teff`
859UTF8 Length
861Produces the number of utf8 bytes of `a`, a single `@t` character. If `a`
862contains more than one character, it will produce the byte-length of the first
863one.
865#### Accepts
867`a` is a `@t`.
869#### Produces
871An atom.
873#### Source
875```hoon
876++ teff
877 |= a=@t ^- @
878 =+ b=(end 3 a)
879 ?: =(0 b)
880 ?>(=(`@`0 a) 0)
881 ?> |((gte b 32) =(10 b))
882 ?:((lte b 127) 1 ?:((lte b 223) 2 ?:((lte b 239) 3 4)))
883```
885#### Examples
887```
888> (teff 'a')
891> (teff 'ß')
894> (teff 'aß')
896```
898---
900## `++trim`
902Tape split
904Split first `a` characters off `tape` `b`.
906#### Accepts
908`a` is an atom.
910`b` is a `tape`.
912#### Produces
914A cell of `tape`s, `p` and `q`.
916#### Source
918```hoon
919++ trim
920 |= [a=@ b=tape]
921 ^- [p=tape q=tape]
922 ?~ b
923 [~ ~]
924 ?: =(0 a)
925 [~ b]
926 =+ c=$(a (dec a), b t.b)
927 [[i.b p.c] q.c]
928```
930#### Examples
932```
933> (trim 5 "lasok termun")
934[p="lasok" q=" termun"]
936> (trim 5 "zam")
937[p="zam" q=""]
938```
940---
942## `++trip`
944Cord to tape
946Produce a `tape` from `cord` `a`.
948#### Accepts
950`a` is an atom.
952#### Produces
954A `tape`.
956#### Source
958```hoon
959++ trip
960 ~/ %trip
961 |= a=@ ^- tape
962 ?: =(0 (met 3 a))
963 ~
964 [^-(@ta (end 3 a)) $(a (rsh 3 a))]
965```
967#### Examples
969```
970> (trip 'john doe')
971"john doe"
973> (trip 'abc 123 !@#')
974"abc 123 !@#"
976> (trip 'abc')
977"abc"
978```
980---
982## `++tuba`
984UTF8 tape to UTF32 tape
986Convert `tape` to a `list` of codepoints (`@c`).
988#### Accepts
990`a` is a `tape`.
992#### Produces
994A `(list @c)`.
996#### Source
998```hoon
999++ tuba
1000 |= a=tape
1001 ^- (list @c)
1002 (rip 5 (taft (rap 3 a)))
1003```
1005#### Examples
1007```
1008> (tuba "я тут")
1009~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.]
1011> (tuba "chars")
1012~[~-c ~-h ~-a ~-r ~-s]
1013```
1015---
1017## `++tufa`
1019UTF32 to UTF8 tape
1021Wrap a `list` of utf32 codepoints into a utf8 `tape`.
1023#### Accepts
1025`a` is a `(list @c)`.
1027#### Produces
1029A `tape`.
1031#### Source
1033```hoon
1034++ tufa
1035 |= a=(list @c)
1036 ^- tape
1037 ?~ a ""
1038 (weld (rip 3 (tuft i.a)) $(a t.a))
1039```
1041#### Examples
1043```
1044> (tufa ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.])
1045"я тут"
1047> (tufa ((list @c) ~[%a %b 0xb1 %c]))
1048"ab±c"
1049```
1051---
1053## `++tuft`
1055UTF32 to UTF8
1057Convert `@c` to `cord`.
1059#### Accepts
1061`a` is a `@c`.
1063#### Produces
1065A `cord`.
1067#### Source
1069```hoon
1070++ tuft
1071 |= a=@c
1072 ^- @t
1073 %+ rap 3
1074 |- ^- (list @)
1075 ?: =(`@`0 a)
1077 =+ b=(end 5 a)
1078 =+ c=$(a (rsh 5 a))
1079 ?: (lte b 0x7f)
1080 [b c]
1081 ?: (lte b 0x7ff)
1082 :* (mix 0b1100.0000 (cut 0 [6 5] b))
1083 (mix 0b1000.0000 (end [0 6] b))
1085 ==
1086 ?: (lte b 0xffff)
1087 :* (mix 0b1110.0000 (cut 0 [12 4] b))
1088 (mix 0b1000.0000 (cut 0 [6 6] b))
1089 (mix 0b1000.0000 (end [0 6] b))
1091 ==
1092 :* (mix 0b1111.0000 (cut 0 [18 3] b))
1093 (mix 0b1000.0000 (cut 0 [12 6] b))
1094 (mix 0b1000.0000 (cut 0 [6 6] b))
1095 (mix 0b1000.0000 (end [0 6] b))
1097 ==
1098```
1100#### Examples
1102```
1103> (tuft ~-foobar)
1104'foobar'
1106> `@ux`~-foobar
11070x72.0000.0061.0000.0062.0000.006f.0000.006f.0000.0066
1109> `@ux`'foobar'
11100x7261.626f.6f66
1111```
1113---
1115## `++wack`
1117Knot escape
1119Escape `knot` `~` as `~~` and `_` as `~-`. Used for printing.
1121#### Accepts
1123`a` is a `knot`.
1125#### Produces
1127A `knot`.
1129#### Source
1131```hoon
1132++ wack
1133 |= a=@ta
1134 ^- @ta
1135 =+ b=(rip 3 a)
1136 %+ rap 3
1137 |- ^- tape
1138 ?~ b
1140 ?: =('~' i.b) ['~' '~' $(b t.b)]
1141 ?: =('_' i.b) ['~' '-' $(b t.b)]
1142 [i.b $(b t.b)]
1143```
1145#### Examples
1147```
1148> (wack '~20_sam~')
1149~.~~20~-sam~~
1151> `@t`(wack '~20_sam~')
1152'~~20~-sam~~'
1153```
1155---
1157## `++wick`
1159Knot unescape
1161Unescape `knot` `~~` as `~` and `~-` as `_`. Produces a `unit`, which is null if
1162the `knot` contains unescaped `~` characters.
1164#### Accepts
1166`a` is a an atom.
1168#### Produces
1170A `(unit @ta)`.
1172#### Source
1174```hoon
1175++ wick
1176 |= a=@
1177 ^- (unit @ta)
1178 =+ b=(rip 3 a)
1179 =- ?^(b ~ (some (rap 3 (flop c))))
1180 =| c=tape
1181 |- ^- [b=tape c=tape]
1182 ?~ b [~ c]
1183 ?. =('~' i.b)
1184 $(b t.b, c [i.b c])
1185 ?~ t.b [b ~]
1186 ?- i.t.b
1187 %'~' $(b t.t.b, c ['~' c])
1188 %'-' $(b t.t.b, c ['_' c])
1189 @ [b ~]
1190 ==
1191```
1193#### Examples
1195```
1196> (wick ~.~~20~-sam~~)
1197[~ ~.~20_sam~]
1199> (wick ~.~20~-sam~~)
1201```
1203---
1205## `++woad`
1207Unescape cord
1209Unescape `knot`-encoded `cord`.
1211#### Accepts
1213`a` is a `@ta`.
1215#### Produces
1217A `cord`.
1219#### Source
1221```hoon
1222++ woad
1223 |= a=@ta
1224 ^- @t
1225 %+ rap 3
1226 |- ^- (list @)
1227 ?: =(`@`0 a)
1229 =+ b=(end 3 a)
1230 =+ c=(rsh 3 a)
1231 ?: =('.' b)
1232 [' ' $(a c)]
1233 ?. =('~' b)
1234 [b $(a c)]
1235 => .(b (end 3 c), c (rsh 3 c))
1236 ?+ b =- (weld (rip 3 (tuft p.d)) $(a q.d))
1237 ^= d
1238 =+ d=0
1239 |- ^- [p=@ q=@]
1240 ?: =('.' b)
1241 [d c]
1242 ?< =(0 c)
1243 %= $
1244 b (end 3 c)
1245 c (rsh 3 c)
1246 d %+ add (mul 16 d)
1247 %+ sub b
1248 ?: &((gte b '0') (lte b '9')) 48
1249 ?>(&((gte b 'a') (lte b 'z')) 87)
1250 ==
1251 %'.' ['.' $(a c)]
1252 %'~' ['~' $(a c)]
1253 ==
1254```
1256#### Examples
1258```
1259> (woad ~.foo.bar~21.)
1260'foo bar!'
1261```
1263---
1265## `++wood`
1267Escape cord
1269Escape `cord` `a` so it can be encoded in a `knot`.
1271#### Accepts
1273`a` is a `cord`.
1275#### Produces
1277A `knot`.
1279#### Source
1281```hoon
1282++ wood
1283 |= a=@t
1284 ^- @ta
1285 %+ rap 3
1286 |- ^- (list @)
1287 ?: =(`@`0 a)
1289 =+ b=(teff a)
1290 =+ c=(taft (end [3 b] a))
1291 =+ d=$(a (rsh [3 b] a))
1292 ?: ?| &((gte c 'a') (lte c 'z'))
1293 &((gte c '0') (lte c '9'))
1294 =(`@`'-' c)
1295 ==
1296 [c d]
1297 ?+ c
1298 :- '~'
1299 =+ e=(met 2 c)
1300 |- ^- tape
1301 ?: =(0 e)
1302 ['.' d]
1303 =. e (dec e)
1304 =+ f=(rsh [2 e] c)
1305 [(add ?:((lte f 9) 48 87) f) $(c (end [2 e] c))]
1306 ::
1307 %' ' ['.' d]
1308 %'.' ['~' '.' d]
1309 %'~' ['~' '~' d]
1310 ==
1311```
1313#### Examples
1315```
1316> (wood 'foo bar!')
1317~.foo.bar~21.
1318```
1320---