Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. cuttingSum :: Num a => [a] -> [a]
  2. cuttingSum l =
  3. let
  4. cuttingSum_iter [] res = reverse (res)
  5. cuttingSum_iter ll res =
  6. cuttingSum_iter (tail ll) ((foldl (+) 0 ll) :: res)
  7. in
  8. cuttingSum_iter l []
  9.  
  10.  
  11. main = do
  12. print $ cuttingSum [1,2,3]
  13.  
  14. ERROR "task9-02-1.hs":5 - Inferred type is not general enough
  15. *** Expression : foldl (+) 0 ll
  16. *** Expected type : a
  17. *** Inferred type : _26
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement