2title = "4b: Text Processing"
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.**
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.
39`a` is a `@`, and is the sample of `++at`.
49 ?: ?& (gte (met 3 a) 2)
54 ?& ?|(=('-' vis) ?&((gte vis 'a') (lte vis 'z')))
87If `a` is a loobean, print as `|`/`&`, otherwise crash.
91`a` is a `@`, and is the sample of `++at`.
100++ rf `tape`[?-(a %& '&', %| '|', * !!) ~]
117dojo: hoon expression failed
126If `a` is null, print `~`, otherwise crash.
130`a` is a `@`, and is the sample of `++at`.
139++ rn `tape`[?>(=(0 a) '~') ~]
151dojo: hoon expression failed
156Print cord, including escape characters
158Print `a` with `cord` syntax, including escape characters.
162`a` is a `@`, and the sample of `++at`.
171++ rt `tape`['\'' (weld (mesc (trip a)) `tape`['\'' ~])]
207Print cord with `@tas` syntax
209Treat `a` as `cord`, print it with `%` prefix.
213`a` is a `@`, and is the sample of `++at`.
222++ rtam `tape`['%' (trip a)]
248Print `a` as `@ub` syntax, except with `-` separators rather than `.` separators.
252`a` is a `@`, and is the sample of `++at`.
261++ rub `tape`['0' 'b' (rum 2 ~ |=(b=@ (add '0' b)))]
268"0b1011-1110-1110-1111"
277Print atom `a` as an integer, with commas separating thousands.
290++ rud (rum 10 ~ |=(b=@ (add '0' b)))
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.
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 `@`.
325 |= [b=@ c=tape d=$-(@ @)]
333 =+ f=&(!=(0 e) =(0 (mod e ?:(=(10 b) 3 4))))
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"
364Print `a` as an `@p`, but with outdated syntax and number<->syllable mapping. This
365function almost certainly should not be used.
385 $(a (rsh 5 a), b (sub b 4))
386 `tape`['-' '-' $(a (end 5 a), b 4)]
395 (weld (trip (tod:po c)) (trip (tos:po (mix c d))))
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)
424Print `a` as **outdated** base-64 syntax, with `0v` rather than `0w` prefix,
425different character mappings and separators.
429`a` is a `@`, and is the sample of `++at`.
450 ?:((lth b 26) (add 65 b) ?:((lth b 52) (add 71 b) (sub b 4)))
456> ~(ruv at 0xdead.beef)
460Note this is how it should be rendered:
473Print `a` as `@ux` except with `-` separators rather than `.`s.
477`a` is a `@`, and is the sample of `++at`.
486++ rux `tape`['0' 'x' (rum 16 ~ |=(b=@ (add b ?:((lth b 10) 48 87))))]
492> ~(rux at 0xdead.beef)
502Turn all occurences of uppercase letters in any `tape` into lowercase
503letters. Returns a `tape`.
519 (turn vib |=(a=@ ?.(&((gte a 'A') (lte a 'Z')) a (add 32 a))))
528> (cass "abc ABC 123 !@#")
531> (cass "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsQqRrVvWwXxYyZz")
532"aabbccddeeffgghhiijjkkllmmnnooppqqrrssqqrrvvwwxxyyzz"
541Produce a `cord` from a `tape`.
554++ crip |=(a=tape `@t`(rap 3 a))
563> (crip "abc 123 !@#")
576Turn all occurences of lowercase letters in any `tape` into uppercase
577letters. Returns a `tape`.
593 (turn vib |=(a=@ ?.(&((gte a 'a') (lte a 'z')) a (sub a 32))))
602> (cuss "abc ABC 123 !@#")
605> (cuss "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsQqRrVvWwXxYyZz")
606"AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSQQRRVVWWXXYYZZ"
615Escape special characters.
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))]
648"as\0x27/sa\0xc3/\0x9f/"
657Add `a` repetitions of character `b` to the head of `tape` `c`.
673 |= [[a=@ b=@] c=tape]
683> (runt [2 '/'] "ham")
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`.
701`a` is a `@ta`, and specifies the aura like `%tas` or `%ta`.
720> `(unit @ta)`((sand %ta) 'sym-som')
725> `(unit @ta)`((sand %ta) 'err!')
735Check validity of `a` by aura `b`. Takes `b` and produces a gate that takes `a`.
739`a` is a `@ta`, and specifies the aura like `%tas` or `%ta`.
754 :: XX more and better sanity
757 =+ [inx=0 len=(met 3 b)]
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))
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))
781 ?: &((lth cur 32) !=(10 cur)) |
783 ?& |(=(1 len) =+(i=1 |-(|(=(i len) &((gte (cut 3 [i 1] b) 128) $(i +(i)))))))
797> ((sane %tas) 'more ace')
807Convert `cord` `a` to a UTF32 `@c`.
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)])
838 ?> =((tuft c) (end [3 b] a))
839 [c $(a (rsh [3 b] a))]
8520x72.0000.0061.0000.0062.0000.006f.0000.006f.0000.0066
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
881 ?> |((gte b 32) =(10 b))
882 ?:((lte b 127) 1 ?:((lte b 223) 2 ?:((lte b 239) 3 4)))
904Split first `a` characters off `tape` `b`.
914A cell of `tape`s, `p` and `q`.
926 =+ c=$(a (dec a), b t.b)
933> (trim 5 "lasok termun")
934[p="lasok" q=" termun"]
946Produce a `tape` from `cord` `a`.
964 [^-(@ta (end 3 a)) $(a (rsh 3 a))]
973> (trip 'abc 123 !@#')
984UTF8 tape to UTF32 tape
986Convert `tape` to a `list` of codepoints (`@c`).
1002 (rip 5 (taft (rap 3 a)))
1009~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.]
1012~[~-c ~-h ~-a ~-r ~-s]
1021Wrap a `list` of utf32 codepoints into a utf8 `tape`.
1025`a` is a `(list @c)`.
1038 (weld (rip 3 (tuft i.a)) $(a t.a))
1044> (tufa ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.])
1047> (tufa ((list @c) ~[%a %b 0xb1 %c]))
1057Convert `@c` to `cord`.
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))
11070x72.0000.0061.0000.0062.0000.006f.0000.006f.0000.0066
1119Escape `knot` `~` as `~~` and `_` as `~-`. Used for printing.
1140 ?: =('~' i.b) ['~' '~' $(b t.b)]
1141 ?: =('_' i.b) ['~' '-' $(b t.b)]
1151> `@t`(wack '~20_sam~')
1161Unescape `knot` `~~` as `~` and `~-` as `_`. Produces a `unit`, which is null if
1162the `knot` contains unescaped `~` characters.
1179 =- ?^(b ~ (some (rap 3 (flop c))))
1181 |- ^- [b=tape c=tape]
1187 %'~' $(b t.t.b, c ['~' c])
1188 %'-' $(b t.t.b, c ['_' c])
1196> (wick ~.~~20~-sam~~)
1199> (wick ~.~20~-sam~~)
1209Unescape `knot`-encoded `cord`.
1235 => .(b (end 3 c), c (rsh 3 c))
1236 ?+ b =- (weld (rip 3 (tuft p.d)) $(a q.d))
1248 ?: &((gte b '0') (lte b '9')) 48
1249 ?>(&((gte b 'a') (lte b 'z')) 87)
1259> (woad ~.foo.bar~21.)
1269Escape `cord` `a` so it can be encoded in a `knot`.
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'))
1305 [(add ?:((lte f 9) 48 87) f) $(c (end [2 e] c))]
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list