How do I remove from a nested datastructure the objects whose (pr obj) 
representation doesn't comply with the EDN specification? Fx, 
{:a 1 :b (find-ns 'user)} → {:a 1}
Or, easier, how do I just not print these objects?

I want to extract the metadata maps from arbitrary Clojure objects and 
write them to files. Metadata maps allow arbitrary objects as keys and 
values. Of course I want to be able to read the files again, preferably 
with clojure.edn/read. I am aware that the Clojure printing system is 
extensible and therefore it's not possible to define a sensible predicate 
like (re-readable? x). So I was looking for a way to convince the printing 
system just to ignore objects that would otherwise end up with a #< in the 
output. I didn't find any.

What I found was this: 
http://dev.clojure.org/pages/viewpage.action?pageId=8192126 and tried out 
Fipp, but it also just prints out #< objects. The 
(assert (= (clojure.edn/read-string (pr-str value)) value))
might work. But it's extremely ugly and probably also slow. For nested data 
structure I'd expect it to get even uglier. Hmm, on second glance, I might 
be able to extend Fipp to do what I want. Still, I'd appreciate any other 
ideas.

Richard

-- 
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/d/optout.

Reply via email to