on 4fdc19d help sign in
1796 lines 22 kB history raw
1+++
2title = "4j: Parsing (Bases and Base Digits)"
3weight = 37
4template = "doc.html"
5+++
7## `++ab`
9Primitive parser engine
11A core containing numeric parser primitives.
13#### Source
15```hoon
16++ ab
17 |%
18```
20#### Examples
22```
23> ab
24<36.ecc 414.gly 100.xkc 1.ypj %164>
25```
27---
29### `++bix:ab`
31Parse hex pair
33Parsing `rule`. Parses a pair of base-16 digits. Used in escapes.
35#### Source
37```hoon
38++ bix (bass 16 (stun [2 2] six))
39```
41#### Examples
43```
44> (scan "07" bix:ab)
46> (scan "51" bix:ab)
4781
48> (scan "a3" bix:ab)
49163
50```
52---
54### `++fem:ab`
56Parse base58check char
58Parse a single base58check character.
60#### Source
62```hoon
63++ fem (sear |=(a=@ (cha:fa a)) aln)
64```
66#### Examples
68```
69> (scan "6" fem:ab)
72> (scan "Z" fem:ab)
7332
75> (scan "j" fem:ab)
7642
77```
79---
81### `++haf:ab`
83Parse non-doz phonetic pair
85Parsing `rule`. Parses an atom of aura `@pE`, a phrase of two bytes encoded
86phonetically. If the leading syllable is `doz` (`0`), parsing will fail.
88#### Source
90```hoon
91++ haf (bass 256 ;~(plug tep tiq (easy ~)))
92```
94#### Examples
96```
97> `@p`(scan "sampel" haf:ab)
98~sampel
100> `@p`(scan "dozpel" haf:ab)
101{1 4}
102syntax error
103```
105---
107### `++hef:ab`
109Parse non-dozzod phonetic pair
111Parsing `rule`. Parses an atom of aura `@pE` without leading `~` or `.~`, a
112phrase of two bytes encoded phonetically. If it's `dozzod`, parsing will fail.
114#### Source
116```hoon
117++ hef %+ sear |=(a=@ ?:(=(a 0) ~ (some a)))
118 %+ bass 256
119 ;~(plug tip tiq (easy ~))
120```
122#### Examples
124```
125> `@p`(scan "sampel" hef:ab)
126~sampel
128> `@p`(scan "dozpel" hef:ab)
129~pel
131> `@p`(scan "dozzod" hef:ab)
132{1 7}
133syntax error
134```
136---
138### `++hif:ab`
140Parse phonetic pair
142Parsing `rule`. Parses an atom of aura `@pE`, without leading `~` or `.~`. A
143phrase of two bytes encoded phonetically.
145#### Source
147```hoon
148++ hif (boss 256 ;~(plug tip tiq (easy ~)))
149```
151#### Examples
153```
154> `@p`(scan "doznec" hif:ab)
155~nec
157> `@p`(scan "pittyp" hif:ab)
158~pittyp
159```
161---
163### `++hof:ab`
165Parse 2-4 @q phonetic pairs
167Parsing `rule`. Parses an atom of aura `@q` (non-scrambled `@p`), without
168leading `~` or `.~`, of between two and four phrases.
170#### Source
172```hoon
173++ hof (bass 0x1.0000 ;~(plug hef (stun [1 3] ;~(pfix hep hif))))
174```
176#### Example
178```
179> `@q`(scan "sampel-palnet" hof:ab)
180.~sampel-palnet
182> `@q`(scan "sampel-sampel-palnet" hof:ab)
183.~sampel-sampel-palnet
185> `@q`(scan "sampel-sampel-sampel-palnet" hof:ab)
186.~sampel-sampel-sampel-palnet
187```
189---
191### `++huf:ab`
193Parse 1-4 @q phonetic pairs
195Parsing `rule`. Parses an atom of aura `@q` (non-scrambled `@p`), without
196leading `~` or `.~`, of between one and four phrases.
198#### Source
200```hoon
201++ huf (bass 0x1.0000 ;~(plug hef (stun [0 3] ;~(pfix hep hif))))
202```
204#### Examples
206```
207> `@q`(scan "sampel" huf:ab)
208.~sampel
210> `@q`(scan "sampel-palnet" huf:ab)
211.~sampel-palnet
213> `@q`(scan "sampel-sampel-palnet" huf:ab)
214.~sampel-sampel-palnet
216> `@q`(scan "sampel-sampel-sampel-palnet" huf:ab)
217.~sampel-sampel-sampel-palnet
218```
220---
222### `++hyf:ab`
224Parse four @q phonetic pairs
226Parsing `rule`. Parses an atom of aura `@q` (non-scrambled `@p`), without
227leading `~` or `.~`, of exactly four phrases.
229#### Source
231```hoon
232++ hyf (bass 0x1.0000 ;~(plug hif (stun [3 3] ;~(pfix hep hif))))
233```
235#### Examples
237```
238> `@q`(scan "sampel-sampel-sampel-palnet" hyf:ab)
239.~sampel-sampel-sampel-palnet
240```
242---
244### `++pev:ab`
246Parse 1-5 @uv base-32 chars
248Parsing `rule`. Parses one to five `@uv` base-32 digits without the leading `0v`
249or leading zeros.
251#### Source
253```hoon
254++ pev (bass 32 ;~(plug sev (stun [0 4] siv)))
255```
257#### Examples
259```
260> `@uv`(scan "du3ja" pev:ab)
2610vdu3ja
263> `@uv`(scan "3ja" pev:ab)
2640v3ja
266> `@uv`(scan "a" pev:ab)
2670va
268```
270---
272### `++pew:ab`
274Parse 1-5 @uw base-64 chars
276Parsing `rule`. Parses one to five `@uw` base-64 digits without the leading `0w`
277or leading zeros.
279#### Source
281```hoon
282++ pew (bass 64 ;~(plug sew (stun [0 4] siw)))
283```
285#### Examples
287```
288> `@uw`(scan "6U0gP" pew:ab)
2890w6U0gP
291> `@uw`(scan "gP" pew:ab)
2920wgP
294> `@uw`(scan "P" pew:ab)
2950wP
296```
298---
300### `++piv:ab`
302Parse 5 @uv base-32 chars
304Parsing `rule`. Parses exactly five `@uv` base-32 digits without the leading
305`0v` or leading zeros.
307#### Source
309```hoon
310++ piv (bass 32 (stun [5 5] siv))
311```
313#### Examples
315```
316> `@uv`(scan "du3ja" piv:ab)
3170vdu3ja
319> `@uv`(scan "u3ja" piv:ab)
320{1 5}
321syntax error
322```
324---
326### `++piw:ab`
328Parse 5 @uw base-64 chars
330Parsing `rule`. Parses exactly five `@uw` base-64 digits without the leading
331`0w` or leading zeros.
333#### Source
335```hoon
336++ piw (bass 64 (stun [5 5] siw))
337```
339#### Examples
341```
342> `@uw`(scan "6U0gP" piw:ab)
3430w6U0gP
345> `@uw`(scan "U0gP" piw:ab)
346{1 5}
347syntax error
348```
350---
352### `++qeb:ab`
354Parse 1-4 binary digits
356Parsing `rule`. Parses a binary number of up to 4 digits in length without a
357leading zero.
359#### Source
361```hoon
362++ qeb (bass 2 ;~(plug seb (stun [0 3] sib)))
363```
365#### Examples
367```
368> `@ub`(scan "1010" qeb:ab)
3690b1010
371> `@ub`(scan "10" qeb:ab)
3720b10
374> `@ub`(scan "1" qeb:ab)
3750b1
377> `@ub`(scan "0" qeb:ab)
378{1 1}
379syntax error
380```
382---
384### `++qex:ab`
386Parse 1-4 hex digits
388Parsing `rule`. Parses a hexadecimal number of up to 4 digits in length without
389a leading zero.
391#### Source
393```hoon
394++ qex (bass 16 ;~(plug sex (stun [0 3] hit)))
395```
397#### Examples
399```
400> `@ux`(scan "beef" qex:ab)
4010xbeef
403> `@ux`(scan "ef" qex:ab)
4040xef
406> `@ux`(scan "f" qex:ab)
4070xf
408```
410---
412### `++qib:ab`
414Parse 4 binary
416Parsing `rule`. Parses exactly four binary digits - may have leading zeros.
418#### Source
420```hoon
421++ qib (bass 2 (stun [4 4] sib))
422```
424#### Examples
426```
427> `@ub`(scan "0001" qib:ab)
4280b1
430> `@ub`(scan "1001" qib:ab)
4310b1001
433> `@ub`(scan "1" qib:ab)
434{1 2}
435syntax error
436```
438---
440### `++qix:ab`
442Parse 4 hex
444Parsing `rule`. Parses exactly four hexadecimal digits - may have leading zeros.
446#### Source
448```hoon
449++ qix (bass 16 (stun [4 4] six))
450```
452#### Examples
454```
455> `@ux`(scan "beef" qix:ab)
4560xbeef
458> `@ux`(scan "0000" qix:ab)
4590x0
461> `@ux`(scan "ef" qix:ab)
462{1 3}
463syntax error
464```
466---
468### `++seb:ab`
470Parse 1
472Parsing `rule`. Parses the number 1.
474#### Source
476```hoon
477++ seb (cold 1 (just '1'))
478```
480#### Examples
482```
483> (scan "1" seb:ab)
486> (scan "2" seb:ab)
487{1 1}
488syntax error
489```
491---
493### `++sed:ab`
495Parse decimal
497Parsing `rule`. Parses a nonzero decimal digit.
499#### Source
501```hoon
502++ sed (cook |=(a=@ (sub a '0')) (shim '1' '9'))
503```
505#### Examples
507```
508> (scan "5" sed:ab)
511> (scan "0" sed:ab)
512{1 1}
513syntax error
514```
516---
518### `++sev:ab`
520Parse base-32
522Parsing `rule`. Parses a nonzero base-32 digit.
524#### Source
526```hoon
527++ sev ;~(pose sed sov)
528```
530#### Examples
532```
533> `@uv`(scan "2" sev:ab)
5340v2
536> `@uv`(scan "j" sev:ab)
5370vj
539> `@uv`(scan "0" sev:ab)
540{1 1}
541syntax error
542```
544---
546### `++sew:ab`
548Parse base-64
550Parsing `rule`. Parses a nonzero base-64 digit.
552#### Source
554```hoon
555++ sew ;~(pose sed sow)
556```
558#### Examples
560```
561> `@uw`(scan "I" sew:ab)
5620wI
564> `@uw`(scan "2" sew:ab)
5650w2
567> `@uw`(scan "0" sew:ab)
568{1 1}
569syntax error
570```
572---
574### `++sex:ab`
576Parse hex
578Parsing `rule`. Parses a non-zero hexadecimal digit.
580#### Source
582```hoon
583++ sex ;~(pose sed sox)
584```
586#### Examples
588```
589> `@ux`(scan "a" sex:ab)
5900xa
592> `@ux`(scan "2" sex:ab)
5930x2
595> `@ux`(scan "0" sex:ab)
596{1 1}
597syntax error
598```
600---
602### `++sib:ab`
604Parse binary
606Parsing `rule`. Parses a binary digit.
608#### Source
610```hoon
611++ sib (cook |=(a=@ (sub a '0')) (shim '0' '1'))
612```
614#### Examples
616```
617> `@ub`(scan "1" sib:ab)
6180b1
620> `@ub`(scan "0" sib:ab)
6210b0
622```
624---
626### `++sid:ab`
628Parse decimal
630Parsing `rule`. Parses a decimal digit.
632#### Source
634```hoon
635++ sid (cook |=(a=@ (sub a '0')) (shim '0' '9'))
636```
638#### Examples
640```
641> (scan "5" sid:ab)
644> (scan "0" sid:ab)
646```
648---
650### `++siv:ab`
652Parse base-32
654Parsing `rule`. Parses a base-32 digit.
656#### Source
658```hoon
659++ siv ;~(pose sid sov)
660```
662#### Examples
664```
665> `@uv`(scan "r" siv:ab)
6660vr
668> `@uv`(scan "5" siv:ab)
6690v5
671> `@uv`(scan "0" siv:ab)
6720v0
673```
675---
677### `++siw:ab`
679Parse base-64
681Parsing `rule`. Parses a base-64 digit.
683#### Source
685```hoon
686++ siw ;~(pose sid sow)
687```
689#### Examples
691```
692> `@uw`(scan "M" siw:ab)
6930wM
695> `@uw`(scan "0" siw:ab)
6960w0
698> `@uw`(scan "c" siw:ab)
6990wc
700```
702---
704### `++six:ab`
706Parse hex
708Parsing `rule`. Parses a hexadecimal digit.
710#### Source
712```hoon
713++ six ;~(pose sid sox)
714```
716#### Examples
718```
719> `@ux`(scan "e" six:ab)
7200xe
722> `@ux`(scan "0" six:ab)
7230x0
724```
726---
728### `++sov:ab`
730Parse @uv base-32 letter
732Parsing `rule`. Parses a `@uv` base-32 letter (but not a number).
734#### Source
736```hoon
737++ sov (cook |=(a=@ (sub a 87)) (shim 'a' 'v'))
738```
740#### Examples
742```
743> `@uv`(scan "c" sov:ab)
7440vc
746> `@uv`(scan "j" sov:ab)
7470vj
749> `@uv`(scan "5" sov:ab)
750{1 1}
751syntax error
752```
754---
756### `++sow:ab`
758Parse @uw base-64 letter/symbol
760Parsing `rule`. Parses a base-64 letter/symbol (but not number).
762#### Source
764```hoon
765++ sow ;~ pose
766 (cook |=(a=@ (sub a 87)) (shim 'a' 'z'))
767 (cook |=(a=@ (sub a 29)) (shim 'A' 'Z'))
768 (cold 62 (just '-'))
769 (cold 63 (just '~'))
770 ==
771```
773#### Examples
775```
776> `@uw`(scan "M" sow:ab)
7770wM
779> `@uw`(scan "5" sow:ab)
780{1 1}
781syntax error
782```
784---
786### `++sox:ab`
788Parse hex letter
790Parsing `rule`. Parses a hexadecimal letter (but not number).
792#### Source
794```hoon
795++ sox (cook |=(a=@ (sub a 87)) (shim 'a' 'f'))
796```
798#### Examples
800```
801> `@ux`(scan "e" sox:ab)
8020xe
804> `@ux`(scan "5" sox:ab)
805{1 1}
806syntax error
807```
809---
811### `++ted:ab`
813Parse 1-999 decimal
815Parsing `rule`. Parses a decimal number of up to 3 digits without a
816leading zero.
818#### Source
820```hoon
821++ ted (bass 10 ;~(plug sed (stun [0 2] sid)))
822```
824#### Examples
826```
827> (scan "214" ted:ab)
828214
830> (scan "2" ted:ab)
833> (scan "2161" ted:ab)
834{1 4}
835syntax error
836```
838---
840### `++tep:ab`
842Parse non-doz leading phonetic byte
844Parsing `rule`. Parses the leading phonetic byte , which represents a syllable.
845Fails if it is `doz`.
847#### Source
849```hoon
850++ tep (sear |=(a=@ ?:(=(a 'doz') ~ (ins:po a))) til)
851```
853#### Examples
855```
856> (scan "sam" tep:ab)
859> (scan "wic" tep:ab)
86099
861```
863---
865### `++tip:ab`
867Leading phonetic byte
869Parsing `rule`. Parses the leading phonetic byte, which represents a syllable.
871#### Source
873```hoon
874++ tip (sear |=(a=@ (ins:po a)) til)
875```
877#### Examples
879```
880> (scan "doz" tip:ab)
883> (scan "pit" tip:ab)
884242
885```
887---
889### `++tiq:ab`
891Trailing phonetic syllable
893Parsing `rule`. Parses the trailing phonetic byte, which represents a syllable.
895#### Source
897```hoon
898++ tiq (sear |=(a=@ (ind:po a)) til)
899```
901#### Examples
903```
904> (scan "zod" tiq:ab)
906> (scan "nec" tiq:ab)
908```
910---
912### `++tid:ab`
914Parse 3 decimal digits
916Parsing `rule`. Parses exactly three decimal digits.
918#### Source
920```hoon
921++ tid (bass 10 (stun [3 3] sid))
922```
924#### Examples
926```
927> (scan "013" tid:ab)
92813
930> (scan "999" tid:ab)
931999
933> (scan "99" tid:ab)
934{1 3}
935syntax error
936```
938---
940### `++til:ab`
942Parse 3 lowercase
944Parsing `rule`. Parses exactly three lowercase letters.
946#### Source
948```hoon
949++ til (boss 256 (stun [3 3] low))
950```
952#### Examples
954```
955> `@t`(scan "mer" til:ab)
956'mer'
958> `@t`(scan "me" til:ab)
959{1 3}
960syntax error
961```
963---
965### `++urs:ab`
967Parse knot characters
969Parsing rule. Parses characters from an atom of the knot aura `@ta`.
971#### Source
973```hoon
974++ urs %+ cook
975 |=(a=tape (rap 3 ^-((list @) a)))
976 (star ;~(pose nud low hep dot sig cab))
977```
979#### Examples
981```
982> `@ta`(scan "asa-lom_tak" urs:ab)
983~.asa-lom_tak
984```
986---
988### `++urt:ab`
990Parse knot without underscores
992Parsing `rule`. Parses all characters of the knot aura `@ta` except for cab,
993`_`.
995#### Source
997```hoon
998++ urt %+ cook
999 |=(a=tape (rap 3 ^-((list @) a)))
1000 (star ;~(pose nud low hep dot sig))
1001```
1003#### Examples
1005```
1006> `@ta`(scan "asa-lom.t0k" urt:ab)
1007~.asa-lom.t0k
1008```
1010---
1012### `++voy:ab`
1014Parse bas, soq, or bix
1016Parsing `rule`. Parses an escaped backslash, single quote, or hex pair byte.
1018#### Source
1020```hoon
1021++ voy ;~(pfix bas ;~(pose bas soq bix))
1022```
1024#### Examples
1026```
1027> (scan "\\\\" voy:ab)
1028'\\'
1030> (scan "\\'" voy:ab)
1031'\''
1033> (scan "\\0a" voy:ab)
1034'\0a'
1035```
1037---
1039## `++ag`
1041Top-level atom parser engine
1043A core containing top-level atom parsers.
1045#### Source
1047```hoon
1048++ ag
1049 |%
1050```
1052---
1054### `++ape:ag`
1056Parse 0 or rule
1058Parser modifier. Parses 0 or the sample rule `fel`.
1060#### Accepts
1062`fel` is a `rule`.
1064#### Produces
1066A `rule`.
1068#### Source
1070```hoon
1071++ ape |*(fel=rule ;~(pose (cold 0 (just '0')) fel))
1072```
1074#### Examples
1076```
1077> (scan "0" (ape:ag (cold 2 (just '2'))))
1080> (scan "2" (ape:ag (cold 2 (just '2'))))
1083> (scan "3" (ape:ag (cold 2 (just '2'))))
1084{1 1}
1085syntax error
1086```
1088---
1090### `++bay:ag`
1092Parses binary number
1094Parsing `rule`. Parses a binary number without a leading zero.
1096#### Source
1098```hoon
1099++ bay (ape (bass 16 ;~(plug qeb:ab (star ;~(pfix dog qib:ab)))))
1100```
1102#### Examples
1104```
1105> `@ub`(scan "101.1100.0011.1010" bay:ag)
11060b101.1100.0011.1010
1107```
1109---
1111### `++bip:ag`
1113Parse IPv6
1115Parsing rule. Parses a `@is`, an IPv6 address.
1117#### Source
1119```hoon
1120++ bip =+ tod=(ape qex:ab)
1121 (bass 0x1.0000 ;~(plug tod (stun [7 7] ;~(pfix dog tod))))
1122```
1124#### Examples
1126```
1127> `@is`(scan "0.0.ea.3e6c.0.0.0.0" bip:ag)
1128.0.0.ea.3e6c.0.0.0.0
1129```
1131---
1133### `++dem:ag`
1135Parse decimal with dots
1137Parsing `rule`. Parses a decimal number that includes dot separators.
1139#### Source
1141```hoon
1142++ dem (ape (bass 1.000 ;~(plug ted:ab (star ;~(pfix dog tid:ab)))))
1143```
1145#### Examples
1147```
1148> (scan "52" dem:ag)
1150> (scan "13.507" dem:ag)
115113.507
1152```
1154---
1156### `++dim:ag`
1158Parse decimal number
1160Parsing rule. Parses a decimal number without a leading zero.
1162#### Source
1164```hoon
1165++ dim (ape dip)
1166```
1168#### Examples
1170```
1171> (scan "52" dim:ag)
1174> (scan "0" dim:ag)
1177> (scan "13507" dim:ag)
117813.507
1180> (scan "013507" dim:ag)
1181{1 2}
1182syntax error
1183```
1185---
1187### `++dum:ag`
1189Parse decimal with leading `0`
1191Parsing rule. Parses a decmial number with leading zeroes.
1193#### Source
1195```hoon
1196++ dum (bass 10 (plus sid:ab))
1197```
1199#### Examples
1201```
1202> (scan "52" dum:ag)
1204> (scan "0000052" dum:ag)
1206> (scan "13507" dim:ag)
120713.507
1208```
1210---
1212### `++fed:ag`
1214Parse phonetic base
1216Parsing rule. Parses an atom of aura `@p`, the phonetic base.
1218#### Source
1220```hoon
1221++ fed %+ cook fynd:ob
1222 ;~ pose
1223 %+ bass 0x1.0000.0000.0000.0000 :: oversized
1224 ;~ plug
1225 huf:ab
1226 (plus ;~(pfix doh hyf:ab))
1227 ==
1228 hof:ab :: planet or moon
1229 haf:ab :: star
1230 tiq:ab :: galaxy
1231 ==
1232```
1234#### Examples
1236```
1237> `@p`(scan "zod" fed:ag)
1238~zod
1240> `@p`(scan "sampel" fed:ag)
1241~sampel
1243> `@p`(scan "sampel-palnet" fed:ag)
1244~sampel-palnet
1246> `@p`(scan "sampel-palnet-sampel-palnet" fed:ag)
1247~sampel-palnet-sampel-palnet
1249> `@p`(scan "tillyn-nillyt-tasfyn-partyv--novweb-talrud-talmud-sonfyr" fed:ag)
1250~tillyn-nillyt-tasfyn-partyv--novweb-talrud-talmud-sonfyr
1251```
1253---
1255### `++feq:ag`
1257Parse `@q` phonetic base
1259Parsing rule. Parses an atom of aura `@q` (an unscrambled `@p`).
1261#### Source
1263```hoon
1264++ feq %+ cook |=(a=(list @) (rep 4 (flop a)))
1265 ;~ plug
1266 ;~(pose hif:ab tiq:ab)
1267 (star ;~(pfix dof hif:ab))
1268 ==
1269```
1271#### Examples
1273```
1274> `@q`(scan "sampel" feq:ag)
1275.~sampel
1277> `@q`(scan "sampel-palnet" feq:ag)
1278.~sampel-palnet
1280> `@q`(scan "sampel-sampel-palnet" feq:ag)
1281.~sampel-sampel-palnet
1283> `@q`(scan "sampel-palnet-sampel-palnet" feq:ag)
1284.~sampel-palnet-sampel-palnet
1286> `@q`(scan "sampel-sampel-sampel-sampel-palnet-sampel-palnet" feq:ag)
1287.~sampel-sampel-sampel-sampel-palnet-sampel-palnet
1288```
1290---
1292### `++fim:ag`
1294Parse base58check
1296Parse a base58check value, check checksum, and return decoded value sans-checksum. If
1297the checksum check fails, parsing will fail.
1299#### Source
1301```hoon
1302++ fim (sear den:fa (bass 58 (plus fem:ab)))
1303```
1305#### Examples
1307With valid checksum:
1309```
1310> (enc:fa 0xdead.beef)
13110xdead.beef.938b.8b0c
1312> (c-co:co 0xdead.beef.938b.8b0c)
1313"eFGDJSVvRHd"
1314> `@ux`(scan "eFGDJSVvRHd" fim:ag)
13150xdead.beef
1316```
1318With invalid checksum:
1320```
1321> (c-co:co 0xdead.beef.ffff)
1322"2utUWE41U"
1323> `@ux`(scan "2utUWE41U" fim:ag)
1324{1 10}
1325syntax error
1326```
1328---
1330### `++hex:ag`
1332Parse hex
1334Parsing `rule`. Parses a hexadecimal number
1336#### Source
1338```hoon
1339++ hex (ape (bass 0x1.0000 ;~(plug qex:ab (star ;~(pfix dog qix:ab)))))
1340```
1342#### Examples
1344```
1345> `@ux`(scan "4" hex:ag)
13460x4
1348> `@ux`(scan "1a" hex:ag)
13490x1a
1351> `@ux`(scan "3.ac8d" hex:ag)
13520x3.ac8d
1353```
1355---
1357### `++lip:ag`
1359Parse IPv4 address
1361Parsing `rule`. Parses an IPv4 address.
1363#### Source
1365```hoon
1366++ lip =+ tod=(ape ted:ab)
1367 (bass 256 ;~(plug tod (stun [3 3] ;~(pfix dog tod))))
1368```
1370#### Examples
1372```
1373> `@if`(scan "127.0.0.1" lip:ag)
1374.127.0.0.1
1375```
1377---
1379### `++mot:ag`
1381Parse numerical month
1383Parse a numerical month (1-12).
1385#### Source
1387```hoon
1388++ mot ;~ pose
1389 ;~ pfix
1390 (just '1')
1391 (cook |=(a=@ (add 10 (sub a '0'))) (shim '0' '2'))
1392 ==
1393 sed:ab
1394 ==
1395```
1397#### Examples
1399```
1400> (scan "0" mot:ag)
1401{1 1}
1402syntax error
1404> (scan "1" mot:ag)
1407> (scan "6" mot:ag)
1410> (scan "12" mot:ag)
1413> (scan "13" mot:ag)
1414{1 2}
1415syntax error
1416```
1418---
1420### `++viz:ag`
1422Parse Base-32 with dots
1424Parsing `rule`. Parses a Base-32 number with dot separators.
1426#### Source
1428```hoon
1429++ viz (ape (bass 0x200.0000 ;~(plug pev:ab (star ;~(pfix dog piv:ab)))))
1430```
1432#### Examples
1434```
1435> `@uv`(scan "e2.ol4pm" viz:ag)
14360ve2.ol4pm
1437```
1439---
1441### `++vum:ag`
1443Parse base-32 string
1445Parsing `rule`. Parses a raw base-32 string (without dots).
1447#### Source
1449```hoon
1450++ vum (bass 32 (plus siv:ab))
1451```
1453#### Examples
1455```
1456> `@uv`(scan "e2ol4pm" vum:ag)
14570ve2.ol4pm
1458```
1460---
1462### `++wiz:ag`
1464Parse base-64
1466Parsing `rule`. Parses a base-64 number.
1468#### Source
1470```hoon
1471++ wiz (ape (bass 0x4000.0000 ;~(plug pew:ab (star ;~(pfix dog piw:ab)))))
1472```
1474#### Examples
1476```
1477> `@uw`(scan "e2O.l4Xpm" wiz:ag)
14780we2O.l4Xpm
1479```
1481---
1483## `++mu`
1485Core used to scramble 16-bit atoms
1487A door that contains arms that are used to scramble two atoms, `top`
1488and `bot`. Used especially in the phonetic base to disguise the
1489relationship between a planet and its star.
1491#### Accepts
1493`top` is an atom.
1495`bot` is an atom.
1497#### Source
1499```hoon
1500++ mu
1501 |_ [top=@ bot=@]
1502```
1504---
1506### `++zag:mu`
1508Add bottom into top
1510Produces the cell of `top` and `bot` with `top` scrambled to the result
1511of adding `bot` to `top` modulo 16. Used to scramble the name of a
1512planet.
1514#### Accepts
1516`top` & `bot` are atoms, and are the sample of `+mu`.
1518#### Produces
1520A `(pair @ @)`.
1522#### Source
1524```hoon
1525++ zag [p=(end 4 (add top bot)) q=bot]
1526```
1528#### Examples
1530```
1531> `[@ux @ux]`~(zag mu 0x20e0 0x201)
1532[0x22e1 0x201]
1533```
1535---
1537### `++zig:mu`
1539Subtract bottom from top
1541The inverse of [`++zag`](#zagmu). Produces the cell of `top` and `bot` with
1542`top` unscrambled. The unscrambled `top` is the sum of the sample `top` and the
154316-bit complement of `bot`. Used to unscramble the name of the planet.
1545#### Accepts
1547`top` & `bot` are atoms, and are the sample of `+mu`.
1549#### Produces
1551A `(pair @ @)`.
1553#### Source
1555```hoon
1556++ zig [p=(end 4 (add top (sub 0x1.0000 bot))) q=bot]
1557```
1559#### Examples
1561```
1562> `[@ux @ux]`~(zig mu 0x22e1 0x201)
1563[0x20e0 0x201]
1564```
1566---
1568### `++zug:mu`
1570Concatenate into atom
1572Produces the concatenation of `top` and `bot`. Used to assemble a
1573planet name.
1575#### Accepts
1577`top` & `bot` are atoms, and are the sample of `+mu`.
1579#### Produces
1581An atom.
1583#### Source
1585```hoon
1586++ zug (mix (lsh 4 top) bot)
1587```
1589#### Examples
1591```
1592> `@ux`~(zug mu 0x22e1 0x201)
15930x22e1.0201
1594```
1596---
1598## `++ne`
1600Digit rendering engine
1602A door containing arms that render digits at bases 10, 16, 32, and 64.
1604#### Accepts
1606`tig` is an `atom`.
1608#### Source
1610```hoon
1611++ ne
1612 |_ tig=@
1613```
1615---
1617### `++c:ne`
1619Render base58check
1621Render a single base58check character.
1623#### Accepts
1625`tig` is an `atom`, and is the sample of `+ne`.
1627#### Produces
1629An atom.
1631#### Source
1633```hoon
1634++ c (cut 3 [tig 1] key:fa)
1635```
1637#### Examples
1639```
1640> `@t`~(c ne 7)
1641'8'
1643> `@t`~(c ne 27)
1644'U'
1646> `@t`~(c ne 57)
1647'z'
1649> `@t`~(c ne 58)
1651```
1653---
1655### `++d:ne`
1657Render decimal
1659Renders a decimal digit as an atom of an ACII byte value.
1661#### Accepts
1663`tig` is an `atom`, and is the sample of `+ne`.
1665#### Produces
1667An atom.
1669#### Source
1671```hoon
1672++ d (add tig '0')
1673```
1675#### Examples
1677```
1678> `@t`~(d ne 7)
1679'7'
1680```
1682---
1684### `++x:ne`
1686Render hex
1688Renders a hexadecimal digit as an atom of an ASCII byte value.
1690#### Accepts
1692`tig` is an `atom`, and is the sample of `+ne`.
1694#### Produces
1696An atom.
1698#### Source
1700```hoon
1701++ x ?:((gte tig 10) (add tig 87) d)
1702```
1704#### Examples
1706```
1707> `@t`~(x ne 7)
1708'7'
1710> `@t`~(x ne 14)
1711'e'
1712```
1714---
1716### `++v:ne`
1718Render base-32
1720Renders a base-32 digit as an atom of an ASCII byte value.
1722#### Accepts
1724`tig` is an `atom`, and is the sample of `+ne`.
1726#### Produces
1728An atom.
1730#### Source
1732```hoon
1733++ v ?:((gte tig 10) (add tig 87) d)
1734```
1736#### Examples
1738```
1739> `@t`~(v ne 7)
1740'7'
1742> `@t`~(v ne 14)
1743'e'
1745> `@t`~(v ne 25)
1746'p'
1747```
1749---
1751### `++w:ne`
1753Render base-64
1755Renders a base-64 digit as an atom of an ASCII byte value.
1757#### Accepts
1759`tig` is an `atom`, and is the sample of `+ne`.
1761#### Produces
1763An atom.
1765#### Source
1767```hoon
1768++ w ?:(=(tig 63) '~' ?:(=(tig 62) '-' ?:((gte tig 36) (add tig 29) x)))
1769```
1771#### Examples
1773```
1774> `@t`~(w ne 7)
1775'7'
1777> `@t`~(w ne 14)
1778'e'
1780> `@t`~(w ne 25)
1781'p'
1783> `@t`~(w ne 52)
1784'Q'
1786> `@t`~(w ne 61)
1787'Z'
1789> `@t`~(w ne 63)
1790'~'
1792> `@t`~(w ne 62)
1793'-'
1794```
1796---