Last active
June 28, 2018 14:32
-
-
Save uwo/d702e3ceabd783ea7787afecdb0d470c to your computer and use it in GitHub Desktop.
pspit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:paths ["."]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns pspit) | |
(def improved-pprint (. clojure.pprint/simple-dispatch addMethod datomic.db.DbId #(.write *out* (str %)))) | |
(defn pformat | |
([data] (pformat data 72)) | |
([data print-right-margin] | |
(clojure.pprint/with-pprint-dispatch improved-pprint | |
(with-out-str | |
(binding [clojure.pprint/*print-right-margin* print-right-margin] | |
(clojure.pprint/pprint data)))))) | |
(defn pspit | |
([filename data] (spit filename (pformat data))) | |
([filename data print-right-margin] (spit filename (pformat data print-right-margin)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment