-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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 NCycle iterator #17935
Add NCycle iterator #17935
Conversation
The docstring for this is currently at julia/base/docs/helpdb/Base.jl Lines 5565 to 5570 in 3f6b2b2
doc/stdlib/collections.rst then run make docs so the content of the docstring gets translated over.
|
I have added tests and documentation. I have also moved the |
This doesn't work as well as it could since it requires |
Do you have a suggestion on how to improve it? The only way I know of is to create a new iterator type. |
Well, well, this is your first Julia PR, isn't it @lstagner? Welcome to Julia! If you could run the doctests as well |
I have done a rebase against master and all the unrelated doc test failures now pass. This is ready to merge whenever. |
This PR wasn't getting much traction so I decided to create a custom iterator type instead of using julia> for i=ncycle(1:2,2)
println(i)
end
1
2
1
2 |
I have rebased and this is ready for review/merging. I addressed @JeffBezanson comment by making a new iterator type |
As a new iterator this might fit better in Iterators.jl. |
Are there use cases for this that justify putting it in Base? The existing |
If you think Iterators.jl is a better fit for this I will open up a PR there. |
I think it is useful to be able to set how many times an iterator should be cycled over.
The documentation should be changed but I am unsure of where to change it.