Created
February 23, 2018 17:27
-
-
Save LVMBDV/585e93ac790e83acf23966b54de34551 to your computer and use it in GitHub Desktop.
This file contains 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
(defn fib | |
([] (fib 1 1)) ; start with x = y = 1 | |
([x y] (lazy-seq (cons x (fib y (+ x y)))))) ; x = y and y = x + y | |
(println (reduce + (filter even? | |
(take-while #(< % 4000000) (fib))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment