Should max and min have 0-arg implementations?

2010-07-09 Thread Aaron Cohen
I noticed that http://clojure-examples.appspot.com/clojure.core/max has both (apply max [1 2 3 4]) - 4 and (max []) - [] (which I think is a poor example). However, when attempting to add another example for (apply max []) which I expected to return nil, that instead it throws an exception. I

Re: Should max and min have 0-arg implementations?

2010-07-09 Thread Stuart Halloway
Once you walk down the path of What should (max) return? I think you won't want a default behavior. Stu P.S. Agreed that (max []) is a bad example. I noticed that http://clojure-examples.appspot.com/clojure.core/max has both (apply max [1 2 3 4]) - 4 and (max []) - [] (which I think is a

Bug in 1-arg max/min implementation? (Was: Should max and min have 0-arg implementations?)

2010-07-09 Thread Mike Meyer
On Fri, 9 Jul 2010 13:57:05 -0400 Stuart Halloway stuart.hallo...@gmail.com wrote: Once you walk down the path of What should (max) return? I think you won't want a default behavior. Stu P.S. Agreed that (max []) is a bad example. Given that max only works on numbers, then why doesn't

Re: Bug in 1-arg max/min implementation? (Was: Should max and min have 0-arg implementations?)

2010-07-09 Thread Mark Engelberg
Given that max only works on numbers, then why doesn't (max []) throw the same exception as (max [] [])? Or, for that matter, (max \a) throw the same exception as (max \a \b \c)? Clojure tends not to guarantee any particular behavior for invalid inputs. It might return an error, or it might