2title = "4b: Text Processing"
20 ?: ?& (gte (met 3 a) 2)
25 ?& ?|(=('-' vis) ?&((gte vis 'a') (lte vis 'z')))
40 ++ rf `tape`[?-(a $& '&', $| '|', * !!) ~]
48 ++ rn `tape`[?>(=(0 a) '~') ~]
56 ++ rt `tape`['\'' (weld (mesc (trip a)) `tape`['\'' ~])]
72 ++ rtam `tape`['%' (trip a)]
80 ++ rub `tape`['0' 'b' (rum 2 ~ |=(b/@ (add '0' b)))]
88 ++ rud (rum 10 ~ |=(b/@ (add '0' b)))
97 |= {b/@ c/tape d/$-(@ @)}
105 =+ f=&(!=(0 e) =(0 (mod e ?:(=(10 b) 3 4))))
108 c [(d (mod a b)) ?:(f [?:(=(10 b) ',' '-') c] c)]
126 $(a (rsh 5 1 a), b (sub b 4))
127 `tape`['-' '-' $(a (end 5 1 a), b 4)]
136 (weld (trip (tod:po c)) (trip (tos:po (mix c d))))
139 (weld ^$(a c, b (met 3 c)) `tape`['-' $(a (mix c d), b 2)])
160 ?:((lth b 26) (add 65 b) ?:((lth b 52) (add 71 b) (sub b 4)))
169 ++ rux `tape`['0' 'x' (rum 16 ~ |=(b/@ (add b ?:((lth b 10) 48 87))))]
171 :::::::::::::::::::::::::::::::::::::::::::::::::::::: ::
184Turn all occurences of uppercase letters in any `++tape` into lowercase
185letters. Returns a `++tape`.
201 (turn vib |=(a/@ ?.(&((gte a 'A') (lte a 'Z')) a (add 32 a))))
210 > (cass "abc ABC 123 !@#")
213 > (cass "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsQqRrVvWwXxYyZz")
214 "aabbccddeeffgghhiijjkkllmmnnooppqqrrssqqrrvvwwxxyyzz"
223Produce a `++cord` from a `++tape`.
236 ++ crip |=(a=tape `@t`(rap 3 a)) :: tape to cord
245 > (crip "abc 123 !@#")
258Turn all occurences of lowercase letters in any `++tape` into uppercase
259letters. Returns a `++tape`.
275 (turn vib |=(a/@ ?.(&((gte a 'a') (lte a 'z')) a (sub a 32))))
284 > (cuss "abc ABC 123 !@#")
287 > (cuss "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsQqRrVvWwXxYyZz")
288 "AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSQQRRVVWWXXYYZZ"
297Escape special characters, used in `++show`.
310 ++ mesc :: ctrl code escape
316 ['\\' '\\' $(vib t.vib)]
317 ?: ?|((gth i.vib 126) (lth i.vib 32) =(`@`39 i.vib))
318 ['\\' (welp ~(rux at i.vib) '/' $(vib t.vib))]
330 "as\0x27/sa\0xc3/\0x9f/"
339Add `a` repetitions of character `b` to the head of `++tape` `c`.
343`a` and `b` are atoms.
354 ++ runt :: prepend repeatedly
355 |= [[a/@ b/@] c/tape]
366 > (runt [2 '/'] "ham")
378Soft-cast validity by aura.
382`a` is a `++span` (`@ta`).
393 ++ sand :: atom sanity
396 ?.(((sane a) b) ~ [~ b])
403 > `(unit @ta)`((sand %ta) 'sym-som')
405 > `(unit @ta)`((sand %ta) 'err!')
415Check validity by aura. Produces a gate.
419`a` is a `++span` (`@ta`).
430 ++ sane :: atom sanity
435 =+ [inx=0 len=(met 3 b)]
439 =+ cur=(cut 3 [inx 1] b)
440 ?& ?| &((gte cur 'a') (lte cur 'z'))
441 &(=('-' cur) !=(0 inx) !=(len inx))
442 &(&((gte cur '0') (lte cur '9')) !=(0 inx))
449 =+ cur=(cut 3 [inx 1] b)
450 ?& ?| &((gte cur 'a') (lte cur 'z'))
451 &((gte cur '0') (lte cur '9'))
452 |(=('-' cur) =('~' cur) =('_' cur) =('.' cur))
459 ?: &((lth cur 32) !=(10 cur)) |
461 ?& |(=(1 len) =+(i=1 |-(|(=(i len) &((gte (cut 3 [i 1] b) 128) $(i +(i)))))))
472 > ((sane %tas) 'lam')
474 > ((sane %tas) 'more ace')
484Produces the number of utf8 bytes.
502 ?> |((gte b 32) =(10 b))
503 ?:((lte b 127) 1 ?:((lte b 223) 2 ?:((lte b 239) 3 4)))
521Split first `a` characters off `++tape` `b`.
531A cell of `++tape`s, `p` and `q`.
536 ++ trim :: 31-bit nonzero
540 =+ haz=(spec syd key)
541 =+ ham=(mix (rsh 0 31 haz) (end 0 31 haz))
542 ?.(=(0 ham) ham $(syd +(syd)))
550 > (trim 5 "lasok termun")
551 [p="lasok" q=" termun"]
562Produce a `++tape` from `++cord`.
575 ++ trip :: cord to tape
580 [^-(@ta (end 3 1 a)) $(a (rsh 3 1 a))]
589 > (trip 'abc 123 !@#')
601Convert `++tape` to a `++list` of codepoints (`@c`).
609A `++list` of codepoints `@c`.
614 ++ tuba :: utf8 to utf32 tape
617 (rip 5 (turf (rap 3 a))) :: XX horrible
625 ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.]
627 ~[~-c ~-h ~-a ~-r ~-s]
636Wrap a `++list` of utf32 codepoints into a utf8 `++tape`.
640`a` is a `++list` of `@c`.
649 ++ tufa :: utf32 to utf8 tape
653 (weld (rip 3 (tuft i.a)) $(a t.a))
660 > (tufa ~[~-~44f. ~-. ~-~442. ~-~443. ~-~442.])
662 > (tufa ((list @c) ~[%a %b 0xb1 %c]))
672Convert utf32 glyph to
677`a` is a codepoint (`@c`).
686 ++ tuft :: utf32 to utf8 text
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))
731Convert utf8 (`++cord`) to utf32 codepoints.
739A `@c`, UTF-32 codepoint.
744 ++ turf :: utf8 to utf32
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 !!)
775 ~-~44f..~442.~443.~442.
777 0x82.d183.d182.d120.8fd1
778 > `@ux`(turf 'я тут')
779 0x442.0000.0443.0000.0442.0000.0020.0000.044f
788Escape `++span` `~` as `~~` and `_` as `~-`. Used for printing.
792`a` is a `++span` (`@ta`).
801 ++ wack :: coin format
809 ?: =('~' i.b) ['~' '~' $(b t.b)]
810 ?: =('_' i.b) ['~' '-' $(b t.b)]
821 > `@t`(wack '~20_sam~')
824 > ~(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