Summing a large list of numbers is too slow

前端 未结 0 679
深忆病人
深忆病人 2021-02-15 19:26

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

Haskell:

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

MySum:: Int
MySum= sum $ take 1500000         


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