Shouldn't this return nil ? : 1:4 user=> (find-first-result false? [true]) false
Maybe this definition of find-first-result may fill the gap: (defn find-first-result [pred coll] (find-first identity (map pred coll))) => 1:22 user=> (find-first-result false? [true]) nil 1:23 user=> (find-first-result #(when (= % 10) (* % %)) (range 20)) 100 1:24 user=> (find-first-result #(when (= % 10) (* % %)) (range 9)) nil HTH, -- Laurent 2009/4/27 Mark Volkmann <[email protected]>: > > find-first in seq_utils returns the first item in a collection where > (pred item) returns logical true. I needed a function that returns the > result of (pred item) instead of item. This seems to do the trick. > Maybe this should be added to seq_utils. > > (defn find-first-result [fn coll] > (first (filter #(not (nil? %)) (map fn coll)))) > > -- > R. Mark Volkmann > Object Computing, Inc. > > > > -- Cordialement, Laurent PETIT --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---
