I share your concern about the LazyCons problem - hopefully Rich and
others are looking into this.
I have continued to experiment to see if I can gain some understanding
that might help with a solution.
The following is something I thought of today, and I'd like to see if
others get the same result:
(defmacro my-lzy-cons
"lazy cons by proxy"
[fbody rbody] `(proxy [clojure.lang.ISeq] []
(first [] ~fbody)
(rest [] ~rbody)
(seq [] ~'this)))
(defn my-map
"not fully a replacement for map, but enough to test splode"
[f coll] (when (seq coll)
(my-lzy-cons (f (first coll)) (my-map f (rest coll)))))
(defn my-splode [n]
(doseq [i (filter #(= % 20) (my-map inc (range n)))]))
my-splode does not blow the heap for me with (my-splode 10000000);
(splode 10000000) does.
my-lzy-cons appears to be slow compared to LazyCons, so this probably
isn't a solution, but perhaps this will give someone some insight to
help improve LazyCons.
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---