2title = "4b: Text Processing"
22 ?: ?& (gte (met 3 a) 2)
27 ?& ?|(=('-' vis) ?&((gte vis 'a') (lte vis 'z')))
43 ++ rf `tape`[?-(a $& '&', $| '|', * !!) ~]
52 ++ rn `tape`[?>(=(0 a) '~') ~]
60 ++ rt `tape`['\'' (weld (mesc (trip a)) `tape`['\'' ~])]
76 ++ rtam `tape`['%' (trip a)]
84 ++ rub `tape`['0' 'b' (rum 2 ~ |=(b/@ (add '0' b)))]
92 ++ rud (rum 10 ~ |=(b/@ (add '0' b)))
101 |= {b/@ c/tape d/$-(@ @)}
109 =+ f=&(!=(0 e) =(0 (mod e ?:(=(10 b) 3 4))))
112 c [(d (mod a b)) ?:(f [?:(=(10 b) ',' '-') c] c)]
130 $(a (rsh 5 1 a), b (sub b 4))
131 `tape`['-' '-' $(a (end 5 1 a), b 4)]
140 (weld (trip (tod:po c)) (trip (tos:po (mix c d))))
143 (weld ^$(a c, b (met 3 c)) `tape`['-' $(a (mix c d), b 2)])
164 ?:((lth b 26) (add 65 b) ?:((lth b 52) (add 71 b) (sub b 4)))
173 ++ rux `tape`['0' 'x' (rum 16 ~ |=(b/@ (add b ?:((lth b 10) 48 87))))]
175 :::::::::::::::::::::::::::::::::::::::::::::::::::::: ::
189Turn all occurences of uppercase letters in any `++tape` into lowercase
190letters. Returns a `++tape`.
206 (turn vib |=(a/@ ?.(&((gte a 'A') (lte a 'Z')) a (add 32 a))))
215 > (cass "abc ABC 123 !@#")
218 > (cass "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsQqRrVvWwXxYyZz")
219 "aabbccddeeffgghhiijjkkllmmnnooppqqrrssqqrrvvwwxxyyzz"
227Produce a `++cord` from a `++tape`.
240 ++ crip |=(a=tape `@t`(rap 3 a)) :: tape to cord
249 > (crip "abc 123 !@#")
261Turn all occurences of lowercase letters in any `++tape` into uppercase
262letters. Returns a `++tape`.
278 (turn vib |=(a/@ ?.(&((gte a 'a') (lte a 'z')) a (sub a 32))))
287 > (cuss "abc ABC 123 !@#")
290 > (cuss "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsQqRrVvWwXxYyZz")
291 "AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSQQRRVVWWXXYYZZ"
299Escape special characters, used in `++show`.
312 ++ mesc :: ctrl code escape
318 ['\\' '\\' $(vib t.vib)]
319 ?: ?|((gth i.vib 126) (lth i.vib 32) =(`@`39 i.vib))
320 ['\\' (welp ~(rux at i.vib) '/' $(vib t.vib))]
332 "as\0x27/sa\0xc3/\0x9f/"
341Add `a` repetitions of character `b` to the head of `++tape` `c`.
345`a` and `b` are atoms.
356 ++ runt :: prepend repeatedly
357 |= [[a/@ b/@] c/tape]
368 > (runt [2 '/'] "ham")
380Soft-cast validity by aura.
384`a` is a `++span` (`@ta`).
395 ++ sand :: atom sanity
398 ?.(((sane a) b) ~ [~ b])
405 > `(unit @ta)`((sand %ta) 'sym-som')
407 > `(unit @ta)`((sand %ta) 'err!')
417Check validity by aura. Produces a gate.
421`a` is a `++span` (`@ta`).
432 ++ sane :: atom sanity
437 =+ [inx=0 len=(met 3 b)]
441 =+ cur=(cut 3 [inx 1] b)
442 ?& ?| &((gte cur 'a') (lte cur 'z'))
443 &(=('-' cur) !=(0 inx) !=(len inx))
444 &(&((gte cur '0') (lte cur '9')) !=(0 inx))
451 =+ cur=(cut 3 [inx 1] b)
452 ?& ?| &((gte cur 'a') (lte cur 'z'))
453 &((gte cur '0') (lte cur '9'))
454 |(=('-' cur) =('~' cur) =('_' cur) =('.' cur))
461 ?: &((lth cur 32) !=(10 cur)) |
463 ?& |(=(1 len) =+(i=1 |-(|(=(i len) &((gte (cut 3 [i 1] b) 128) $(i +(i)))))))
474 > ((sane %tas) 'lam')
476 > ((sane %tas) 'more ace')
486Produces the number of utf8 bytes.
504 ?> |((gte b 32) =(10 b))
505 ?:((lte b 127) 1 ?:((lte b 223) 2 ?:((lte b 239) 3 4)))
523Split first `a` characters off `++tape` `b`.
533A cell of `++tape`s, `p` and `q`.
538 ++ trim :: 31-bit nonzero
542 =+ haz=(spec syd key)
543 =+ ham=(mix (rsh 0 31 haz) (end 0 31 haz))
544 ?.(=(0 ham) ham $(syd +(syd)))
552 > (trim 5 "lasok termun")
553 [p="lasok" q=" termun"]
564Produce a `++tape` from `++cord`.
577 ++ trip :: cord to tape
582 [^-(@ta (end 3 1 a)) $(a (rsh 3 1 a))]
591 > (trip 'abc 123 !@#')
603Convert `++tape` to a `++list` of codepoints (`@c`).
611A `++list` of codepoints `@c`.
616 ++ tuba :: utf8 to utf32 tape
619 (rip 5 (turf (rap 3 a))) :: XX horrible
627 ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.]
629 ~[~-c ~-h ~-a ~-r ~-s]
638Wrap a `++list` of utf32 codepoints into a utf8 `++tape`.
642`a` is a `++list` of `@c`.
651 ++ tufa :: utf32 to utf8 tape
655 (weld (rip 3 (tuft i.a)) $(a t.a))
662 > (tufa ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.])
664 > (tufa ((list @c) ~[%a %b 0xb1 %c]))
674Convert utf32 glyph to
679`a` is a codepoint (`@c`).
688 ++ tuft :: utf32 to utf8 text
696 =+ c=$(a (rsh 5 1 a))
700 :* (mix 0b1100.0000 (cut 0 [6 5] b))
701 (mix 0b1000.0000 (end 0 6 b))
705 :* (mix 0b1110.0000 (cut 0 [12 4] b))
706 (mix 0b1000.0000 (cut 0 [6 6] b))
707 (mix 0b1000.0000 (end 0 6 b))
710 :* (mix 0b1111.0000 (cut 0 [18 3] b))
711 (mix 0b1000.0000 (cut 0 [12 6] b))
712 (mix 0b1000.0000 (cut 0 [6 6] b))
713 (mix 0b1000.0000 (end 0 6 b))
733Convert utf8 (`++cord`) to utf32 codepoints.
741A `@c`, UTF-32 codepoint.
746 ++ turf :: utf8 to utf32
760 $3 [[16 6] [8 6] [0 4] ~]
761 $4 [[24 6] [16 6] [8 6] [0 3] ~]
763 |=({p/@ q/@} [q (cut 0 [p q] a)])
764 ?. =((tuft c) (end 3 b a)) ~|(%bad-utf8 !!)
777 ~-~44f..~442.~443.~442.
779 0x82.d183.d182.d120.8fd1
780 > `@ux`(turf 'я тут')
781 0x442.0000.0443.0000.0442.0000.0020.0000.044f
790Escape `++span` `~` as `~~` and `_` as `~-`. Used for printing.
794`a` is a `++span` (`@ta`).
803 ++ wack :: coin format
811 ?: =('~' i.b) ['~' '~' $(b t.b)]
812 ?: =('_' i.b) ['~' '-' $(b t.b)]
823 > `@t`(wack '~20_sam~')
826 > ~(rend co %many ~[`ud/5 `ta/'~20_sam'])
838Unescape `++span` `~~` as `~` and `~-` as `_`.
851 ++ wick :: knot format
855 =- ?^(b ~ (some (rap 3 (flop c))))
857 |- ^- {b/tape c/tape}
863 $'~' $(b t.t.b, c ['~' c])
864 $'-' $(b t.t.b, c ['_' c])
873 > `@t`(wick '~-ams~~lop')
876 > `@t`(wick (wack '~20_sam~'))
886Unescape `++cord` codepoints.
899 ++ woad :: cord format
912 => .(b (end 3 1 c), c (rsh 3 1 c))
913 ?+ b =- (weld (rip 3 (tuft p.d)) $(a q.d))
925 ?: &((gte b '0') (lte b '9')) 48
926 ?>(&((gte b 'a') (lte b 'z')) 87)
947Escape `++cord` codepoints.
951`a` is a `++span` (`@ta`).
960 ++ wood :: cord format
968 =+ c=(turf (end 3 b a))
969 =+ d=$(a (rsh 3 b a))
970 ?: ?| &((gte c 'a') (lte c 'z'))
971 &((gte c '0') (lte c '9'))
983 [(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