Greatest subsequential sum: Difference between revisions
m
→{{header|Haskell}}: Reduced two nested `where` expressions to a single `let in` with a `<*>`
(→Functional Python: pylinted for Python 3, added {Works with} tag) |
m (→{{header|Haskell}}: Reduced two nested `where` expressions to a single `let in` with a `<*>`) |
||
Line 1,433:
Secondly, the linear time constant space approach:
<lang haskell>maxSubseq :: [Int] -> (Int, [Int])
maxSubseq =
let go x ((h1, h2), sofar) =
in snd . foldr go ((0, []), (0, []))
main :: IO ()
|