3 ms·
In TXR Lisp you can do: 1> (let ((s (copy "dog: bit person?"))) (rotate [s 0..3] [s 5..8] [s 9..15]) s) "bit: person dog?"
by kazinator 2y ago
In TXR Lisp you can do:
1> (let ((s (copy "dog: bit person?")))
(rotate [s 0..3] [s 5..8] [s 9..15])
s)
"bit: person dog?"
- trealira 2y agoThat does seem handy for string manipulation.
- kazinator 2y agoLess than you might think, though. We usually want to be doing complex string transformation functionally (destructuring the original string and synthesizing the new one). 1> (let ((s "dog: bit person?")) (match `@a: @b @c?` s `@b: @c @a?`)) "bit: person dog?" Or by hard positions like before: 2> (let ((s "dog: bit person?")) (match `@{a 3}@{q 2}@{b 3} @{c 6}@p` s `@b@q@c @a@p`)) "bit: person dog?"