I like that, that makes the code selfdescribing (is there such a word
in english?)

On Mar 14, 2:58 pm, Craig Andera <craig.and...@gmail.com> wrote:
> What about overloading first to accept a predicate?
>
> (first even? (iterate inc 1)) => 2
>
> On Sat, Mar 14, 2009 at 8:58 AM, e <evier...@gmail.com> wrote:
>
> >> Christophe Grand suggest (seek ...), which I personally like.
>
> > IMHO
> > seek is pretty good for a number of reasons: short, implies first result.
> > Minor objection would be that folks may not think it's what they want
> > because of how it's used in C where they'd expect it to take a number of
> > bytes and a block. (filter-one ...) or (find-first ...) are both ok to me
> > ... and preferable to (first (filter ...)) the latter being an idiom you
> > have to discover on your own.  Another very minor problem with the idiom is
> > that the docs say that filter returns a lazy sequence, but it doesn't say
> > that the order has to be the same as how the original sequence would be
> > consumed.  Having an actual function makes the concept of "first" concrete.
> > It unties it from filter having to be the implementation.
>
> > yeah (seek ...) is pretty good.
--~--~---------~--~----~------------~-------~--~----~
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