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 ["a" "b"]))

"[a b]"

boot.user=> (binding [*print-readably* true] (pr-str ["a" "b"]))

"[\"a\" \"b\"]"

 

In other words, is the second expression expected (documented?) behavior?

 

Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

 

On 5/2/17, 2:06 PM, "Jenny Finkel" <clojure@googlegroups.com on behalf of 
jrfin...@gmail.com> wrote:

 

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 (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 <peste...@gmail.com> wrote:

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 <jrfi...@gmail.com> 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:
>
> user> (let [xs (doall (map #(pr-str %) ["a" "b"]))] (print xs))
> ("a" "b")
> user> (let [xs (map #(pr-str %) ["a" "b"])] (print xs))
> (a b)
>
> 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. If this really is a
> bug, I'd be happy to submit a patch for it.
>
> Thanks, Jenny
>
> --
> 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
> 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
> 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.
> For more options, visit https://groups.google.com/d/optout.

--
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
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
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.
For more options, visit https://groups.google.com/d/optout.

-- 
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/d/optout.


-- 
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/d/optout.

Reply via email to