Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Some parts of List::Util are a little ill-conceived. For example, the existence of separate min and minstr functions (and max/maxstr).

Two points:

  1. All of List::Utils function except shuffle, can be reproduce using reduce alone.

    Adding uniq() would be nice if it ran more quickly than a pure perl implementation: sub uniq{ my %h; undef @h{ @_ }; keys %h }

  2. The need for min/minstr is forced by being non-core.

    min amd minstr run more quickly than their equivalents using reduce, because they avoid the need to callback to Perl for every item.

    Sort gets away with using a callback by recognising the simple patterns of callback block {$a<=>$b} & {$a cmp $b} and bypassing them in favour of dedicate opcodes for those simple cases.

    Effectively, sort{$a <=> $b } is the subroutine name. sortn would be shorter, easier to type and remember. Ditto for sorts

    List::Util doesn't have that option because it is outside the core.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

RIP Neil Armstrong


In reply to Re^5: Is there a more functional regex syntax? by BrowserUk
in thread Is there a more functional regex syntax? by smls

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2024-04-23 16:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found