Chris, nice use of custom dispatch! I can't claim all the credit for
this mechanism. I based my work on the old XP system that has been
used in Lisp since the eighties. Standing on the shoulders of giants,
as it were. :)
It's been on my list to respect *print-meta* in the regular pprint
dispatch,
Good catch! I was about to add this to my personal toolkit of "generally
useful random crap" (every programmer has one of those, right?). I'll make
sure to cover that edge-case. Thanks.
- Chris
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To
Yeah, but it won't quite work if even the metadata has metadata.
user=> (def x (with-meta {:b 1} (with-meta {:a 1} {:x 1})))
#'user/x
user=>
x
{:b 1}
user=>
(meta x)
{:a 1}
user=>
(meta (meta x))
{:x 1}
The code above would leave out the metadata {:x 1} on {:a 1}, though
it should display the m
Cool. :) Good to hear, that things are working. Nice to have around.
Meikel
--
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 patie
By looking at pprint.clj, I have come up with something that seems to work.
No "hacking" is necessary - the code in pprint is impressively clear and
extensible. It's obviously designed to allow exactly this sort of
extension to the printing mechanism.
user> (defn ppm [obj]
(let [orig-d
Hi,
I don't know a built-in way. But that doesn't mean, that there isn't one.
You could ask Tom Faulhaber directly. He did the pretty print stuff.
Sincerely
Meikel
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to
Thanks Meikel.
So I guess from your reply that there is no built-in way to do this, right?
The objects I'm trying to inspect can be deeply nested maps and vectors,
and I want to see all the metadata - not just on the root object. I guess
I would have to either re-implement some of the logic o
Hi,
how about something like this?
(defn pprint-with-meta
[thing]
(when (instanceof? IMeta thing)
(print "^")
(pprint (meta thing))
(print " "))
(pprint thing))
Sincerely
Meikel
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To p
Is there a way to pretty-print an object with its metadata?
If I (set! *print-meta* true) at the REPL, I can see the metadata. If I
use (pprint thing), I can see the structure much more easily. How can I do
both?
- Chris
--
You received this message because you are subscribed to the Google