On Feb 23, 2009, at 11:43 AM, Stuart Halloway wrote:

Also, the current 'fibs' implementation in clojure.contrib.seq fails
the test above, because it holds the entire sequence as it goes. We
should replace it with whatever the community comes up with on this
thread.

The fibs implementation in clojure.contrib.lazy-seqs is not a function that returns fib(n) given n. Instead, it is an infinite sequence of all the fibonacci numbers. It holds onto its head because it's intended to. It's surely not the right way to deal with fibonacci numbers in every context, but I don't think it needs replacing because it requires a large java heap to pass this test:

        (rem (nth clojure.contrib.lazy-seqs/fibs 1000000) 1000)
        -> 875

I think defining a fib(n) function somewhere in contrib or core that operates as efficiently as we can manage would be a good idea.

--Steve

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to