rust-itertools / itertools

Extra iterator adaptors, iterator methods, free functions, and macros.
https://docs.rs/itertools/
Apache License 2.0
2.7k stars 309 forks source link

Add `cycle_n` iterator #205

Open ghost opened 7 years ago

ghost commented 7 years ago

Same as cycle but with finite number of repeats.

bluss commented 7 years ago

Can we say that we already cover this with itertools::repeat_n(iter, n).flatten()?

NooneAtAll3 commented 1 year ago

Microbenchmarks say dedicated function will get optimized better.

And, personally, I would prefer being able to do this with only dot-chaining