Reputation: 9206
I would like to concatenate strings stored in a vector. For example if I have ["a" "b" "c"]
in the vector I would like to get as a result "abc"
.
Upvotes: 17
Views: 12770
Reputation: 10393
This is one of the ways Clojure's reduce can be used. Note the session at Clojure's REPL:
[dsm@localhost:~]$ clj
Clojure 1.4.0
user=> (reduce str ["a" "b" "c"])
"abc"
user=>
Upvotes: 6
Reputation: 8850
You can use apply
with the str
function:
(apply str ["a" "b" "c"])
Upvotes: 34
Reputation: 11908
You can use clojure.string join function for that
(clojure.string/join ["a" "b" "c"])
Upvotes: 20