Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make channels lazy-seqs #1

Closed
pron opened this issue May 3, 2013 · 2 comments
Closed

Make channels lazy-seqs #1

pron opened this issue May 3, 2013 · 2 comments
Milestone

Comments

@pron
Copy link
Contributor

pron commented May 3, 2013

Also, see #2 .

@pron
Copy link
Contributor Author

pron commented May 6, 2013

Possibly requires a suspendable implementation of LazySeq. Certainly one of take.

@pron pron reopened this May 6, 2013
@pron pron closed this as completed in 565e4f1 May 8, 2013
@pron
Copy link
Contributor Author

pron commented May 8, 2013

This turned out to be harder than expected. The problem wasn't that the bodies of the lazy-seqs 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant