Skip to content
This repository was archived by the owner on Sep 1, 2020. It is now read-only.

Add a Concat Iterator #50

Closed
wants to merge 2 commits into from

Conversation

Keno
Copy link
Contributor

@Keno Keno commented Jun 25, 2015

If you have an iterator that returns iterators, it is to concat them into a single iterators. Alternatively, this might be named Flatten.

@StefanKarpinski
Copy link
Contributor

Is this similar to chain? cf JuliaLang/julia#11842

@Keno
Copy link
Contributor Author

Keno commented Jun 25, 2015

Yes, except you can pass an iterator itself, instead of a list of iterators, which is helpful if the toplevel iteration is expensive and/or stateful.

@ghost
Copy link

ghost commented Jul 1, 2015

I like it, but should we not export contact as opposed to Concat to be consistent with zip, enumerate, et al.?

@stevengj
Copy link

stevengj commented Jul 1, 2015

@Keno, shouldn't the chain implementation just take any iterator over iterators, then?

@stevengj
Copy link

stevengj commented Jul 1, 2015

Or maybe this should just be renamed to chain here if that is a more common name for this? Though I thought flatten was pretty recognizable.

@Keno
Copy link
Contributor Author

Keno commented Jul 1, 2015

The problem I see is that if you add a generic iterator of iterators, you can't do it statelessly. I think you can with chain.

@stevengj
Copy link

stevengj commented Jul 1, 2015

If that's true, chain(x) should have two implementations, one for x::Any, and one for x::AbstractVector. But we should still have one function (whatever it is called) that handles both cases, since the behavior is the same.

@Keno
Copy link
Contributor Author

Keno commented May 18, 2016

This now exists in Base.

@Keno Keno closed this May 18, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants