Skip to content

Instantly share code, notes, and snippets.

@staafl
Created July 31, 2016 18:19
Show Gist options
  • Save staafl/428a25fa5f745a3c0ca6209af2940009 to your computer and use it in GitHub Desktop.
Save staafl/428a25fa5f745a3c0ca6209af2940009 to your computer and use it in GitHub Desktop.
(defn problem26-fibs [x]
(let [fibs
((fn fibs [so-far]
(lazy-seq
(fibs
(cons (+ (first so-far) (second so-far)) so-far)
)))
'(1 1))]
(take x fibs)))
(user=> (problem26-fibs 1)
ArithmeticException integer overflow clojure.lang.Numbers.throwIntOverflow (Num
bers.java:1501)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment