Created
January 28, 2013 20:01
-
-
Save thattommyhall/4658530 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
(def fibs | |
(map first (iterate (fn [[a b]] [b (+ a b)]) [1 1]))) | |
(defn fibs-from [n] | |
(drop-while #(< % n) fibs)) | |
(take 5 fibs) | |
; (1 1 2 3 5) | |
(take 5 (fibs-from 1000000000000)) | |
; (1548008755920 2504730781961 4052739537881 6557470319842 10610209857723) | |
(zipmap (range) (take 5 fibs)) | |
; {4 5, 3 3, 2 2, 1 1, 0 1} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment