I have several strings:
(def a "some random string")
(def b "this is a text")
Now i want to concatenate parts of them to create a string "some text". Unfortunately both of the strings below didn't work.
(clojure.string/join " " [(take 4 a) (take-last 4 b)])
(str (take 4 a) " " (take-last 4 b))
It's because functions take
and take-last
return lazy sequences. The question is: what is the proper way to concatenate multiple lazy sequences of strings and return one string?
Edit: I found one solution - (apply str (concat (take 4 a) " " (take-last 4 a)))
- but is it the most correct way?