First, this is a mighty fine idea. It reduces the cost of certain
common operations, even if hand-coding them is already inexpensive.
More importantly, it solidifies common idioms behind descriptive
names that the community can incorporate into its collective
vocabulary.
Second, the all-caps are a bit much. (They burn my eyes.)
Third, I like the pre-loading refinement. (Personally, I wouldn't
use them like this:
my $min = MIN(1..10)->();
because I find this more pleasing:
my $min = MIN->(1..10);
)
But the refinement does have value for finding min-maxes and max-mins:
my $max_of_at_least_zero = MAX(0);
$max_of_at_least_zero->($_) while <>;
# ...
Fourth, let's load the tool-box up! How about some new additions?
- read_all – slurp filehandle
- read_all_from_path – open, slurp, close
- zip – merge parallel arrays
- zip_with – merge parallel arrays with a given "zipper" function
- foldl, foldl1, foldr, foldr1, scanl, scanl1, scanr, scanr1 – more friends from functional programming
- curry – everybody loves curry
Thanks for getting the ball rolling.
Cheers,
Tom
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.