-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Augment sort.jl documentation with doctests #18923
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
Conversation
|
I think they should be more concise: when calling help at the REPL I don't want pages and pages of examples. For instance there is no advantage to sort vectors with more than three elements. Also construction of the vector should be done inside the function call. For example the Thanks for your efforts! |
|
It's much better to have too much documentation than too little, but I do think that some of the extra examples would be better off in the manual, but then again the stdlib reference is generated from the doc strings. Maybe we need some mechanism for basic and extended documentation? |
|
Thank you --- I appreciate the feedback! I updated my PR to make the examples more concise as @mauro3 suggested, and I added doctests for sortperm() and sortperm!() For now I left vector construction outside of the function calls to sort!() and sortperm!() to illustrate mutation, but I'm happy to change that too. :) |
|
Another thing worth mentioning is that [-1, -2, -3] is "sorted" in the sense that it is reversed, so it may be worth adding even more examples: This branch needs a rebase! |
|
Thanks for the bump! Just rebased. It looks like most of the functions for which I originally wrote doctests have since been covered. Now this PR just adds doctests for |
tkelman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks for updating
I added some doctests to sort.jl in issorted(), sort!(), sort(), sortrows(), sortcols(), sortperm(), and sortperm!(). Per
make -C doc doctest, it seems all added tests pass.Many of the examples are redundant. Just let me know if you'd like more/different examples, less redundancy, etc.!
Thanks a lot!!
ref #18821