Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Er... hmm.

uniq is self describing, check. That it documents this is a bonus, but it kind of falls out of the fact that grep is implicitly documented this way. As in, when order isn't going to come out the same way, it's documented that it won't, otherwise assume it will. And needing a module is not an issue.

grep, on the other hand, is not "unobvious". The behaviour won't change in future versions of perl. It can't change. The perl devs care way too much about backward compatibility, so it can't change. And the auxiliary variable is self-scoped. Again, not an issue.

So, to me, uniq barely eeks out a win simply on self-describing. Which is why I use it.

Though you missed one point: because List::MoreUtils also comes with XS-based implementations, it can also be faster than using grep. This might matter to you. It doesn't matter to me, so it doesn't make my list of pros, but if it matters to you, you can add that as a plus. Assuming that it was compiled - I've never seen it not compiled, but presumably there may be situations where it isn't.


In reply to Re^7: Order in which grep/map receive elements by Tanktalus
in thread Order in which grep/map receive elements by abufct

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 romping around the Monastery: (4)
As of 2024-04-19 23:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found