重现
;; print-method
user=> (binding [*print-level* 1]
(prn {:a 1 :b 2}))
{:a 1, :b 2}
nil
user=> (binding [*print-level* 1]
(prn {:a {:b 2}}))
{:a #}
nil
user=> (binding [*print-level* 1]
(prn [(clojure.lang.MapEntry. :a 1)
(clojure.lang.MapEntry. :b 2)]))
[# #]
nil
;; clojure.pprint
user=> (binding [*print-level* 1]
(clojure.pprint/pprint {:a 1 :b 2}))
{#, #}
nil
user=> (binding [*print-level* 1]
(clojure.pprint/pprint {:a {:b 2}}))
{#}
nil
user=> (binding [*print-level* 1]
(clojure.pprint/pprint
[(clojure.lang.MapEntry. :a 1)
(clojure.lang.MapEntry. :b 1)]))
[# #]
nil
关于*print-level*的文档字符串说:
如果一个对象是集合,并且处于大于或等于与print-level声明的值的级别,则打印机打印'#'来表示它。
映射条目是一个集合,在{:a 1, :b 2}中处于与*print-level*相等的级别,所以我预计prn的输出将与clojure.pprint相同。