On 28 October 2010 13:22, andrei <andrei.zhabin...@gmail.com> wrote: > > 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? >
Are you looking for pr-str? user> (pr-str "foo") "\"foo\"" Regards, Stuart -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en