list comprehension haskell 001

master
Evan Hemsley 2020-10-27 00:53:01 -07:00
parent 177e937ccd
commit 1a6d7480ec
1 changed files with 1 additions and 3 deletions

View File

@ -1,6 +1,4 @@
module Main where
divisible_by_3_or_5 x = (mod x 3 == 0) || (mod x 5 == 0)
main = do
print (sum (filter divisible_by_3_or_5 [1..999]))
print $ sum [x | x <- [1..999], mod x 3 == 0 || mod x 5 == 0]