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

The cat and mapcat transformers do not pass on the reduced status #23

Open
odf opened this issue Oct 28, 2014 · 0 comments
Open

The cat and mapcat transformers do not pass on the reduced status #23

odf opened this issue Oct 28, 2014 · 0 comments

Comments

@odf
Copy link

odf commented Oct 28, 2014

Thanks for this fantastic library. I've noticed a little problem with cat (and consequently with mapcat) that is demonstrated in the following gist: https://gist.github.com/odf/ae937c46f7f95e9e4e57

The issue here is that the step method of the internal transformer used within Cat#step unwraps (derefs) a reduced value, but in fact should put an extra wrapper around it, due to the fact that one will be removed by the reduce call in Cat#step. This means that effectively in a composed transformer, an inner take or takeWhile will be ignored by an outer mapcat, and we loose part of the ability to deal sanely with things like 'infinite' lazy seqs or channels.

The fix is very small, but I'm happy to prepare a pull request if you like.

PS: I had to cheat and look up the proper handling of reduced values in cat in the Clojure implementation.

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