Re: potential bug with pr-str+print

2017-05-03 Thread Matching Socks
One more risk of (print ...), for debugging, is that it pollutes the results of functions that use (with-out-str ...). Consider using clojure.tools.logging instead. Setting it up takes some brainpower, but the investment is well worth while. -- You received this message because you are sub

Re: potential bug with pr-str+print

2017-05-02 Thread Jenny Finkel
On Tuesday, May 2, 2017 at 7:34:21 PM UTC-7, Alex Miller wrote: > > > On Tuesday, May 2, 2017 at 6:00:52 PM UTC-5, Jenny Finkel wrote: >> >> Thanks for the reply. Your explanation for why it should be expected >> sounds like implementation details though (why it is that way, but not why >> it s

Re: potential bug with pr-str+print

2017-05-02 Thread Alex Miller
On Tuesday, May 2, 2017 at 6:00:52 PM UTC-5, Jenny Finkel wrote: > > Thanks for the reply. Your explanation for why it should be expected > sounds like implementation details though (why it is that way, but not why > it should be that way). > I'll grant you that, and I could certainly be wrong

Re: potential bug with pr-str+print

2017-05-02 Thread Jenny Finkel
Thanks for the reply. Your explanation for why it should be expected sounds like implementation details though (why it is that way, but not why it should be that way). The docstring for 'pr' admittedly makes a reference to "by default" ("Prints the object(s) to the output stream that is the cur

Re: potential bug with pr-str+print

2017-05-02 Thread Alex Miller
The `pr` family of functions prints data as readable data by default (with *print-readably* defaulted to true - this happens in RT). The `print` family of functions wraps the `pr` family and turns off this behavior by binding *print-readably* to nil. So I think when surrounding a pr with a pr

Re: potential bug with pr-str+print

2017-05-02 Thread Sean Corfield
Expressed without the interaction of dynamic bindings and laziness (which is why there’s the difference here), the question boils down to whether this is the correct, expected behavior or not: boot.user=> (pr-str ["a" "b"]) "[\"a\" \"b\"]" boot.user=> (binding [*print-readably* nil] (pr-str

Re: potential bug with pr-str+print

2017-05-02 Thread Jenny Finkel
Correct. "The reason is that print binds *print-readably* to nil, whereas pr-str does not bind it to true, even though I believe it should." On Tuesday, May 2, 2017 at 1:55:04 PM UTC-7, Justin Smith wrote: > > there's something going on with dynamic bindings here > > peregrine.circle=> (let [xs (

Re: potential bug with pr-str+print

2017-05-02 Thread Justin Smith
there's something going on with dynamic bindings here peregrine.circle=> (let [xs (map #(pr-str %) ["a" "b"])] (println xs)) (a b) nil peregrine.circle=> (let [xs (doall (map #(pr-str %) ["a" "b"]))] (println xs)) ("a" "b") nil On Tue, May 2, 2017 at 1:55 AM Paulus Esterhazy wrote: > Looks lik

Re: potential bug with pr-str+print

2017-05-02 Thread Paulus Esterhazy
Looks like a bug to me. ClojureScript doesn't seem to have this problem. On Tue, May 2, 2017 at 7:50 AM, Jenny Finkel wrote: > Hello! > > I think I may have found a bug in clojure. When pr-str is called from within > print, it doesn't produce a read-string-able string. Here is a simple > example:

potential bug with pr-str+print

2017-05-01 Thread Jenny Finkel
Hello! I think I may have found a bug in clojure. When pr-str is called from within print, it doesn't produce a read-string-able string. Here is a simple example: user> (let [xs (doall (map #(pr-str %) ["a" "b"]))] (print xs)) ("a" "b") user> (let [xs (map #(pr-str %) ["a" "b"])] (print xs)) (a