Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
This is a good question. And I don't know the answer.

I can try to answer where I picked up the notion though. I first saw map and grep actually used in a bad CGI book (whose title I have forgotten), where the author was trying to tell people to write loops like that. I thought the advice was silly, and it didn't take long before I learned enough to realize that the book was bad. Furthermore I noticed that people who were far more experienced than I sometimes criticized people for using map and grep for side-effects, and I filed that away as another fault of the book.

When I later saw map and grep being used more appropriately, it was in the context of side-effect free transformations. Not long after that I ran across them in some material that I was reading about Lisp, and about functional languages, which advocated making functions side-effect free for a variety of reasons (mainly more transparent modularity and easier debugging). I took the notion back to my Perl, and began using map and grep fairly consistently, but always with side-effect free blocks.

This stylistic choice became a habit, and the habit became an expectation, and that continued with rather little thought about the matter on my part until this week.

So I guess that the answer is that the people who chanted against map and grep in void context set my original notions, and then the notion that it was good to actively avoid having them have side-effects came for me from other languages that I was trying to learn about.

I doubt that many other Perl programmers who hold my opinion hold it for the same reason though.

In reply to Re: Re: Think for yourself. by tilly
in thread is the use of map in a void context deprecated ? by arno

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: (6)
    As of 2018-07-21 13:46 GMT
    Find Nodes?
      Voting Booth?
      It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

      Results (449 votes). Check out past polls.