pprint prints some metadata when *print-meta* bound to true, but not all


  • Type: Defect Defect
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: Release 1.6
  • Fix Version/s: None
  • Component/s: None
  • Labels:


Short example illustrating the behavior:

user=> *clojure-version*
{:major 1, :minor 6, :incremental 0, :qualifier nil}

user=> (def f1 '(defn foo [^Integer x] ^{:bar 8} (inc x)))

;; pr shows all metadata, as expected

user=> (binding [*print-meta* true] (pr f1))
^{:line 2, :column 10} (defn foo [^Integer x] ^{:bar 8, :line 2, :column 33} (inc x))nil

;; pprint shows some metadata, but not all

user=> (binding [*print-meta* true] (clojure.pprint/pprint f1))
(defn foo [^Integer x] (inc x))

I have not dug into the details yet, but it appears that this may be because pprint uses pr to show symbols, but not to show collections. Thus pprint shows metadata on symbols, but not collections.

It would be nice if pprint could instead show all metadata, as pr does, when print-meta is bound to true.


Andy Fingerhut made changes -
Field Original Value New Value
Attachment clj-1445-workaround-v1.clj [ 13074 ]
Andy Fingerhut made changes -
Attachment clj-1445-workaround-v2.clj [ 13075 ]
Andy Fingerhut made changes -
Attachment clj-1445-workaround-v1.clj [ 13074 ]
Alex Miller made changes -
Labels print


Vote (5)
Watch (3)


  • Created: