itertools icon indicating copy to clipboard operation
itertools copied to clipboard

Extra iterator adaptors, iterator methods, free functions, and macros.

Results 211 itertools issues
Sort by recently updated
recently updated
newest added

Add a method equivalent to `iter.enumerate().filter(|(_, x)| predicate(x))`.

I was trying to multiunzip an iterator of tuples of 37 elements, and I was getting this error: ``` error[E0277]: the trait bound `std::iter::Map, [closure@src/main.rs:193:14: 193:19]>` | note: required by...

If you have two sorted iterators (e.g. from [`BTreeMap::keys`](https://doc.rust-lang.org/std/collections/struct.BTreeMap.html#method.keys)) there are various set operations you might want to perform, including `union`, `intersection`, `difference` and `symmetric_difference`. `union` is implemented via [`itertools::merge`](https://docs.rs/itertools/0.10/itertools/fn.merge.html)....

In a private project of mine I need to handle _a lot_ of vectors and iterators, and as such I found myself writing things equivalent to ```rust source.take(n).skip(1).chain(source.skip(n + 1))...

Implementing `array_windows` as opposed to `tuple_windows` makes things more ergonomic. It would also allow a function to be generic over the number of items, for example: ```rust fn some_function ()...

const-generics

I was working on another project and realized that 30% of the runtime was the itertools `.combinations()` adapter allocating vectors on the heap. Added an implementation for a lending iterator...

As it's known that `zip_eq` kills the performance, but I appreciate that it has helped to find a lot of runtime issues. So I'm curious whether it's worthwhile to add...

I wrote this code for my purposes. But you can feel free to edit it and incorparate it into your crate. ### Example transformations ``` This is a test sentence....

For problems that require working with windows of expensive to clone items, or large windows, tuple_windows isn't a good solution. Implementing a borrowed windows iterator is tricky if not impossible,...

Add an iterator that allows mapping with `(next_item, Option(&peek_item)`. This is useful for parsers. Exact semantics may vary, but the goal is to get something like `tuple_windows` without needing to...