Yet another question, this time just a curiosity.  Sorry for the
plethora of posts, but I'm trying to make sure I understand lazy seqs
properly.

Why doesn't (count (doall (range 10000000000))) cause an out-of memory
error?  doall says it causes the entire seq to reside in memory at one
time, yet:

user> (count (range 100000000))  ; uses no memory, as expected
100000000
user> (count (doall (range 100000000))) ; still uses no memory!?
100000000
user> (count (doall (range 500000000))) ; even bigger, still no heap
growth
500000000
user> (count (doall (map identity (range 100000000)))) ; now as
expected
; Out of memory

Thanks,
Jason
--~--~---------~--~----~------------~-------~--~----~
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
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