On Jul 17, 2007, at 7:10 PM, Bjorn Bringert wrote:

maxsubarrays = maximumBy (compare `on` sum) . (>>= tails) . inits

Though I avoided using the list monad in the first solution, since I thought it would make the code less understandable for a beginner.

I felt uncomfortable seeing this. Let me see if I can explain why. Isn't the use of monads here unnecessary and obscure? The use of inits, tails and maximumBy ground the function to a list representation. There seems no hope of generalizing it to other monads. The use of >>= is just an obscure way of saying (flip concatMap).

  ___________________
(---o-------o-o-o---o-o-o----(
David F. Place
mailto:[EMAIL PROTECTED]


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to