I was seeking `interpose` function, thanks. But it still doesn't work
for strings - they are not wrapped by "\"\. E.g.
(apply str (interpose ", " (list 1 2 3 4 5))) ==> "1, 2, 3, 4, 5"
and
(apply str (interpose ", " (list "1" "2" "3" "4" "5"))) ==> "1, 2, 3,
4, 5"
The problem is that applying `str` to strings just concatenates them
and doesn't include inverted commas. It's the same issue that applies
to `print` and `pr` functions - first just prints, and the second
prints in the form that can be read by reader. Is there an equivalent
of `pr` that returns string "as is"?
Of course, I can make such trick:
(defn pr-to-str [o]
(let [sw (StringWriter.)]
(binding [*out* sw]
(pr o))
(str sw)))
But aren't there such built-in function?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en