• (find-first pred coll)
Returns the first item of coll for which (pred item) returns logical true.
Consumes sequences up to the first match, will consume the entire sequence
and return nil if no match is found.

1 Example top

  • Clojure=> (find-first even? '(1 3 5 6 7 8))
    6
    
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/seq_utils.clj:184 top

(defn find-first
  "Returns the first item of coll for which (pred item) returns logical true.
  Consumes sequences up to the first match, will consume the entire sequence
  and return nil if no match is found."
  [pred coll]
  (first (filter pred coll)))
Vars in clojure.contrib.seq-utils/find-first: defn filter first
Used in 0 other vars

Comments top

No comments for find-first. Log in to add a comment.