pprint

added
1.2

ns
clojure.pprint

type
function

(pprint object) (pprint object writer)

Pretty print object to the optional output writer. If the writer is not provided, 
print the object to the currently bound value of *out*.

                (def *map* (zipmap 
               [:a :b :c :d :e] 
               (repeat 
                 (zipmap [:a :b :c :d :e] 
                    (take 5 (range))))))
;;=> #'user/*map*
*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}}

(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

            
                ;; suppose you want to pretty print to a file.
(clojure.pprint/pprint *map* (clojure.java.io/writer "foo.txt"))
;; writes the contents of *map* to a file named 'foo.txt'
            
                ;; pprint into a string using with-out-str
(with-out-str (clojure.pprint/pprint {:x 1 :y -1}))
;; => "{:x 1, :y -1}\
"

;; pprint into a string using StringWriter
(let [out (java.io.StringWriter.)]
  (clojure.pprint/pprint {:a 1 :b 2} out)
  (clojure.pprint/pprint {:c 3 :d 4} out)
  (.toString out))
;; => "{:a 1, :b 2}\
{:c 3, :d 4}\
"

            
                ;;how to use it with :require and :use

;; :require 
(ns example.pprinter
   (:require [clojure.pprint :as pp]))

(def myname "John Smith")
(pp/pprint myname)

--------------

;;:use
(ns example.pprinter
    (:use clojure.pprint))

(def myname "John Smith")
(pprint myname)