-
Notifications
You must be signed in to change notification settings - Fork 320
InterleaveShortest<I, J> is not actually fused #533
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
Comments
This was apparently an intentional decision: beaf395 Not sure what to make of this... We should probably at least update documentation, and check if we behave consistently across itertools resp. the |
But, since it already behaves as a fused iterator if its component iterators are fused, I imagine we could just add this impl: impl<I, J> FusedIterator for InterleaveShortest<I, J>
where
I: FusedIterator,
J: FusedIterator
{} |
Ah, I see, the documentation prose claims it's fused. Huh, I'm not sure what to make of this either. |
IMO none of the iterators should be using fused iterators internally, but I concede that would be a breaking change. Why is |
Fuse might be used internally if it's recognized that the implementation would need to keep that kind of state anyway to do its job correctly or efficiently (using fuse and its specialization for that flag then saves space & time). I think fuse has sense sometimes. I don't exactly remember the details, but if you see a fuse, it's probably because of some internal property of the algorithm, not to as a frivolous addition. |
550: Add More FusedIterator r=jswrenn a=aobatact These Iterator is fused if the underlying Iterator is fused. - `FilterOk` - `FilterMapOk` - `InterleaveShortest` - `KMergeBy` - `MergeBy` - `PadUsing` - `Positions` - `Product` - `RcIter` - `TupleWindows` - `Unique` - `UniqueBy` - `Update` - `WhileSome` These is fused even though the underlying Iterator is not fused. - `Combinations` - `CombinationsWithReplacement` - `Powerset` - `RepeatN` - `WithPosition` `FusedIterator` can be added to these structs. Related #55, #152, #531, #533 I separate the pull request with #548 because these Iterator are sure to be fused because it was documented, but I'm not 100% sure that the structs in this PR is actually fused. (Though I believe it is.) Co-authored-by: aobatact <[email protected]>
I was looking at the code and it turns out that
InterleaveShortest<I, J>
will resume iterating after aNone
if one of its iterators is not fused.The text was updated successfully, but these errors were encountered: