Closed pron closed 11 years ago
Possibly requires a suspendable implementation of LazySeq. Certainly one of take.
This turned out to be harder than expected. The problem wasn't that the bodies of the lazy-seq
s in, say, filter
and map
, are not suspendable. Actually, resuming them would have been fine. The only functions that really required instrumentation are those that recur like doall
.
The problem was much more incidental. First, the lazy-seq
macro tags the function with :once
which causes refs to closure to nullify during first call. This means that upon resumption (or re-run) the function wouldn't run properly. However, a message on the clojure mailing lists says that the :once
tag on lazy-seq is unnecessary. So that's just unfortunate. This resulted in the need to redefine lazy-seq
as well as the functions using it.
The second problem was in the LazySeq
class itself. The function seq
nullifies sv
before looping on ls
. If it had only nullified it later, it would have been fine (because suspension happens in sval()
). This resulted in the need to define a new LazySeq
class.
Also, see #2 .