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

Add iterator.cycle #116

Closed
irh opened this issue Nov 11, 2021 · 2 comments
Closed

Add iterator.cycle #116

irh opened this issue Nov 11, 2021 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@irh
Copy link
Contributor

irh commented Nov 11, 2021

Since #99 iterators have been copyable, so it should be possible now to implement an iterator.cycle iterator adaptor that copies an iterator and repeats its output endlessly.

(1, 2, 3).cycle().take(10).to_list()
# [1, 2, 3, 1, 2, 3, 1, 2, 3, 1]
@irh irh added enhancement New feature or request good first issue Good for newcomers labels Nov 11, 2021
@alisomay
Copy link
Contributor

Hey this is cool.
There is an attempt of an implementation here when you have time to take a look.
#117

@irh irh closed this as completed Nov 16, 2021
@irh
Copy link
Contributor Author

irh commented Nov 16, 2021

Implemented in #117.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants