Summing a large list of numbers is too slow

前端 未结 0 1842
野性不改
野性不改 2021-02-15 19:21

Task: \"Sum the first 15,000,000 even numbers.\"

Haskell:

nats = [1..] :: [Int]
evens = filter even nats :: [Int]

MySum:: Int
MySum= sum $ take 1500000         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题