[Haskell-cafe] Is this haskelly enough?
Shachaf Ben-Kiki
shachaf at gmail.com
Tue Jul 17 19:32:24 EDT 2007
> 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
More information about the Haskell-Cafe
mailing list