How can I print the intermediate values in a transient vector?
I tried this but the printed result is like this and it is not what I want
to see.
(let [v (transient [])]
(dotimes [n 3]
(conj! v n)
(println v)))
;; printed v
#object[clojure.lang.PersistentVector$TransientVector 0x162d8132
clojure.lang.PersistentVector$TransientVector@162d8132]
#object[clojure.lang.PersistentVector$TransientVector 0x162d8132
clojure.lang.PersistentVector$TransientVector@162d8132]
#object[clojure.lang.PersistentVector$TransientVector 0x162d8132
clojure.lang.PersistentVector$TransientVector@162d8132]
So I retried like this but failed with an exception.
(let [v (transient [])]
(dotimes [n 3]
(conj! v n)
(persistent! v)
(println v)))
IllegalAccessError Transient used after persistent! call
clojure.lang.PersistentVector$TransientVector.ensureEditable
(PersistentVector.java:548)
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/clojure/7a4ca9be-40a8-4f56-b9dc-0622855ae2e9o%40googlegroups.com.