For the monadically-challenged, this is equivalent, yes-no?
maxsubarrays = maximumBy (compare `on` sum) . concat . (map tails) .
inits
Or: maxsubarrays = maximumBy (compare `on` sum) . concatMap tails . inits
(>>=) for lists is just (flip concatMap).
Also, this is working with lists, not arrays -- maxsubarrays is
probably a misleading name.
Shachaf
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe