(defn
explain-printer
"Default printer for explain-data. nil indicates a successful validation."
[ed]
(if
ed
(let
[problems
(sort-by
(fn* [p1__18550#] (- (count (:path p1__18550#))))
(:clojure.core/problems ed))]
(print
(with-out-str
(doseq
[{:keys [path pred val reason via in], :as prob} problems]
(when-not (empty? in) (print "In:" (pr-str in) ""))
(print "val: ")
(pr val)
(print " fails")
(when-not (empty? via) (print " spec:" (pr-str (last via))))
(when-not (empty? path) (print " at:" (pr-str path)))
(print " predicate: ")
(pr (abbrev pred))
(when reason (print ", " reason))
(doseq
[[k v] prob]
(when-not
(#{:path :pred :via :val :reason :in} k)
(print "\n\t" (pr-str k) " ")
(pr v)))
(newline))
(doseq
[[k v] ed]
(when-not
(#{:clojure.core/problems} k)
(print (pr-str k) " ")
(pr v)
(newline))))))
(println "Success!")))