Anyone for "detect"?

(detect odd? primes) --> 3
(detect even? primes) --> 2
(detect even? (rest primes)) --> runs forever
(detect even? (rest one-million-primes)) --> nil

On Mar 16, 10:51 am, Laurent PETIT <laurent.pe...@gmail.com> wrote:
> Just to make me more enemies ;-), I would prefer, on the other hand,
> find-first over ffirst (I'm not that nostalgic of some Common Lisp-like
> abbreviations :-)
>
> No, really, ffirst is just 3 characters shorter than find-first, and looks
> like a typo at first glance.
>
> --
> Laurent
>
> 2009/3/16 André Thieme <splendidl...@googlemail.com>
>
>
>
>
>
> > On 16 Mrz., 13:14, Rich Hickey <richhic...@gmail.com> wrote:
> > > On Mar 14, 11:26 am, Stuart Sierra <the.stuart.sie...@gmail.com>
> > > wrote:
>
> > > > I've added a "seek" function to clojure.contrib.seq-utils:
>
> > > > (defn seek
> > > >   "Returns the first item of coll for which (pred item) returns
> > > > logical true.
> > > >   Consumes sequences up to the first match, will consume the entire
> > > > sequence
> > > >   and return nil if no match is found."
> > > >   [pred coll]
> > > >   (first (filter pred coll)))
>
> > > Sorry to jump in late, but one problem with seek is that it is a
> > > homophone of seq.
>
> > > Did anyone consider ffilter or find-first?
>
> > In that case I would vote for ffilter.
--~--~---------~--~----~------------~-------~--~----~
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