@@ -6,174 +6,492 @@ template = "doc.html"
11+Container core for basic atom printing functions.
13+**Note that these are largely deprecated, using outdated syntax, character
14+mappings and encodings, and should generally not be used.**
16### `++r:at`
29### `++r:at`
31+Print term, number or hex
33+If `a` is composed of the letters `a` through `z` and `-`, print as `@tas`
34+syntax. If `a` is an atom of two bytes or less, print as an integer with
35+comma-separated thousands. Otherwise, print `a` as `@ux` syntax.
39+`a` is a `@`, and is the sample of `++at`.
20− ?: ?& (gte (met 3 a) 2)
49+ ?: ?& (gte (met 3 a) 2)
22− ?: =(0 a)
51+ ?: =(0 a)
24− =+ vis=(end 3 1 a)
53+ =+ vis=(end 3 a)
25− ?& ?|(=('-' vis) ?&((gte vis 'a') (lte vis 'z')))
54+ ?& ?|(=('-' vis) ?&((gte vis 'a') (lte vis 'z')))
26− $(a (rsh 3 1 a))
55+ $(a (rsh 3 a))
30− ?: (lte (met 3 a) 2)
59+ ?: (lte (met 3 a) 2)
35−XX document
64+#### Examples
37### `++rf:at`
83### `++rf:at`
87+If `a` is a loobean, print as `|`/`&`, otherwise crash.
91+`a` is a `@`, and is the sample of `++at`.
40− ++ rf `tape`[?-(a $& '&', $| '|', * !!) ~]
100+++ rf `tape`[?-(a %& '&', %| '|', * !!) ~]
117+dojo: hoon expression failed
45### `++rn:at`
122### `++rn:at`
126+If `a` is null, print `~`, otherwise crash.
130+`a` is a `@`, and is the sample of `++at`.
48− ++ rn `tape`[?>(=(0 a) '~') ~]
139+++ rn `tape`[?>(=(0 a) '~') ~]
151+dojo: hoon expression failed
53### `++rt:at`
154### `++rt:at`
156+Print cord, including escape characters
158+Print `a` with `cord` syntax, including escape characters.
162+`a` is a `@`, and the sample of `++at`.
56− ++ rt `tape`['\'' (weld (mesc (trip a)) `tape`['\'' ~])]
171+++ rt `tape`['\'' (weld (mesc (trip a)) `tape`['\'' ~])]
61### `++rta:at`
193### `++rta:at`
64− ++ rta rt
200+++ rta rt
69### `++rtam:at`
205### `++rtam:at`
207+Print cord with `@tas` syntax
209+Treat `a` as `cord`, print it with `%` prefix.
213+`a` is a `@`, and is the sample of `++at`.
72− ++ rtam `tape`['%' (trip a)]
222+++ rtam `tape`['%' (trip a)]
75−XX document
225+#### Examples
77### `++rub:at`
244### `++rub:at`
248+Print `a` as `@ub` syntax, except with `-` separators rather than `.` separators.
252+`a` is a `@`, and is the sample of `++at`.
80− ++ rub `tape`['0' 'b' (rum 2 ~ |=(b/@ (add '0' b)))]
261+++ rub `tape`['0' 'b' (rum 2 ~ |=(b=@ (add '0' b)))]
268+"0b1011-1110-1110-1111"
85### `++rud:at`
273### `++rud:at`
275+Print atom as integer
277+Print atom `a` as an integer, with commas separating thousands.
88− ++ rud (rum 10 ~ |=(b/@ (add '0' b)))
290+++ rud (rum 10 ~ |=(b=@ (add '0' b)))
91−XX document
293+#### Examples
93### `++rum:at`
302### `++rum:at`
306+Print `a` as base `b` with suffix `c` and using gate `d` to convert blocks to
307+characters. Each set of four characters will be separated by `-`, except for
308+base 10 which will be printed with commas separating thousands.
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 `@`.
97− |= {b/@ c/tape d/$-(@ @)}
325+ |= [b=@ c=tape d=$-(@ @)]
99− ?: =(0 a)
327+ ?: =(0 a)
100− [(d 0) c]
328+ [(d 0) c]
102− |- ^- tape
330+ |- ^- tape
103− ?: =(0 a)
331+ ?: =(0 a)
105− =+ f=&(!=(0 e) =(0 (mod e ?:(=(10 b) 3 4))))
333+ =+ f=&(!=(0 e) =(0 (mod e ?:(=(10 b) 3 4))))
107− a (div a b)
335+ a (div a b)
108− c [(d (mod a b)) ?:(f [?:(=(10 b) ',' '-') c] c)]
336+ c [(d (mod a b)) ?:(f [?:(=(10 b) ',' '-') c] c)]
344+> (~(rum at 0xdead.beef) 10 ~ |=(b=@ (add '0' b)))
349+> (~(rum at 0xdead.beef) 10 " m/s" |=(b=@ (add '0' b)))
354+> (~(rum at 0xdead.beef) 2 ~ |=(b=@ (add '0' b)))
355+"1101-1110-1010-1101-1011-1110-1110-1111"
116### `++rup:at`
360### `++rup:at`
362+Print `@p` (outdated)
364+Print `a` as an `@p`, but with outdated syntax and number<->syllable mapping. This
365+function almost certainly should not be used.
120− =+ b=(met 3 a)
379+ =+ b=(met 3 a)
123− |- ^- tape
382+ |- ^- tape
124− ?: (gth (met 5 a) 1)
383+ ?: (gth (met 5 a) 1)
126− $(a (rsh 5 1 a), b (sub b 4))
385+ $(a (rsh 5 a), b (sub b 4))
127− `tape`['-' '-' $(a (end 5 1 a), b 4)]
386+ `tape`['-' '-' $(a (end 5 a), b 4)]
128− ?: =(0 b)
387+ ?: =(0 b)
130− ?: (lte b 1)
389+ ?: (lte b 1)
131− (trip (tos:po a))
390+ (trip (tos:po a))
132− |- ^- tape
391+ |- ^- tape
133− ?: =(2 b)
392+ ?: =(2 b)
134− =+ c=(rsh 3 1 a)
393+ =+ c=(rsh 3 a)
135− =+ d=(end 3 1 a)
394+ =+ d=(end 3 a)
136− (weld (trip (tod:po c)) (trip (tos:po (mix c d))))
395+ (weld (trip (tod:po c)) (trip (tos:po (mix c d))))
137− =+ c=(rsh 3 2 a)
396+ =+ c=(rsh [3 2] a)
138− =+ d=(end 3 2 a)
397+ =+ d=(end [3 2] a)
139− (weld ^$(a c, b (met 3 c)) `tape`['-' $(a (mix c d), b 2)])
398+ (weld ^$(a c, b (met 3 c)) `tape`['-' $(a (mix c d), b 2)])
404+> ~(rup at 0xdead.beef)
409+> ~(rup at ~sampel-palnet)
145### `++ruv:at`
420### `++ruv:at`
424+Print `a` as **outdated** base-64 syntax, with `0v` rather than `0w` prefix,
425+different character mappings and separators.
429+`a` is a `@`, and is the sample of `++at`.
156− ?: =(63 b)
446+ ?: =(63 b)
158− ?: =(62 b)
448+ ?: =(62 b)
160− ?:((lth b 26) (add 65 b) ?:((lth b 52) (add 71 b) (sub b 4)))
450+ ?:((lth b 26) (add 65 b) ?:((lth b 52) (add 71 b) (sub b 4)))
456+> ~(ruv at 0xdead.beef)
164−XX document
460+Note this is how it should be rendered:
166### `++rux:at`
469### `++rux:at`
473+Print `a` as `@ux` except with `-` separators rather than `.`s.
477+`a` is a `@`, and is the sample of `++at`.
169− ++ rux `tape`['0' 'x' (rum 16 ~ |=(b/@ (add b ?:((lth b 10) 48 87))))]
486+++ rux `tape`['0' 'x' (rum 16 ~ |=(b=@ (add b ?:((lth b 10) 48 87))))]
171− :::::::::::::::::::::::::::::::::::::::::::::::::::::: ::
174−XX document
489+#### Examples
492+> ~(rux at 0xdead.beef)
@@ -181,37 +499,37 @@ XX document
182To lowercase
500To lowercase
184−Turn all occurences of uppercase letters in any `++tape` into lowercase
502+Turn all occurences of uppercase letters in any `tape` into lowercase
185−letters. Returns a `++tape`.
503+letters. Returns a `tape`.
187#### Accepts
505#### Accepts
189−`vib` is a `++tape`.
507+`vib` is a `tape`.
191#### Produces
509#### Produces
193−A `++tape`.
511+A `tape`.
195#### Source
513#### Source
198− ++ cass :: lowercase
516+++ cass
199− |= vib/tape
517+ |= vib=tape
201− (turn vib |=(a/@ ?.(&((gte a 'A') (lte a 'Z')) a (add 32 a))))
519+ (turn vib |=(a=@ ?.(&((gte a 'A') (lte a 'Z')) a (add 32 a))))
204#### Examples
522#### Examples
207− > (cass "JOHN DOE")
525+> (cass "JOHN DOE")
208− "john doe"
526+"john doe"
210− > (cass "abc ABC 123 !@#")
528+> (cass "abc ABC 123 !@#")
211− "abc abc 123 !@#"
529+"abc abc 123 !@#"
213− > (cass "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsQqRrVvWwXxYyZz")
531+> (cass "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsQqRrVvWwXxYyZz")
214− "aabbccddeeffgghhiijjkkllmmnnooppqqrrssqqrrvvwwxxyyzz"
532+"aabbccddeeffgghhiijjkkllmmnnooppqqrrssqqrrvvwwxxyyzz"
@@ -220,33 +538,33 @@ A `++tape`.
221Tape to cord
539Tape to cord
223−Produce a `++cord` from a `++tape`.
541+Produce a `cord` from a `tape`.
225#### Accepts
543#### Accepts
227−`a` is a `++tape`.
545+`a` is a `tape`.
229#### Produces
547#### Produces
231−A `++cord`.
549+A `cord`.
233#### Source
551#### Source
236− ++ crip |=(a=tape `@t`(rap 3 a)) :: tape to cord
554+++ crip |=(a=tape `@t`(rap 3 a))
239#### Examples
557#### Examples
242− > (crip "john doe")
560+> (crip "john doe")
243− 'john doe'
561+'john doe'
245− > (crip "abc 123 !@#")
563+> (crip "abc 123 !@#")
246− 'abc 123 !@#'
564+'abc 123 !@#'
248− > `@ud`(crip "abc")
566+> `@ud`(crip "abc")
249− 6.513.249
567+6.513.249
@@ -255,37 +573,37 @@ A `++cord`.
256To uppercase
574To uppercase
258−Turn all occurences of lowercase letters in any `++tape` into uppercase
576+Turn all occurences of lowercase letters in any `tape` into uppercase
259−letters. Returns a `++tape`.
577+letters. Returns a `tape`.
261#### Accepts
579#### Accepts
263−`vib` is a `++tape`.
581+`vib` is a `tape`.
265#### Produces
583#### Produces
267−A `++tape`.
585+A `tape`.
269#### Source
587#### Source
272− ++ cuss :: uppercase
590+++ cuss
273− |= vib/tape
591+ |= vib=tape
275− (turn vib |=(a/@ ?.(&((gte a 'a') (lte a 'z')) a (sub a 32))))
593+ (turn vib |=(a=@ ?.(&((gte a 'a') (lte a 'z')) a (sub a 32))))
278#### Examples
596#### Examples
281− > (cuss "john doe")
599+> (cuss "john doe")
282− "JOHN DOE"
600+"JOHN DOE"
284− > (cuss "abc ABC 123 !@#")
602+> (cuss "abc ABC 123 !@#")
285− "ABC ABC 123 !@#"
603+"ABC ABC 123 !@#"
287− > (cuss "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsQqRrVvWwXxYyZz")
605+> (cuss "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsQqRrVvWwXxYyZz")
288− "AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSQQRRVVWWXXYYZZ"
606+"AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSQQRRVVWWXXYYZZ"
@@ -294,40 +612,40 @@ A `++tape`.
295Escape special chars
613Escape special chars
297−Escape special characters, used in `++show`.
615+Escape special characters.
299#### Accepts
617#### Accepts
301−`vib` is a `++tape`.
619+`vib` is a `tape`.
303#### Produces
621#### Produces
305−A `++tape`.
623+A `tape`.
307#### Source
625#### Source
310− ++ mesc :: ctrl code escape
628+++ mesc
311− |= vib/tape
629+ |= vib=tape
315− ?: =('\\' i.vib)
633+ ?: =('\\' i.vib)
316− ['\\' '\\' $(vib t.vib)]
634+ ['\\' '\\' $(vib t.vib)]
317− ?: ?|((gth i.vib 126) (lth i.vib 32) =(`@`39 i.vib))
635+ ?: ?|((gth i.vib 126) (lth i.vib 32) =(`@`39 i.vib))
318− ['\\' (welp ~(rux at i.vib) '/' $(vib t.vib))]
636+ ['\\' (welp ~(rux at i.vib) '/' $(vib t.vib))]
319− [i.vib $(vib t.vib)]
637+ [i.vib $(vib t.vib)]
322#### Examples
640#### Examples
325− > (mesc "ham lus")
643+> (mesc "ham lus")
326− "ham lus"
644+"ham lus"
327− > (mesc "bas\\hur")
645+> (mesc "bas\\hur")
328− "bas\\\\hur"
646+"bas\\\\hur"
329− > (mesc "as'saß")
647+> (mesc "as'saß")
330− "as\0x27/sa\0xc3/\0x9f/"
648+"as\0x27/sa\0xc3/\0x9f/"
@@ -336,37 +654,37 @@ A `++tape`.
337Prepend `n` times
655Prepend `n` times
339−Add `a` repetitions of character `b` to the head of `++tape` `c`.
657+Add `a` repetitions of character `b` to the head of `tape` `c`.
341#### Accepts
659#### Accepts
343−`a` and `b` are atoms.
661+`[a b]` are atoms.
345−`c` is a `++tape`.
663+`c` is a `tape`.
347#### Produces
665#### Produces
349−A `++tape`.
667+A `tape`.
351#### Source
669#### Source
354− ++ runt :: prepend repeatedly
672+++ runt
355− |= [[a/@ b/@] c/tape]
673+ |= [[a=@ b=@] c=tape]
357− ?: =(0 a)
675+ ?: =(0 a)
359− [b $(a (dec a))]
677+ [b $(a (dec a))]
363#### Examples
680#### Examples
366− > (runt [2 '/'] "ham")
683+> (runt [2 '/'] "ham")
368− > (runt [10 'a'] "")
686+> (runt [10 'a'] "")
369− "aaaaaaaaaa"
687+"aaaaaaaaaa"
@@ -375,11 +693,12 @@ A `++tape`.
376Soft-cast by aura
694Soft-cast by aura
378−Soft-cast validity by aura.
696+Check characters in `b` are valid for aura `a`. Produce a `unit` of `a` if valid
697+and a null `unit` if not. Takes `a` and produces a gate that takes `b`.
380#### Accepts
699#### Accepts
382−`a` is a `++span` (`@ta`).
701+`a` is a `@ta`, and specifies the aura like `%tas` or `%ta`.
384`b` is an atom.
703`b` is an atom.
@@ -390,20 +709,21 @@ A `(unit @)`.
390#### Source
709#### Source
393− ++ sand :: atom sanity
712+++ sand
394− |= a/@ta
713+ |= a=@ta
396− ?.(((sane a) b) ~ [~ b])
714+ (flit (sane a))
400#### Examples
717#### Examples
403− > `(unit @ta)`((sand %ta) 'sym-som')
720+> `(unit @ta)`((sand %ta) 'sym-som')
404− [~ ~.sym-som]
721+[~ ~.sym-som]
405− > `(unit @ta)`((sand %ta) 'err!')
725+> `(unit @ta)`((sand %ta) 'err!')
@@ -412,76 +732,79 @@ A `(unit @)`.
413Check aura validity
733Check aura validity
415−Check validity by aura. Produces a gate.
735+Check validity of `a` by aura `b`. Takes `b` and produces a gate that takes `a`.
417#### Accepts
737#### Accepts
419−`a` is a `++span` (`@ta`).
739+`a` is a `@ta`, and specifies the aura like `%tas` or `%ta`.
421`b` is an atom.
741`b` is an atom.
423#### Produces
743#### Produces
427#### Source
747#### Source
430− ++ sane :: atom sanity
750+++ sane
431− |= a/@ta
751+ |= a=@ta
432− |= b/@ ^- ?
752+ |= b=@ ^- ?
433− ?. =(%t (end 3 1 a))
753+ ?. =(%t (end 3 a))
434− ~|(%sane-stub !!)
754+ :: XX more and better sanity
435− =+ [inx=0 len=(met 3 b)]
757+ =+ [inx=0 len=(met 3 b)]
436− ?: =(%tas a)
758+ ?: =(%tas a)
438− ?: =(inx len) &
760+ ?: =(inx len) &
439− =+ cur=(cut 3 [inx 1] b)
761+ =+ cur=(cut 3 [inx 1] b)
440− ?& ?| &((gte cur 'a') (lte cur 'z'))
762+ ?& ?| &((gte cur 'a') (lte cur 'z'))
441− &(=('-' cur) !=(0 inx) !=(len inx))
763+ &(=('-' cur) !=(0 inx) !=(len inx))
442− &(&((gte cur '0') (lte cur '9')) !=(0 inx))
764+ &(&((gte cur '0') (lte cur '9')) !=(0 inx))
446− ?: =(%ta a)
768+ ?: =(%ta a)
448− ?: =(inx len) &
770+ ?: =(inx len) &
449− =+ cur=(cut 3 [inx 1] b)
771+ =+ cur=(cut 3 [inx 1] b)
450− ?& ?| &((gte cur 'a') (lte cur 'z'))
772+ ?& ?| &((gte cur 'a') (lte cur 'z'))
451− &((gte cur '0') (lte cur '9'))
773+ &((gte cur '0') (lte cur '9'))
452− |(=('-' cur) =('~' cur) =('_' cur) =('.' cur))
774+ |(=('-' cur) =('~' cur) =('_' cur) =('.' cur))
457− ?: =(0 b) &
779+ ?: =(0 b) &
458− =+ cur=(end 3 1 b)
780+ =+ cur=(end 3 b)
459− ?: &((lth cur 32) !=(10 cur)) |
781+ ?: &((lth cur 32) !=(10 cur)) |
460− =+ len=(teff cur)
782+ =+ len=(teff cur)
461− ?& |(=(1 len) =+(i=1 |-(|(=(i len) &((gte (cut 3 [i 1] b) 128) $(i +(i)))))))
783+ ?& |(=(1 len) =+(i=1 |-(|(=(i len) &((gte (cut 3 [i 1] b) 128) $(i +(i)))))))
462− $(b (rsh 3 len b))
784+ $(b (rsh [3 len] b))
467#### Examples
788#### Examples
470− > ((sane %tas) %mol)
791+> ((sane %tas) %mol)
472− > ((sane %tas) 'lam')
794+> ((sane %tas) 'lam')
474− > ((sane %tas) 'more ace')
797+> ((sane %tas) 'more ace')
480−## `++teff`
803+## `++taft`
482−UTF8 Length
805+UTF8 to UTF32
484−Produces the number of utf8 bytes.
807+Convert `cord` `a` to a UTF32 `@c`.
486#### Accepts
809#### Accepts
@@ -489,352 +812,354 @@ Produces the number of utf8 bytes.
490#### Produces
813#### Produces
494#### Source
817#### Source
497− |= a/@t ^- @
821+ |= a=@t
834+ %3 [[16 6] [8 6] [0 4] ~]
835+ %4 [[24 6] [16 6] [8 6] [0 3] ~]
837+ |=([p=@ q=@] [q (cut 0 [p q] a)])
498− =+ b=(end 3 1 a)
838+ ?> =((tuft c) (end [3 b] a))
499− ~| %bad-utf8
839+ [c $(a (rsh [3 b] a))]
502− ?> |((gte b 32) =(10 b))
503− ?:((lte b 127) 1 ?:((lte b 223) 2 ?:((lte b 239) 3 4)))
506#### Examples
842#### Examples
509− > (teff 'a')
845+> (taft 'foobar')
512− 2
848+> `@ux`'foobar'
852+0x72.0000.0061.0000.0062.0000.006f.0000.006f.0000.0066
517−## `++trim`
857+## `++teff`
519−Tape split
859+UTF8 Length
521−Split first `a` characters off `++tape` `b`.
861+Produces the number of utf8 bytes of `a`, a single `@t` character. If `a`
862+contains more than one character, it will produce the byte-length of the first
523#### Accepts
865#### Accepts
525−`a` is an atom.
867+`a` is a `@t`.
529#### Produces
869#### Produces
531−A cell of `++tape`s, `p` and `q`.
871+An atom.
533#### Source
873#### Source
536− ++ trim :: 31-bit nonzero
876+++ teff
539− |- ^- @
877+ |= a=@t ^- @
540− =+ haz=(spec syd key)
878+ =+ b=(end 3 a)
541− =+ ham=(mix (rsh 0 31 haz) (end 0 31 haz))
879+ ?: =(0 b)
542− ?.(=(0 ham) ham $(syd +(syd)))
880+ ?>(=(`@`0 a) 0)
543− --
881+ ?> |((gte b 32) =(10 b))
544− ::
882+ ?:((lte b 127) 1 ?:((lte b 223) 2 ?:((lte b 239) 3 4)))
547#### Examples
885#### Examples
550− > (trim 5 "lasok termun")
888+> (teff 'a')
551− [p="lasok" q=" termun"]
889+1
552− > (trim 5 "zam")
890+
553− [p="zam" q=""]
891+> (teff 'ß')
558−## `++trip`
900+## `++trim`
560−Cord to tape
902+Tape split
562−Produce a `++tape` from `++cord`.
904+Split first `a` characters off `tape` `b`.
564#### Accepts
906#### Accepts
566`a` is an atom.
908`a` is an atom.
568#### Produces
912#### Produces
570−A `++tape`.
914+A cell of `tape`s, `p` and `q`.
572#### Source
916#### Source
575− ++ trip :: cord to tape
919+++ trim
576− ~/ %trip
920+ |= [a=@ b=tape]
577− |= a/@ ^- tape
921+ ^- [p=tape q=tape]
578− ?: =(0 (met 3 a))
924+ ?: =(0 a)
580− [^-(@ta (end 3 1 a)) $(a (rsh 3 1 a))]
926+ =+ c=$(a (dec a), b t.b)
581− ::
927+ [[i.b p.c] q.c]
584#### Examples
930#### Examples
587− > (trip 'john doe')
933+> (trim 5 "lasok termun")
588− "john doe"
934+[p="lasok" q=" termun"]
589− > (trip 'abc 123 !@#')
935+
590− "abc 123 !@#"
936+> (trim 5 "zam")
591− > (trip 'abc')
937+[p="zam" q=""]
597−## `++tuba`
942+## `++trip`
599−UTF8 to UTF32 tape
944+Cord to tape
601−Convert `++tape` to a `++list` of codepoints (`@c`).
946+Produce a `tape` from `cord` `a`.
603#### Accepts
948#### Accepts
605−`a` is a `++tape`.
950+`a` is an atom.
607#### Produces
952#### Produces
609−A `++list` of codepoints `@c`.
954+A `tape`.
611#### Source
956#### Source
614− ++ tuba :: utf8 to utf32 tape
959+++ trip
615− |= a/tape
961+ |= a=@ ^- tape
616− ^- (list @c)
962+ ?: =(0 (met 3 a))
617− (rip 5 (turf (rap 3 a))) :: XX horrible
963+ ~
618− ::
964+ [^-(@ta (end 3 a)) $(a (rsh 3 a))]
621#### Examples
967#### Examples
624− > (tuba "я тут")
970+> (trip 'john doe')
625− ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.]
971+"john doe"
626− > (tuba "chars")
972+
627− ~[~-c ~-h ~-a ~-r ~-s]
973+> (trip 'abc 123 !@#')
632−## `++tufa`
982+## `++tuba`
634−UTF32 to UTF8 tape
984+UTF8 tape to UTF32 tape
636−Wrap a `++list` of utf32 codepoints into a utf8 `++tape`.
986+Convert `tape` to a `list` of codepoints (`@c`).
638#### Accepts
988#### Accepts
640−`a` is a `++list` of `@c`.
990+`a` is a `tape`.
642#### Produces
992#### Produces
644−A `++tape`.
994+A `(list @c)`.
646#### Source
996#### Source
649− ++ tufa :: utf32 to utf8 tape
999+++ tuba
650− |= a=(list @c)
1001+ ^- (list @c)
651− ^- tape
1002+ (rip 5 (taft (rap 3 a)))
653− (weld (rip 3 (tuft i.a)) $(a t.a))
657#### Examples
1005#### Examples
660− > (tufa ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.])
661− "я тут"
1008+> (tuba "я тут")
662− > (tufa ((list @c) ~[%a %b 0xb1 %c]))
1009+~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.]
1012+~[~-c ~-h ~-a ~-r ~-s]
668−## `++tuft`
1017+## `++tufa`
670−UTF32 to UTF8 text
1019+UTF32 to UTF8 tape
672−Convert utf32 glyph to
1021+Wrap a `list` of utf32 codepoints into a utf8 `tape`.
675#### Accepts
1023#### Accepts
677−`a` is a codepoint (`@c`).
1025+`a` is a `(list @c)`.
679#### Produces
1027#### Produces
681−A `++cord`.
1029+A `tape`.
683#### Source
1031#### Source
686− ++ tuft :: utf32 to utf8 text
1034+++ tufa
690− |- ^- (list @)
1035+ |= a=(list @c)
691− ?: =(`@`0 a)
1037+ ?~ a ""
692− ~
1038+ (weld (rip 3 (tuft i.a)) $(a t.a))
694− =+ c=$(a (rsh 5 1 a))
698− :* (mix 0b1100.0000 (cut 0 [6 5] b))
699− (mix 0b1000.0000 (end 0 6 b))
703− :* (mix 0b1110.0000 (cut 0 [12 4] b))
704− (mix 0b1000.0000 (cut 0 [6 6] b))
705− (mix 0b1000.0000 (end 0 6 b))
708− :* (mix 0b1111.0000 (cut 0 [18 3] b))
709− (mix 0b1000.0000 (cut 0 [12 6] b))
710− (mix 0b1000.0000 (cut 0 [6 6] b))
711− (mix 0b1000.0000 (end 0 6 b))
716#### Examples
1041#### Examples
719− > (tuft `@c`%a)
1044+> (tufa ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.])
721− > (tuft `@c`0xb6)
1046+
722− '¶'
1047+> (tufa ((list @c) ~[%a %b 0xb1 %c]))
727−## `++turf`
1053+## `++tuft`
729−UTF8 to UTF32 cord
1055+UTF32 to UTF8
731−Convert utf8 (`++cord`) to utf32 codepoints.
1057+Convert `@c` to `cord`.
733#### Accepts
1059#### Accepts
735−`a` is a `@t`.
1061+`a` is a `@c`.
737#### Produces
1063#### Produces
739−A `@c`, UTF-32 codepoint.
1065+A `cord`.
741#### Source
1067#### Source
744− ++ turf :: utf8 to utf32
1070+++ tuft
747− %+ rap 5
1073+ %+ rap 3
748− |- ^- (list @c)
1074+ |- ^- (list @)
749− =+ b=(teff a)
1075+ ?: =(`@`0 a)
751− =+ ^= c
1077+ =+ b=(end 5 a)
758− $3 [[16 6] [8 6] [0 4] ~]
759− $4 [[24 6] [16 6] [8 6] [0 3] ~]
761− |=({p/@ q/@} [q (cut 0 [p q] a)])
762− ?. =((tuft c) (end 3 b a)) ~|(%bad-utf8 !!)
763− [c $(a (rsh 3 b a))]
1078+ =+ c=$(a (rsh 5 a))
764− ::
1079+ ?: (lte b 0x7f)
1082+ :* (mix 0b1100.0000 (cut 0 [6 5] b))
1083+ (mix 0b1000.0000 (end [0 6] b))
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))
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))
767#### Examples
1100#### Examples
770− > (turf 'my ßam')
1103+> (tuft ~-foobar)
771− ~-my.~df.am
1104+'foobar'
773− 'я тут'
1106+> `@ux`~-foobar
774− > (turf 'я тут')
1107+0x72.0000.0061.0000.0062.0000.006f.0000.006f.0000.0066
775− ~-~44f..~442.~443.~442.
1108+
776− > `@ux`'я тут'
1109+> `@ux`'foobar'
777− 0x82.d183.d182.d120.8fd1
1110+0x7261.626f.6f66
778− > `@ux`(turf 'я тут')
779− 0x442.0000.0443.0000.0442.0000.0020.0000.044f
784## `++wack`
1115## `++wack`
786−Coin format encode
1117+Knot escape
788−Escape `++span` `~` as `~~` and `_` as `~-`. Used for printing.
1119+Escape `knot` `~` as `~~` and `_` as `~-`. Used for printing.
790#### Accepts
1121#### Accepts
792−`a` is a `++span` (`@ta`).
1123+`a` is a `knot`.
794#### Produces
1125#### Produces
796−A `++span` (`@ta`).
1127+A `knot`.
798#### Source
1129#### Source
801− ++ wack :: coin format
1132+++ wack
802− |= a/@ta
1133+ |= a=@ta
804− =+ b=(rip 3 a)
1135+ =+ b=(rip 3 a)
805− %+ rap 3
1136+ %+ rap 3
806− |- ^- tape
1137+ |- ^- tape
809− ?: =('~' i.b) ['~' '~' $(b t.b)]
1140+ ?: =('~' i.b) ['~' '~' $(b t.b)]
810− ?: =('_' i.b) ['~' '-' $(b t.b)]
1141+ ?: =('_' i.b) ['~' '-' $(b t.b)]
811− [i.b $(b t.b)]
1142+ [i.b $(b t.b)]
815#### Examples
1145#### Examples
818− > (wack '~20_sam~')
1148+> (wack '~20_sam~')
819− ~.~~20~-sam~~
1149+~.~~20~-sam~~
821− > `@t`(wack '~20_sam~')
824− > ~(rend co %many ~[`ud/5 `ta/'~20_sam'])
1151+> `@t`(wack '~20_sam~')
825− "._5_~~.~~20~-sam__"
1152+'~~20~-sam~~'
827− > ._5_~~.~~20~-sam__
833## `++wick`
1157## `++wick`
835−Coin format decode
1159+Knot unescape
837−Unescape `++span` `~~` as `~` and `~-` as `_`.
1161+Unescape `knot` `~~` as `~` and `~-` as `_`. Produces a `unit`, which is null if
1162+the `knot` contains unescaped `~` characters.
839#### Accepts
1164#### Accepts
@@ -842,38 +1167,37 @@ Unescape `++span` `~~` as `~` and `~-` as `_`.
843#### Produces
1168#### Produces
845−A `++span` `@ta`.
1170+A `(unit @ta)`.
847#### Source
1172#### Source
850− ++ wick :: knot format
1175+++ wick
852− ^- (unit @ta)
1177+ ^- (unit @ta)
853− =+ b=(rip 3 a)
1178+ =+ b=(rip 3 a)
854− =- ?^(b ~ (some (rap 3 (flop c))))
1179+ =- ?^(b ~ (some (rap 3 (flop c))))
855− =| c/tape
1180+ =| c=tape
856− |- ^- {b/tape c/tape}
1181+ |- ^- [b=tape c=tape]
857− ?~ b [~ c]
1182+ ?~ b [~ c]
858− ?. =('~' i.b)
1183+ ?. =('~' i.b)
859− $(b t.b, c [i.b c])
1184+ $(b t.b, c [i.b c])
860− ?~ t.b [b ~]
1185+ ?~ t.b [b ~]
861− ?- i.t.b
1186+ ?- i.t.b
862− $'~' $(b t.t.b, c ['~' c])
1187+ %'~' $(b t.t.b, c ['~' c])
863− $'-' $(b t.t.b, c ['_' c])
1188+ %'-' $(b t.t.b, c ['_' c])
864− @ [b ~]
1189+ @ [b ~]
869#### Examples
1193#### Examples
872− > `@t`(wick '~-ams~~lop')
1196+> (wick ~.~~20~-sam~~)
873− '_ams~lop'
1197+[~ ~.~20_sam~]
875− > `@t`(wick (wack '~20_sam~'))
1199+> (wick ~.~20~-sam~~)
@@ -882,7 +1206,7 @@ A `++span` `@ta`.
883Unescape cord
1207Unescape cord
885−Unescape `++cord` codepoints.
1209+Unescape `knot`-encoded `cord`.
887#### Accepts
1211#### Accepts
@@ -890,51 +1214,50 @@ Unescape `++cord` codepoints.
891#### Produces
1215#### Produces
893−A `++cord`.
1217+A `cord`.
895#### Source
1219#### Source
898− ++ woad :: cord format
1222+++ woad
899− |= a/@ta
1223+ |= a=@ta
901− %+ rap 3
1225+ %+ rap 3
902− |- ^- (list @)
1226+ |- ^- (list @)
903− ?: =(`@`0 a)
1227+ ?: =(`@`0 a)
905− =+ b=(end 3 1 a)
1229+ =+ b=(end 3 a)
906− =+ c=(rsh 3 1 a)
1230+ =+ c=(rsh 3 a)
907− ?: =('.' b)
1231+ ?: =('.' b)
908− [' ' $(a c)]
1232+ [' ' $(a c)]
909− ?. =('~' b)
1233+ ?. =('~' b)
910− [b $(a c)]
1234+ [b $(a c)]
911− => .(b (end 3 1 c), c (rsh 3 1 c))
1235+ => .(b (end 3 c), c (rsh 3 c))
912− ?+ b =- (weld (rip 3 (tuft p.d)) $(a q.d))
1236+ ?+ b =- (weld (rip 3 (tuft p.d)) $(a q.d))
915− |- ^- {p/@ q/@}
1239+ |- ^- [p=@ q=@]
916− ?: =('.' b)
1240+ ?: =('.' b)
918− ?< =(0 c)
1242+ ?< =(0 c)
920− b (end 3 1 c)
1244+ b (end 3 c)
921− c (rsh 3 1 c)
1245+ c (rsh 3 c)
922− d %+ add (mul 16 d)
1246+ d %+ add (mul 16 d)
923− %+ sub b
1247+ %+ sub b
924− ?: &((gte b '0') (lte b '9')) 48
1248+ ?: &((gte b '0') (lte b '9')) 48
925− ?>(&((gte b 'a') (lte b 'z')) 87)
1249+ ?>(&((gte b 'a') (lte b 'z')) 87)
927− $'.' ['.' $(a c)]
1251+ %'.' ['.' $(a c)]
928− $'~' ['~' $(a c)]
1252+ %'~' ['~' $(a c)]
933#### Examples
1256#### Examples
936− > (woad ~.~b6.20.as)
1259+> (woad ~.foo.bar~21.)
937− '¶20 as'
1260+'foo bar!'
@@ -943,51 +1266,55 @@ A `++cord`.
944Escape cord
1267Escape cord
946−Escape `++cord` codepoints.
1269+Escape `cord` `a` so it can be encoded in a `knot`.
948#### Accepts
1271#### Accepts
950−`a` is a `++span` (`@ta`).
1273+`a` is a `cord`.
952#### Produces
1275#### Produces
954−A `++span` (`@ta`).
1277+A `knot`.
956#### Source
1279#### Source
959− ++ wood :: cord format
1282+++ wood
960− |= a/@t
1283+ |= a=@t
962− %+ rap 3
1285+ %+ rap 3
963− |- ^- (list @)
1286+ |- ^- (list @)
964− ?: =(`@`0 a)
1287+ ?: =(`@`0 a)
966− =+ b=(teff a)
1289+ =+ b=(teff a)
967− =+ c=(turf (end 3 b a))
1290+ =+ c=(taft (end [3 b] a))
968− =+ d=$(a (rsh 3 b a))
1291+ =+ d=$(a (rsh [3 b] a))
969− ?: ?| &((gte c 'a') (lte c 'z'))
1292+ ?: ?| &((gte c 'a') (lte c 'z'))
970− &((gte c '0') (lte c '9'))
1293+ &((gte c '0') (lte c '9'))
971− =(`@`'-' c)
1294+ =(`@`'-' c)
976− =+ e=(met 2 c)
1299+ =+ e=(met 2 c)
977− |- ^- tape
1300+ |- ^- tape
978− ?: =(0 e)
1301+ ?: =(0 e)
979− ['.' d]
1302+ ['.' d]
980− =. e (dec e)
1303+ =. e (dec e)
981− =+ f=(rsh 2 e c)
1304+ =+ f=(rsh [2 e] c)
982− [(add ?:((lte f 9) 48 87) f) $(c (end 2 e c))]
1305+ [(add ?:((lte f 9) 48 87) f) $(c (end [2 e] c))]
986#### Examples
1313#### Examples
989− > (wood 'my ßam')
1316+> (wood 'foo bar!')
990− ~.my.~df.am
1317+~.foo.bar~21.