minimumBy and maximumBy

Koen Claessen koen@cs.chalmers.se
Fri, 5 Apr 2002 13:56:05 +0200 (MET DST)


Dear all,

Has anyone ever noticed that the functions 'maximumBy' and
'minimumBy' from the Prelude are really the same function?
Both are defined as:

  maximumBy, minimumBy :: (a -> a -> a) -> [a] -> a
  maximumBy max xs = foldl1 max xs
  minimumBy min xs = foldl1 min xs

Is there any reason for this?

Regards,
/Koen.

--
Koen Claessen
http://www.cs.chalmers.se/~koen
Chalmers University, Gothenburg, Sweden.