Permalink
Browse files

Factor out mod into a divisible function

  • Loading branch information...
1 parent 4bee43e commit 1be9ebe4a739c19e92cfe244989f854629724d49 @dkubb committed Feb 2, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 001/comprehension.hs
View
@@ -1,3 +1,5 @@
main = print answer
-answer = sum [ n | n <- [ 1..999 ], mod n 3 == 0 || mod n 5 == 0 ]
+answer = sum [ n | n <- [ 1..999 ], divisible n 3 || divisible n 5 ]
+ where
+ divisible n d = mod n d == 0

0 comments on commit 1be9ebe

Please sign in to comment.