Re: greatest and least

2009-01-26 Thread Mark Engelberg
I personally don't think I'd use the functions that return more than one min/max. I think in such contexts, I'm usually more interested in just sorting the whole collection. So I'd be happy just with the ones that return one result. --~--~-~--~~~---~--~~ You rece

Re: greatest and least

2009-01-26 Thread Vincent Foley
Chouser asked me Saturday night if it would be possible to reduce the number of functions in the module. I looked at the problem, and if we want to keep the two sets of functions (returning one element and returning many elements), idiomatically, it seems like all the functions will have to stay:

Re: greatest and least

2009-01-24 Thread Vincent Foley
I've worked on the library today, and imported it into a GitHub project: http://github.com/gnuvince/clojure-greatest-least/tree/master I've added a variation of all four functions that returns all the greatest/least elements as well as a small test suite. Could this be an interesting addition to

Re: greatest and least

2009-01-21 Thread Jason Wolfe
I support something like this. Also maybe see my "maximal-elements" here: http://groups.google.com/group/clojure/browse_thread/thread/134642cc76de17f7?hl=en# A nice feature of getting all the maximal elements is you can do (first (maximal-elements ...)) to recreate functions like yours but also

greatest and least

2009-01-21 Thread Vincent Foley
A couple months ago, there was a discussion in this group about the functions max and min and making them work with data types other than numbers. I was toying around tonight, and I wrote the following functions. (defn- boundary [compare-fn f & args] (reduce (fn [a b] (if (compare-fn (compar