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 [[a b]] [b (+ a b)]) [0 1])))

This and several inferior examples are demonstrated in the sample code  
for the book [1].

Cheers,
Stu

[1] http://bit.ly/Ew6It

> 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 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to