So how do you chain your implementations of hgrep and hmap?
hgrep {...} hmap {...} %h
???
Your trying to convince me that breaking the established interface is OK because there "is no use case".
(or to be precise that I have to show a use case while you don't try to prove that there is none)
I'm saying it's safer to respect symmetry because nobody can anticipate all use cases, not even you.
I don't say your code doesn't make sense from a performance analysis, BUT then
- it should be named in a way making evident that it can't be mixed with map, grep and sort
- corresponding versions of map, grep and sort should be available
A good design avoids traps and misunderstandings w/o overloading the language with edge cases!
UPDATE:
Since I thought that uneven lists should be disallowed anyway, I think it's not too dirty to consider a single argument to be a hashref.
Like this both hgrep \%h and hgrep %h would work and could be chained.
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.