Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I am the only one that feels this way?

Surely not. The modules that people really need (and the others that people just like to use) are the ones that really do make things easier -- especially things that require lots of broader knowledge about the world outside of Perl, like details about calendars, internet protocols, RDBMS API's, and that sort of stuff.

Meanwhile, the ones that people tend to pass by, or forget, or deliberately avoid, are the ones that are just trying to "modularize" some idiom, objectify some data structure, or otherwise provide some syntactic sugar on stuff that is intrinsic to Perl and just seemed to the module author to be an itch worth scratching. But sugar for one programmer can be sand to another.

How would you simplify/clarify the coding of ST?

I don't think it's a matter of simplifying the coding (in the sense of making it simple to understand) -- unless you want to go to the trouble of breaking it apart into separate loops and using temporary storage (which would nullify some of the benefits of the approach).

It's a matter of coming up with a simple/clear way of introducing the concept to the uninitiated. It's kinda like introducing calculus to high school kids after they've had enough algebra. (I think back to when the teacher spent the better part of an hour covering the blackboard with all the algebra needed to estimate the area under a segment of a power function, then explained how to reduce it all to a "one-liner".)

People first need to see the problem solved in terms they are familiar with (apply a for loop in order to make a temp array that is easy to sort, apply basic sort to that, and another for loop to recreate the original data in sorted order. That makes sense. Now, introduce "map" to replace "for"; then just show how to remove the temp array, by having the first "map" feed directly to the sort, and having the sort output feed directly to the second "map".

There must be a tutorial somewhere that already presents it in those terms, and if so, people who say "use a Schwartzian Transform" should, by default, provide a link to that tutorial.

In reply to Re: To use a module...or not. by graff
in thread To use a module...or not. by BrowserUk

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others perusing the Monastery: (4)
    As of 2018-06-24 19:11 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (126 votes). Check out past polls.