One of the nice things about overloading first is you could always just tell people that the one argument version of first is like saying: (first identity coll) even though the actual implementation wouldn't need to bother with it.
The problem comes when you consider if we have a predicate-first, then people will start wanting other functions that do the same thing. Is (ffirst even? coll) the same as (first even? (first coll)) or (first (first even? coll)) what about (rest even? coll) ? Despite all these issues, I still like the idea of a predicate-first. On Mon, Mar 16, 2009 at 1:07 PM, e <evier...@gmail.com> wrote: > Rich didn't chime in about the overload of 'first', which probably means > that's out. find-first is better than ffirst, but it's not really accurate, > IMO. You don't have to "find" it. it's just the first one for which the > predicate is true. (get-first ... ) has one less letter than (find-first > ...) but there's probably some other problem with that. (first ...) is the > most genius to me if you step back from historical ties ... and newbies like > me have the best chance of discovering it. But keep in mind, I'm just > casually following the discussions right now -- not working in clojure at > the moment. > > On Mon, Mar 16, 2009 at 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 -~----------~----~----~----~------~----~------~--~---