-
Notifications
You must be signed in to change notification settings - Fork 29
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
Would takewhile be a natural candidate for IterTools.jl? #51
Comments
Yes, although it could also be |
Sure; I was thinking of the Python module itertools, which provides |
Ah well we can choose the Python-similar one then :) |
FWIW |
Your implementation looks good, I'd just swap the argument order to the constructor so that the function comes first, which is conventional. |
In the meantime, I have prepared code for takewhile with tests and doc, but I can not 'publish branch' or create a 'pull request'. I get
if I try to publish from GitHub Desktop. Are there any special rights I need to do this? Sorry, this is a total beginner's question - I have never contributed to any open source before. |
You can fork the package to your account by clicking "Fork" in the upper right corner of the page, next to "Star" and "Watch." You can then add add your fork as a Git remote, push your changes to your fork, then open a PR based on that. |
Thanks ararslan, I'll try that now. |
OK, I created a fork, added my code to three files manually, and created a pull request - first time for me! |
Oh, "All checks have failed" - would have been too easy... :-( |
So I fixed (one) bug (copied one 'end' too many) - do I have to create new pull request, or what do I need to do? |
You can commit the changes to your branch then push to the remote again, which will automatically update the existing pull request. |
If this works out I'll add 'takeuntil' some other day |
Don't worry about it :) |
Added in #54 |
Your first contribution was a great one! |
Would a takewhile function be a natural function to add to IterTools? It consumes a given iterator as long as a given condition is met.
So
collect(TakeWhile(Base.Iterators.countfrom(1), x-> x^2 <= 50))
would yield[1, 2, 3, 4, 5, 6]
.My own (simplistic?) implementation looks like this:
The text was updated successfully, but these errors were encountered: