Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132937 views
License: OTHER
1
summer :: [Int] -> Int
2
summer = foldr (-) 0
3
4
summel :: [Int] -> Int
5
summel = foldl (-) 0
6
7
main :: IO ()
8
main = do
9
print (summer [1,2,3])
10
-- 0-(1-(2-3)) = 0-(1-(-1)) = 2
11
print (summel [1,2,3])
12
-- ((0-1)-2)-3 = -6
13