On Feb 10, 11:18 am, Jeff Rose <ros...@gmail.com> wrote:
>   Is there a built-in function that will return the first item in a
> collection that matches a predicate?  (Something equivalent to Ruby's
> Enumerable#find...)  Seems pretty basic, but I can't find it in the docs.

Hi, Jeff, here's how I do it:

user> (def numbers [2 4 6 7 8 9])
#'user/numbers
user> (some #(when (odd? %) %) numbers)
7

-Stuart Sierra
--~--~---------~--~----~------------~-------~--~----~
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