2title = "4b: Text Processing"
21 ?: ?& (gte (met 3 a) 2)
26 ?& ?|(=('-' vis) ?&((gte vis 'a') (lte vis 'z')))
42 ++ rf `tape`[?-(a $& '&', $| '|', * !!) ~]
51 ++ rn `tape`[?>(=(0 a) '~') ~]
59 ++ rt `tape`['\'' (weld (mesc (trip a)) `tape`['\'' ~])]
75 ++ rtam `tape`['%' (trip a)]
83 ++ rub `tape`['0' 'b' (rum 2 ~ |=(b/@ (add '0' b)))]
91 ++ rud (rum 10 ~ |=(b/@ (add '0' b)))
100 |= {b/@ c/tape d/$-(@ @)}
108 =+ f=&(!=(0 e) =(0 (mod e ?:(=(10 b) 3 4))))
111 c [(d (mod a b)) ?:(f [?:(=(10 b) ',' '-') c] c)]
129 $(a (rsh 5 1 a), b (sub b 4))
130 `tape`['-' '-' $(a (end 5 1 a), b 4)]
139 (weld (trip (tod:po c)) (trip (tos:po (mix c d))))
142 (weld ^$(a c, b (met 3 c)) `tape`['-' $(a (mix c d), b 2)])
163 ?:((lth b 26) (add 65 b) ?:((lth b 52) (add 71 b) (sub b 4)))
172 ++ rux `tape`['0' 'x' (rum 16 ~ |=(b/@ (add b ?:((lth b 10) 48 87))))]
174 :::::::::::::::::::::::::::::::::::::::::::::::::::::: ::
188Turn all occurences of uppercase letters in any `++tape` into lowercase
189letters. Returns a `++tape`.
205 (turn vib |=(a/@ ?.(&((gte a 'A') (lte a 'Z')) a (add 32 a))))
214 > (cass "abc ABC 123 !@#")
217 > (cass "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsQqRrVvWwXxYyZz")
218 "aabbccddeeffgghhiijjkkllmmnnooppqqrrssqqrrvvwwxxyyzz"
226Produce a `++cord` from a `++tape`.
239 ++ crip |=(a=tape `@t`(rap 3 a)) :: tape to cord
248 > (crip "abc 123 !@#")
260Turn all occurences of lowercase letters in any `++tape` into uppercase
261letters. Returns a `++tape`.
277 (turn vib |=(a/@ ?.(&((gte a 'a') (lte a 'z')) a (sub a 32))))
286 > (cuss "abc ABC 123 !@#")
289 > (cuss "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsQqRrVvWwXxYyZz")
290 "AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSQQRRVVWWXXYYZZ"
298Escape special characters, used in `++show`.
311 ++ mesc :: ctrl code escape
317 ['\\' '\\' $(vib t.vib)]
318 ?: ?|((gth i.vib 126) (lth i.vib 32) =(`@`39 i.vib))
319 ['\\' (welp ~(rux at i.vib) '/' $(vib t.vib))]
331 "as\0x27/sa\0xc3/\0x9f/"
340Add `a` repetitions of character `b` to the head of `++tape` `c`.
344`a` and `b` are atoms.
355 ++ runt :: prepend repeatedly
356 |= [[a/@ b/@] c/tape]
367 > (runt [2 '/'] "ham")
379Soft-cast validity by odor.
383`a` is a `++span` (`@ta`).
394 ++ sand :: atom sanity
397 ?.(((sane a) b) ~ [~ b])
404 > `(unit @ta)`((sand %ta) 'sym-som')
406 > `(unit @ta)`((sand %ta) 'err!')
416Check validity by odor. Produces a gate.
420`a` is a `++span` (`@ta`).
431 ++ sane :: atom sanity
436 =+ [inx=0 len=(met 3 b)]
440 =+ cur=(cut 3 [inx 1] b)
441 ?& ?| &((gte cur 'a') (lte cur 'z'))
442 &(=('-' cur) !=(0 inx) !=(len inx))
443 &(&((gte cur '0') (lte cur '9')) !=(0 inx))
450 =+ cur=(cut 3 [inx 1] b)
451 ?& ?| &((gte cur 'a') (lte cur 'z'))
452 &((gte cur '0') (lte cur '9'))
453 |(=('-' cur) =('~' cur) =('_' cur) =('.' cur))
460 ?: &((lth cur 32) !=(10 cur)) |
462 ?& |(=(1 len) =+(i=1 |-(|(=(i len) &((gte (cut 3 [i 1] b) 128) $(i +(i)))))))
473 > ((sane %tas) 'lam')
475 > ((sane %tas) 'more ace')
485Produces the number of utf8 bytes.
503 ?> |((gte b 32) =(10 b))
504 ?:((lte b 127) 1 ?:((lte b 223) 2 ?:((lte b 239) 3 4)))
522Split first `a` characters off `++tape` `b`.
532A cell of `++tape`s, `p` and `q`.
537 ++ trim :: 31-bit nonzero
541 =+ haz=(spec syd key)
542 =+ ham=(mix (rsh 0 31 haz) (end 0 31 haz))
543 ?.(=(0 ham) ham $(syd +(syd)))
551 > (trim 5 "lasok termun")
552 [p="lasok" q=" termun"]
563Produce a `++tape` from `++cord`.
576 ++ trip :: cord to tape
581 [^-(@ta (end 3 1 a)) $(a (rsh 3 1 a))]
590 > (trip 'abc 123 !@#')
602Convert `++tape` to a `++list` of codepoints (`@c`).
610A `++list` of codepoints `@c`.
615 ++ tuba :: utf8 to utf32 tape
618 (rip 5 (turf (rap 3 a))) :: XX horrible
626 ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.]
628 ~[~-c ~-h ~-a ~-r ~-s]
637Wrap a `++list` of utf32 codepoints into a utf8 `++tape`.
641`a` is a `++list` of `@c`.
650 ++ tufa :: utf32 to utf8 tape
654 (weld (rip 3 (tuft i.a)) $(a t.a))
661 > (tufa ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.])
663 > (tufa ((list @c) ~[%a %b 0xb1 %c]))
673Convert utf32 glyph to
678`a` is a codepoint (`@c`).
687 ++ tuft :: utf32 to utf8 text
695 =+ c=$(a (rsh 5 1 a))
699 :* (mix 0b1100.0000 (cut 0 [6 5] b))
700 (mix 0b1000.0000 (end 0 6 b))
704 :* (mix 0b1110.0000 (cut 0 [12 4] b))
705 (mix 0b1000.0000 (cut 0 [6 6] b))
706 (mix 0b1000.0000 (end 0 6 b))
709 :* (mix 0b1111.0000 (cut 0 [18 3] b))
710 (mix 0b1000.0000 (cut 0 [12 6] b))
711 (mix 0b1000.0000 (cut 0 [6 6] b))
712 (mix 0b1000.0000 (end 0 6 b))
732Convert utf8 (`++cord`) to utf32 codepoints.
740A `@c`, UTF-32 codepoint.
745 ++ turf :: utf8 to utf32
759 $3 [[16 6] [8 6] [0 4] ~]
760 $4 [[24 6] [16 6] [8 6] [0 3] ~]
762 |=({p/@ q/@} [q (cut 0 [p q] a)])
763 ?. =((tuft c) (end 3 b a)) ~|(%bad-utf8 !!)
776 ~-~44f..~442.~443.~442.
778 0x82.d183.d182.d120.8fd1
779 > `@ux`(turf 'я тут')
780 0x442.0000.0443.0000.0442.0000.0020.0000.044f
789Escape `++span` `~` as `~~` and `_` as `~-`. Used for printing.
793`a` is a `++span` (`@ta`).
802 ++ wack :: coin format
810 ?: =('~' i.b) ['~' '~' $(b t.b)]
811 ?: =('_' i.b) ['~' '-' $(b t.b)]
822 > `@t`(wack '~20_sam~')
825 > ~(rend co %many ~[`ud/5 `ta/'~20_sam'])
837Unescape `++span` `~~` as `~` and `~-` as `_`.
850 ++ wick :: knot format
854 =- ?^(b ~ (some (rap 3 (flop c))))
856 |- ^- {b/tape c/tape}
862 $'~' $(b t.t.b, c ['~' c])
863 $'-' $(b t.t.b, c ['_' c])
872 > `@t`(wick '~-ams~~lop')
875 > `@t`(wick (wack '~20_sam~'))
885Unescape `++cord` codepoints.
898 ++ woad :: cord format
911 => .(b (end 3 1 c), c (rsh 3 1 c))
912 ?+ b =- (weld (rip 3 (tuft p.d)) $(a q.d))
924 ?: &((gte b '0') (lte b '9')) 48
925 ?>(&((gte b 'a') (lte b 'z')) 87)
946Escape `++cord` codepoints.
950`a` is a `++span` (`@ta`).
959 ++ wood :: cord format
967 =+ c=(turf (end 3 b a))
968 =+ d=$(a (rsh 3 b a))
969 ?: ?| &((gte c 'a') (lte c 'z'))
970 &((gte c '0') (lte c '9'))
982 [(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