title: What's the idiomatic way to keep track of previous values in clojure?
body: <pre><code>(defmethod learn [:SARSA :Module] [learner module] 
    (let [samples (get learner :dataset)]  
      (for [seq samples]
        (let [laststate (atom 0) lastaction (atom 0) lastreward (atom 0)])
         ;;Do some stuff
         ;;Update laststate,lastaction,lastreward
  
        )
  
      ))
  </code></pre>
  
  <p>Im using a for loop to iterate through a sequence but perhaps I should use a regular loop and recur? Would a map/reduce be useful here?</p>