title: Periodically calling a function in Clojure
body: <p>I'm looking for a very simple way to call a function periodically in Clojure.</p>
  
  <p>JavaScript's <a href="https://developer.mozilla.org/en/docs/Web/API/window.setInterval" rel="noreferrer"><code>setInterval</code></a> has the kind of API I'd like. If I reimagined it in Clojure, it'd look something like this:</p>
  
  <pre><code>(def job (set-interval my-callback 1000))
  
  ; some time later...
  
  (clear-interval job)
  </code></pre>
  
  <p>For my purposes I don't mind if this creates a new thread, runs in a thread pool or something else. It's not critical that the timing is exact either. In fact, the period provided (in milliseconds) can just be a delay between the end of one call completing and the commencement of the next.</p>