On Dec 6, 8:38 pm, puzzler <[EMAIL PROTECTED]> wrote:
> Maybe LazyCons shouldn't cache.  Make LazyCons something that executes
> its function every time.  For most things, it's not a problem because
> sequences are often traversed only once.  If a person wants to cache
> it for multiple traversals, he can explicitly call cache-seq on it.

Is caching really the problem here? I'm curious.

Looking at LazyCons.java, I see that it uses an IFn "f" generate the
rest, and saves the value (a seq) in _rest. I assume that the function
f is what is actually holding a reference to the whole collection (it
may actually be the version of the function that the _rest contains,
but I'll get there in a moment). At this point, once we have a value
for _first and _rest, it doesn't seem like there's any value to having
a reference to f. The code seems to agree with me, because once _rest
has been set, it sets f to null.

However, clearly there is still a problem here, based on all the
different code samples in the thread which exhibit the bad behavior.
I'm just not sure which of our analyses are correct yet, either.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to