Skip to content

Instantly share code, notes, and snippets.

@pepijndevos
Created May 23, 2012 09:54
Show Gist options
  • Select an option

  • Save pepijndevos/2774339 to your computer and use it in GitHub Desktop.

Select an option

Save pepijndevos/2774339 to your computer and use it in GitHub Desktop.
(defn fib-seq [a b]
(lazy-seq (cons a (fib-seq b (+ a b)))))
(defn ratio [s n]
(apply / (reverse (take 2 (drop n s)))))
;> (double (ratio (fib-seq 0 1) 100))
;1.618033988749895
;> (double (ratio (fib-seq 200 7) 100))
;1.618033988749895
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment