mps :: [Int] -> Int mps xs = maximum $ do ys <- inits xs ; return $ sum ys
zur Darstellung durch fold(l/r): benutze
mpss :: [ Int ] -> ( Int, Int ) mpss xs = ( mps xs, sum xs )
Bestimme
mpss (x : xs)
aus mpss xs
ergibt mpss = foldr ...
mpss (xs ++ [x])
aus mpss xs
ergibt mpss = foldl ...
mpss = foldb ...