aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Wang2022-01-14 12:08:16 -0600
committerAnthony Wang2022-01-14 12:08:23 -0600
commit3a9fe78bb74d3a8482d746524d7c8f2876d8692f (patch)
treea29be51851614cd861f50382093f967699e30204
parent598287afd48b618316bfe38282c69e835b3aa706 (diff)
Haskell: use sum instead of foldl
-rw-r--r--test.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/test.hs b/test.hs
index 02ff588..127dc62 100644
--- a/test.hs
+++ b/test.hs
@@ -9,4 +9,4 @@ main = do
putStrLn "test"
let n = 1000
let a = [0..n-1]
- print $ foldl (+) 0 (map (\i -> foldl (+) 0 (map (`gcd` i) a)) a)
+ print $ sum (map (\i -> sum (map (`gcd` i) a)) a)