Created
August 10, 2018 21:16
-
-
Save mvaldesdeleon/b5ae2bcabc7b81442ad38224a8363967 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fibs :: Num a => [a] | |
fibs = 0 : 1 : zipWith (+) fibs (tail fibs) | |
isEven :: Integral a => a -> Bool | |
isEven x = x `mod` 2 == 0 | |
main :: IO () | |
main = print $ takeWhile (\x -> x <= 4000000) (filter isEven fibs) | |
-- [0,2,8,34,144,610,2584,10946,46368,196418,832040,3524578] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment