Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: To use a module...or not.

by graff (Chancellor)
on Jul 26, 2004 at 05:13 UTC ( [id://377352]=note: print w/replies, xml ) Need Help??


in reply to To use a module...or not.

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://377352]
help
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found