Hi,
I am writing to ask if a behavior that I find strange is a bug or
intended? In the latter case I would like to learn why is it so.
In the REPL I see the following, that I think is OK:
user=> (def test-data (lazy-seq [(str ["ZiZi"])]))
#'user/test-data
user=> test-data
("[\"ZiZi\"]")
Howe
Lazy sequences cache their values after the first time they are evaluated.
Since print alters the output of str by binding *print-readably* to false, and
also forces the sequence to realize itself, the values in your sequence are now
cached the the result of str without *print-readably*. In subs
Oups, nevermind what I said. str just delegates to .toString and doesn't use
*print-readably*. Hum, that is a bit strange then.
--
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 p
my simplified reproduction of the issue:
+user=> (let [mk-str (fn [] (lazy-seq [(str ["ZiZi"])]))
a (mk-str)
b (mk-str)]
(print-str a)
(pr-str b)
[a b])
[("[ZiZi]") ("[\"ZiZi\"]")]
isn't *print-readably* the difference between pr-str and p