We benchmarked the performance of the following two functions for various sequence types (and some other collection types):
(first (filter <pred> <coll>))
(first' (filter <pred>) <coll>)
wherefirst'
is defined as follows:(defn first' [xform coll] (transduce xform (completing (fn [_ x] (reduced x))) nil coll))