-
Notifications
You must be signed in to change notification settings - Fork 53
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
Sort --head and --tail flags #65
Conversation
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.
We're stuck with core modules, so we can't pull from CPAN.
} | ||
my $pq; | ||
if (defined $head or defined $tail) { | ||
require Heap::Fibonacci; |
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.
With PerlPowerTools, we have to be mostly self contained. If it's not in Perl core, we need to stay away from it.
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.
I see. Well, these modules won't get used as long as the flags are not specified. This branch was also just a proof-of-concept for a similar feature in gnu coreutils or whatever. Feel free to close this pull req - https://www.shlomifish.org/philosophy/philosophy/putting-cards-on-the-table-2019-2020/putting-cards-on-the-table-2019-2020.raw.html#do_and_let_do__live_and_let_live and Hakuna Matata
See: briandfoy/PerlPowerTools#65 similar to sort | head -10 or sort | tail -10 but should be more efficient. ---- I hereby disclaim any implicit or explicit ownership of my changes in this changeset, and put them under a multiple licence consisting of your choice of one of more of: - The CC0 / Public Domain - https://creativecommons.org/choose/zero/ . - The MIT / Expat license - https://en.wikipedia.org/wiki/MIT_License - The default licence of your project - The https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License - version 2.1 or higher - The https://en.wikipedia.org/wiki/GNU_General_Public_License - version 2 or higher - Any licence in the 2018-Aug-27 popular licenses list of https://opensource.org/licenses - The https://en.wikipedia.org/wiki/Apache_License version 2.0 or later - The https://en.wikipedia.org/wiki/Artistic_License version 2.0 or later - The https://en.wikipedia.org/wiki/ISC_license - The https://opensource.org/licenses/BSD-2-Clause Crediting me will be nice, but not mandatory, and you can change the licence of the project without needing my permission.
See: briandfoy/PerlPowerTools#65 similar to sort | head -10 or sort | tail -10 but should be more efficient. ---- I hereby disclaim any implicit or explicit ownership of my changes in this changeset, and put them under a multiple licence consisting of your choice of one of more of: - The CC0 / Public Domain - https://creativecommons.org/choose/zero/ . - The MIT / Expat license - https://en.wikipedia.org/wiki/MIT_License - The default licence of your project - The https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License - version 2.1 or higher - The https://en.wikipedia.org/wiki/GNU_General_Public_License - version 2 or higher - Any licence in the 2018-Aug-27 popular licenses list of https://opensource.org/licenses - The https://en.wikipedia.org/wiki/Apache_License version 2.0 or later - The https://en.wikipedia.org/wiki/Artistic_License version 2.0 or later - The https://en.wikipedia.org/wiki/ISC_license - The https://opensource.org/licenses/BSD-2-Clause Crediting me will be nice, but not mandatory, and you can change the licence of the project without needing my permission.
See: briandfoy/PerlPowerTools#65 similar to "sort | head -10" or "sort | tail -10" but should be more efficient. ---- I hereby disclaim any implicit or explicit ownership of my changes in this changeset, and put them under a multiple licence consisting of your choice of one of more of: - The CC0 / Public Domain - https://creativecommons.org/choose/zero/ . - The MIT / Expat license - https://en.wikipedia.org/wiki/MIT_License - The default licence of your project - The https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License - version 2.1 or higher - The https://en.wikipedia.org/wiki/GNU_General_Public_License - version 2 or higher - Any licence in the 2018-Aug-27 popular licenses list of https://opensource.org/licenses - The https://en.wikipedia.org/wiki/Apache_License version 2.0 or later - The https://en.wikipedia.org/wiki/Artistic_License version 2.0 or later - The https://en.wikipedia.org/wiki/ISC_license - The https://opensource.org/licenses/BSD-2-Clause Crediting me will be nice, but not mandatory, and you can change the licence of the project without needing my permission.
See: briandfoy/PerlPowerTools#65 similar to sort | head -10 or sort | tail -10 but should be more efficient. ---- I hereby disclaim any implicit or explicit ownership of my changes in this changeset, and put them under a multiple licence consisting of your choice of one of more of: - The CC0 / Public Domain - https://creativecommons.org/choose/zero/ . - The MIT / Expat license - https://en.wikipedia.org/wiki/MIT_License - The default licence of your project - The https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License - version 2.1 or higher - The https://en.wikipedia.org/wiki/GNU_General_Public_License - version 2 or higher - Any licence in the 2018-Aug-27 popular licenses list of https://opensource.org/licenses - The https://en.wikipedia.org/wiki/Apache_License version 2.0 or later - The https://en.wikipedia.org/wiki/Artistic_License version 2.0 or later - The https://en.wikipedia.org/wiki/ISC_license - The https://opensource.org/licenses/BSD-2-Clause Crediting me will be nice, but not mandatory, and you can change the licence of the project without needing my permission.
Refactoring / code cleanup. See: * https://en.wikipedia.org/wiki/Code_refactoring * https://www.refactoring.com/ * https://www.joelonsoftware.com/2002/01/23/rub-a-dub-dub/ Some small optimisations may have slipped in as well. See: briandfoy/PerlPowerTools#65 ----- The flags are similar to sort | head -10 or sort | tail -10 but should be more efficient. ---- I hereby disclaim any implicit or explicit ownership of my changes in this changeset, and put them under a multiple licence consisting of your choice of one of more of: - The CC0 / Public Domain - https://creativecommons.org/choose/zero/ . - The MIT / Expat license - https://en.wikipedia.org/wiki/MIT_License - The default licence of your project - The https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License - version 2.1 or higher - The https://en.wikipedia.org/wiki/GNU_General_Public_License - version 2 or higher - Any licence in the 2018-Aug-27 popular licenses list of https://opensource.org/licenses - The https://en.wikipedia.org/wiki/Apache_License version 2.0 or later - The https://en.wikipedia.org/wiki/Artistic_License version 2.0 or later - The https://en.wikipedia.org/wiki/ISC_license - The https://opensource.org/licenses/BSD-2-Clause Crediting me will be nice, but not mandatory, and you can change the licence of the project without needing my permission.
See: briandfoy/PerlPowerTools#65 similar to "sort | head -10" or "sort | tail -10" but should be more efficient. ---- I hereby disclaim any implicit or explicit ownership of my changes in this changeset, and put them under a multiple licence consisting of your choice of one of more of: - The CC0 / Public Domain - https://creativecommons.org/choose/zero/ . - The MIT / Expat license - https://en.wikipedia.org/wiki/MIT_License - The default licence of your project - The https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License - version 2.1 or higher - The https://en.wikipedia.org/wiki/GNU_General_Public_License - version 2 or higher - Any licence in the 2018-Aug-27 popular licenses list of https://opensource.org/licenses - The https://en.wikipedia.org/wiki/Apache_License version 2.0 or later - The https://en.wikipedia.org/wiki/Artistic_License version 2.0 or later - The https://en.wikipedia.org/wiki/ISC_license - The https://opensource.org/licenses/BSD-2-Clause Crediting me will be nice, but not mandatory, and you can change the licence of the project without needing my permission.
See: briandfoy/PerlPowerTools#65 similar to sort | head -10 or sort | tail -10 but should be more efficient. ---- I hereby disclaim any implicit or explicit ownership of my changes in this changeset, and put them under a multiple licence consisting of your choice of one of more of: - The CC0 / Public Domain - https://creativecommons.org/choose/zero/ . - The MIT / Expat license - https://en.wikipedia.org/wiki/MIT_License - The default licence of your project - The https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License - version 2.1 or higher - The https://en.wikipedia.org/wiki/GNU_General_Public_License - version 2 or higher - Any licence in the 2018-Aug-27 popular licenses list of https://opensource.org/licenses - The https://en.wikipedia.org/wiki/Apache_License version 2.0 or later - The https://en.wikipedia.org/wiki/Artistic_License version 2.0 or later - The https://en.wikipedia.org/wiki/ISC_license - The https://opensource.org/licenses/BSD-2-Clause Crediting me will be nice, but not mandatory, and you can change the licence of the project without needing my permission.
Refactoring / code cleanup. See: * https://en.wikipedia.org/wiki/Code_refactoring * https://www.refactoring.com/ * https://www.joelonsoftware.com/2002/01/23/rub-a-dub-dub/ Some small optimisations may have slipped in as well. See: briandfoy/PerlPowerTools#65 ----- The flags are similar to sort | head -10 or sort | tail -10 but should be more efficient. ---- I hereby disclaim any implicit or explicit ownership of my changes in this changeset, and put them under a multiple licence consisting of your choice of one of more of: - The CC0 / Public Domain - https://creativecommons.org/choose/zero/ . - The MIT / Expat license - https://en.wikipedia.org/wiki/MIT_License - The default licence of your project - The https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License - version 2.1 or higher - The https://en.wikipedia.org/wiki/GNU_General_Public_License - version 2 or higher - Any licence in the 2018-Aug-27 popular licenses list of https://opensource.org/licenses - The https://en.wikipedia.org/wiki/Apache_License version 2.0 or later - The https://en.wikipedia.org/wiki/Artistic_License version 2.0 or later - The https://en.wikipedia.org/wiki/ISC_license - The https://opensource.org/licenses/BSD-2-Clause Crediting me will be nice, but not mandatory, and you can change the licence of the project without needing my permission.
See: briandfoy/PerlPowerTools#65 similar to "sort | head -10" or "sort | tail -10" but should be more efficient. reformat with rustfmt fix cargo-clippy warnings ---- I hereby disclaim any implicit or explicit ownership of my changes in this changeset, and put them under a multiple licence consisting of your choice of one of more of: - The CC0 / Public Domain - https://creativecommons.org/choose/zero/ . - The MIT / Expat license - https://en.wikipedia.org/wiki/MIT_License - The default licence of your project - The https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License - version 2.1 or higher - The https://en.wikipedia.org/wiki/GNU_General_Public_License - version 2 or higher - Any licence in the 2018-Aug-27 popular licenses list of https://opensource.org/licenses - The https://en.wikipedia.org/wiki/Apache_License version 2.0 or later - The https://en.wikipedia.org/wiki/Artistic_License version 2.0 or later - The https://en.wikipedia.org/wiki/ISC_license - The https://opensource.org/licenses/BSD-2-Clause Crediting me will be nice, but not mandatory, and you can change the licence of the project without needing my permission.
These use heaps/PQs to speed up the sort | head/tail idioms. A nonstandard feature that I prototyped in PPT.