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

Itertools's step_by() has been implemented in std::iter #9

Closed
chawyehsu opened this issue May 12, 2021 · 1 comment
Closed

Itertools's step_by() has been implemented in std::iter #9

chawyehsu opened this issue May 12, 2021 · 1 comment

Comments

@chawyehsu
Copy link

https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.step_by
https://docs.rs/itertools/0.10.0/itertools/trait.Itertools.html#method.step

The following snippet should be removed or updated.

Remember how we used filter() to produce a range of even numbers? Itertools has a handy step_by() method for that.

extern crate itertools;
use itertools::Itertools;

for i in (0..11).step_by(2) {
    print!("{} ", i);
}

//output: 0 2 4 6 8 10
@rustomax
Copy link
Owner

Fixed in the latest commit. Thanks for the heads-up.

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

2 participants