换行符后边的空格(即缩进)是将漂亮的输出格式化的关键。逗号与换行符之间的空格是多余的。
与Clojure比较
λ clj -M -r
Clojure 1.11.1
user=> (require '[clojure.pprint :refer [pprint *print-right-margin*]])
nil
user=> (prn (with-out-str (binding [*print-right-margin* 20] (pprint {:a 1 :b 2 :c 3 :d 4}))))
"{:a 1,\n :b 2,\n :c 3,\n :d 4}\n"
nil