Split list and make sum from sublist?
问题 im searching for a solution for my Haskell class. I have a list of numbers and i need to return SUM for every part of list. Parts are divided by 0. I need to use FOLDL function. Example: initial list: [1,2,3,0,3,4,0,5,2,1] sublist [[1,2,3],[3,4],[5,2,1]] result [6,7,7] I have a function for finding 0 in initial list: findPos list = [index+1 | (index, e) <- zip [0..] list, e == 0] (returns [4,6] for initial list from example) and function for making SUM with FOLDL: sumList list = foldl (+) 0