On 9 Mrz., 16:34, Stuart Sierra <the.stuart.sie...@gmail.com> wrote:
> On Mar 8, 3:20 pm, André Thieme <splendidl...@googlemail.com> wrote:
>
> > I regularily stumble upon the (first (filter predicate coll)) pattern.
> > Maybe we can add a filter1 for that?
> > In the Clojure project itself I found this two times, in core.clj for
> > the ns macro,
> > and in genclass.clj in find-field.
> > Also in the clojure-contrib project it shows up two times (again in
> > the core.clj
> > of Clojure for CLR, and in clojurescript.clj).

> I do use this pattern, but if I were naming it I think I'd call it
> "find-first".  But that's scarcely shorter than "(first (filter ...)",
> which is why I've never actually defined it.

Yesterday someone else suggested to eliminate the (first (filter ..))
pattern. In Common Lisp it is called FIND. But that is already taken.
I agree with you that find-first is not really much easier. It reduces
indeed some complexity, as it eliminates one level of nesting, but to
make it useful it would need a short name.
Christophe Grand suggest (seek ...), which I personally like.
--~--~---------~--~----~------------~-------~--~----~
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