I've literally tried all the variations of fibonaci sequences i could
find! all of them throw an ArithmeticException integer overflow
clojure.lang.Numbers.throwIntOverflow (Numbers.java:1388)
as soon as I try more than 94 elements!
my favourite version is this (from Christophe Grand ):
(defn fibo-seq "Generates a lazy-seq of all the Fibonacci numbers or up
to a certain limit."
([] (map first (iterate (fn fib-step [[a b]] [b (+ a b)]) [0 1])))
([limit] (take-while #(> limit %) (fibo-seq))))
Since Clojure prefers longs to ints and since I'm not using any type
hints, I don't understand why I get an integer overflow...
any ideas?
Jim
ps: this is not 'important', I'm just messing about...
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.