title: What is the "Correct" way to write an EDN file in Clojure as of August 2013?
body: <p>I would like to write out an EDN data file from Clojure as tagged literals. Although the <a href="http://clojure.github.io/clojure/clojure.edn-api.html" rel="noreferrer">clojure.edn</a> API contains <code>read</code> and <code>read-string</code>, there are no writers. I'm familiar with the issue reported <a href="http://dev.clojure.org/jira/browse/CLJ-1201" rel="noreferrer">here</a>. Based on that, it's my understanding that the <code>pr</code> and <code>pr-str</code> functions are what are meant to be used today.</p>
  
  <p>I wanted to check with the StackOverflow community to see if something like the following would be considered the "correct" way to write out an EDN file:</p>
  
  <pre><code>(spit "friends.edn" (apply str 
    (interpose "\n\n"
               [(pr-str (symbol "#address-book/person") {:name "Janet Wood"})
                (pr-str (symbol "#address-book/person") {:name "Jack Tripper"})
                (pr-str (symbol "#address-book/person") {:name "Chrissy Snow"})])))
  </code></pre>
  
  <p>If you are using EDN in production, how do you write out an EDN file? Similar to the above? Are there any issues I need to look out for?</p>
  
  <h1>Update</h1>
  
  <p>The Clojure Cookbook entry, <a href="https://github.com/clojure-cookbook/clojure-cookbook/blob/first-edition/04_local-io/4-16_edn-record.asciidoc" rel="noreferrer">"Emitting Records as EDN Values"</a> contains a more thorough explanation of this issue and ways to handle it that result in valid EDN tags.</p>