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

  1. it should be named in a way making evident that it can't be mixed with map, grep and sort
  2. 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!

Cheers Rolf

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.


In reply to Re^12: Is there any difference between prototype % and @ ? by LanX
in thread Is there any difference between prototype % and @ ? by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.