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 
current value of *out*. Prints the object(s), separated by spaces if there 
is more than one. By default, pr and prn print in a way that objects can be 
read by the reader") but I don't understand why calling 'pr-str' inside of 
'print' should be considered non-default. Nothing in either of their 
docstrings references the other, or mentions *print-readably*, you have to 
look at the code directly to be aware of the relationship. I have a branch 
where pr-str binds *print-readably* to true and it seems to work fine. 
Without re-implementing all of them together though I guess that it's 
impossible to get a 'pr' inside of a 'print' to actually print something 
that's readable, so it would only fix it for 'pr-str' and not for 'pr'. 


On Tuesday, May 2, 2017 at 2:59:48 PM UTC-7, Alex Miller wrote:
>
> 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 print, you should expect print's 
> behavior as the expected behavior (no quotes). So, I would say, not a bug.
>
> Admittedly, intermingling these is confusing. 
>
>
> On Tuesday, May 2, 2017 at 1:45:47 AM UTC-5, 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:
>>
>> 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 [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
--- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to