On Wednesday, November 26, 2014 3:30:10 AM UTC-5, Vladimir Bokov wrote:
>
> I really like that (pr some-hash-map) dumps structure which can be
> recognized by clojure reader like (def same-hash-map '..paste..here)
>
> Could it be achieved with defrecords? Currently (pr some-record) produced
> non-recognizable by clojure reader at all. (Btw. why so?)
>
> Could we do better? (e.g. using map->Record functions + hash-map's bodies)
>
> Is there any lib for that?
>
Use pr and edn/read:
(def edn-readers {'my_ns.MyRecord map->MyRecord})
(with-open [foo whatever-output-stream]
(binding [*out* foo]
(pr data-structure)))
(with-open [foo whatever-input-stream]
(edn/read {:readers edn-readers} foo))
--
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.