title: What is the idiomatic way to pop a PersistentQueue in a ref?
body: <p>Given a PersistentQueue in a ref:</p>
  
  <pre><code>(def pq (ref clojure.lang.PersistentQueue/EMPTY))
  </code></pre>
  
  <p>What is the idiomatic way to pop the queue and get the result?</p>
  
  <p>My best attempt for your critique:</p>
  
  <pre><code>(defn qpop [queue-ref]
      (dosync 
          (let [item (peek @queue-ref)]
            (alter queue-ref pop)
            item))
  </code></pre>
  
  <p>alter returns the in-transaction value of the queue which is popped already, so you can't just do the alter by itself.  </p>