I want to add a character to a string, and get another string with the character added as a result.
This doesn’t work:
(cons \a "abc")
Possible solutions, in order of preference:
- Clojure core function
- Clojure library function
- Clojure user-defined (me!) function (such as
(apply str (cons \a "abc"))) - java.lang.String methods
Is there any category 1 solution before I roll-my-own?
Edit: this was a pretty dumb question. 🙁
How about:
This returns “abca” on my machine.
You can also use it for any number of strings/chars:
(str "kl" \m "abc" \a \b).