title: How to filter a sequence and retain evaluated pred values?
body: <p>This is a scenario I encountered many times, yet didn't find an idiomatic approach for it...</p>
  
  <p>Suppose one would like to use a self-defined <code>self-pred</code> function to filter a seq. This <code>self-pred</code> function returns <code>nil</code> for unwanted elements, and useful information for wanted elements. It is desirable to keep the evaluated <code>self-pred</code> values for these wanted elements.</p>
  
  <p>My general solution is:</p>
  
  <pre><code>;; self-pred is a pred function which returns valuable info
  ;; in general, they are unique and can be used as key
  (let [new-seq (filter self-pred aseq)]
     (zipmap (map self-pred new-seq) new-seq))
  </code></pre>
  
  <p>Basically, it is to call <code>self-pred</code> twice on all wanted elements. I feel it is so ugly...</p>
  
  <p>Wonder if there is any better ways. Much appreciated for any input!</p>