While fibs is a nice small example, it is not idiomatic Clojure.
Pointing the fibs var to the head of the list keeps the whole list in
memory as it realizes. Better is to expose fibs as a *function* return
the sequence, so the head is not retained.
(defn fibo []
(map first (iterate (fn [[
cool - thanks guys for the detailed reply. crystal clear now -:)
Thx
swaroop
--~--~-~--~~~---~--~~
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
Swaroop,
> Just started learning clojure recently - initial examples were easy to
> understand, until I found this example
>
> fibonacci sequence using lazy-cat :
> (def fibs (lazy-cat [0 1] (map + fibs (rest fibs
>
> I am trying to understand how this works ..not su
Hi swaroop,
2009/7/29 swaroop belur :
>
> fibonacci sequence using lazy-cat :
> (def fibs (lazy-cat [0 1] (map + fibs (rest fibs
>
> I am trying to understand how this works ..not sure i fully comprehend
> it.
>
> Can anyone please explain how clojure evaluates thi
Hello all,
Just started learning clojure recently - initial examples were easy to
understand, until I found this example
fibonacci sequence using lazy-cat :
(def fibs (lazy-cat [0 1] (map + fibs (rest fibs
I am trying to understand how this works ..not sure i fully comprehend
it.
Can