@ksaj my #lispmoo2 split
{ @verb repeatedly-eval-qt :is
(com-split-string
(let* ((string (car dobj)) (splitchar (car iobj)) (lenz (scan `(,(length string))))
(chars (scan t string))
(mask (#Mchar= chars (series splitchar)))
(space-labels (#Mand mask (scan-range)))
(dense-labels (choose-if #'identity space-labels))
(ends (catenate dense-labels lenz))
(begins (catenate #z(0) (#M1+ dense-labels)))
(words (map-fn t #'(lambda (b e) (subseq string b e)) begins ends)))
(collect words))) } x
https://mastodon.sdf.org/@screwtape/113528619270034402
2024-11-22 screwtape ┃ 1#️ 1👤 2💬
@ksaj
(this is so the player prototype of repeatedly-eval-qt in my lispmoo2 can call it like this:
LISPMOO2/USER> { split-string ("foo bar baz") :with (#\space) } x
[…]
────
────