Well, in case someone else needs the same function and it isn't built-
in, here's what I'm using in the meantime.  (Based off of the some
function that comes in core...)

(defn find-first [pred coll]
  (when (seq coll)
    (if (pred (first coll))
      (first coll)
      (recur pred (rest coll)))))

Cheers,
Jeff

On Feb 10, 5:18 pm, Jeff Rose <ros...@gmail.com> wrote:
> Hi,
>   Is there a built-in function that will return thefirstitemin a
> collection that matches a predicate?  (Something equivalent to Ruby's
> Enumerable#find...)  Seems pretty basic, but I can'tfindit in the docs.
>
> Thanks,
> Jeff
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to