What is the most idiomatic way to write a data structure to disk in Clojure, so I can read it back with edn/read? I tried the following, as recommended in the Clojure cookbook:
(with-open [w (clojure.java.io/writer "data.clj")]
(binding [*out* w]
(pr large-data-structure)))
However, this will only write the first 100 items, followed by "...". I tried (prn (doall large-data-structure))
as well, yielding the same result.
I've managed to do it by writing line by line with (doseq [i large-data-structure] (pr i))
, but then I have to manually add the parens at the beginning and end of the sequence to get the desired result.