title: Clojure - more idiomatic to return a closure, or partially apply the function?
body: <p>I'm using an external library, and passing it a function that I write.  Something like this, for example:</p>
  
  <p><code>(ext-func my-func) ...</code></p>
  
  <p><code>my-func</code> needs to be given some data to do computation.  The way I see it, I have two basic choices:</p>
  
  <p>1) Write <code>my-func</code> in such a way that it accepts my data, and returns a function, which will then have the data bound to it via closure when the external library calls it.  For example:</p>
  
  <pre><code>(defn my-func
    [mydata]
    (fn []
      (... access to mydata via closure ... )))
  
  (ext-func (my-func somedata))
  </code></pre>
  
  <p>2) Do not return a function from <code>my-func</code>, but bind data to it when I pass it to <code>ext-func</code>:</p>
  
  <pre><code>(defn my-func
    [mydata]
    (... evaluate, use mydata, etc.))
  
  (ext-func (partial my-func somedata))
  </code></pre>
  
  <p>I suppose which one to use could be answered by how I intend to use the function otherwise.  If I'm going to be using it other places, I may prefer not to return a function, for example.  But, all other things being equal...</p>
  
  <p><strong>...which of these is the more idiomatic approach?</strong></p>