There's nothing wrong with pr-str. Debug output should go to stderr. user=> (def k (pr-str (for [x (range 5)] (do (.println *err* x) (.println *err* "nothing") x)))) 0 nothing 1 nothing 2 nothing 3 nothing 4 nothing #'user/k user=> k "(0 1 2 3 4)"
On Saturday, February 9, 2013 2:41:23 PM UTC-8, AtKaaZ wrote: > > these examples to illustrate what you are saying: > > => (= "(debug 1\r\n2 nil 3)" (pr-str (lazy-seq (list 2 (println "debug" 1) > 3)))) > true > > > => (= "(1\r\n)" (pr-str (lazy-seq (println 1)))) > true > > > > > On Sat, Feb 9, 2013 at 10:57 PM, Conrad <drc...@gmail.com <javascript:>>wrote: > >> For those reading this, the issue is NOT that output in the REPL looks >> funny. The problem is that if, for instance, you put debug code into a >> chunk of code that makes use of "pr-str" your debug code is actually >> WRITTEN TO THE STRING. This is because "pr-str" works by using >> "with-out-str". This seems clumsy and is undocumented IMHO and I am >> wondering if other people feel the same. >> >> >> On Saturday, February 9, 2013 12:30:20 PM UTC-6, Conrad wrote: >>> >>> I tested this in the latest 1.5.0-RC6: >>> >>> => (def k (pr-str (for [x (range 5)] >>> (do (pr x) >>> x)))) >>> #'user/k >>> => k >>> "(012340 1 2 3 4)" >>> >>> This seems wrong to me... I can see what would be needed to fix it in >>> clojure/core.clj, but it would require creating several additional private >>> functions. Does anyone know if this behavior is intentional? >>> >> -- >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clo...@googlegroups.com<javascript:> >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+u...@googlegroups.com <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to clojure+u...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > > > -- > Please correct me if I'm wrong or incomplete, > even if you think I'll subconsciously hate it. > > -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.