Hi Meikel,
this is funny! I thought about this approach but I originally considered
it to be a clever hack rather than the official way to do this...Since I
can't test it yet with my record , I hope you don't mind me asking
another question...
there is no need for print-dup bound to true here, right?
thanks a lot for your time :)
Jim
On 22/08/13 12:00, Meikel Brandmeyer (kotarak) wrote:
(defmethod print-method Foo
[foo ^Writer w]
(.write w "#my/foo ")
(print-method {:a (:a foo) :b (:b foo) :c (:c foo) :meta (meta foo)} w))
(defn foo-reader
[foo-data]
(with-meta (map->Foo (dissoc foo-data :meta)) (:meta foo-data)))
Read with:
(edn/read {'my/foo foo-reader} ...)
Printing might be optimised a bit. And the :meta key could be made
more robust. (records may contain arbitrary keys.)
--
--
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/groups/opt_out.