Pretty print object to the optional output writer. If the writer is not provided,
print the object to the currently bound value of *out*.
user=> (def *map* (zipmap
[:a :b :c :d :e]
(repeat
(zipmap [:a :b :c :d :e]
(take 5 (range))))))
#'user/*map*
user=> *map*
{:e {:e 4, :d 3, :c 2, :b 1, :a 0}, :d {:e 4, :d 3, :c 2, :b 1, :a 0}, :c {:e 4, :d 3, :c 2, :b 1, :a 0}, :b {:e 4, :d 3, :c 2, :b 1, :a 0}, :a {:e 4, :d 3, :c 2, :b 1, :a 0}}
user=> (clojure.pprint/pprint *map*)
{:e {:e 4, :d 3, :c 2, :b 1, :a 0},
:d {:e 4, :d 3, :c 2, :b 1, :a 0},
:c {:e 4, :d 3, :c 2, :b 1, :a 0},
:b {:e 4, :d 3, :c 2, :b 1, :a 0},
:a {:e 4, :d 3, :c 2, :b 1, :a 0}}
nil
(defn pprint
"Pretty print object to the optional output writer. If the writer is not provided,
print the object to the currently bound value of *out*."
{:added "1.2"}
([object] (pprint object *out*))
([object writer]
(with-pretty-writer writer
(binding [*print-pretty* true]
(binding-map (if (or (not (= *print-base* 10)) *print-radix*) {#'pr pr-with-base} {})
(write-out object)))
(if (not (= 0 (get-column *out*)))
(prn)))))
Comments top
No comments for pprint. Log in to add a comment.