I want to convert a string into a list of one strings in Racket:
(string-split-wishful "abcd" "") => (list "a" "b" "c" "d")
This is the function that I wish for. The closest thing is string-split
which doesn't do what I want:
(string-split "abcd" "") => (list "" "a" "b" "c" "d" "")
How do I get rid of the superfluous empty strings at the beginning and the end? I know that I can do something like (reverse (cdr (reverse (cdr (string-split "abcd" "")))))
but I want to know if there's a more idiomatic way of doing this.
(map string (string->list str))
. – Apocalyptic