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
Tips for negation on grep, first, etc. #1425
Comments
Great. That said, it seems that people don't necessarily realize why this construct works, which is actually why we have this ticket in the first place. I think we can provide much more value by explaining why it works. See jnthn's explanation, which may be a bit too short for docs but it is a good starting point anyway. Another interesting point is that we don't really explain how to do not-grep. For example, say <a b c d e f>.grep(none Int) |
Yes, while coke++'s documentation change was exactly what I needed this morning, I think Alex is right on both fronts -- a deeper explanation would be nice and a broader explanation would be nice. |
OK, here's another very important point: https://irclog.perlgeek.de/perl6/2017-07-27#i_14927558 TL;DR none junction is 8 times faster than using a block. |
I've submitted this ticket: https://rt.perl.org/Ticket/Display.html?id=131805 Turns out that the difference in 8 times was due to a regression. Also, this is only relevant when you're grepping lists of Ints (and trying to match them with a regex), which is not very common anyway.
Soooo… I guess |
One of the common use cases of grep is to filter against a negative test -- the classic
-v
option for command line grep. Negation of tests usually results in more complicated tests, and the negation approaches are different for different sorts of tests. A quick guide to handling this, either in the grep documentation or with a pointer from the grep documentation, would be very handy.The text was updated successfully, but these errors were encountered: