> How is memorizing a new special var any different than memorizing a new BLOCK LIST function name?

reduce iterates over neighboring couples, i.e. one iteration less.

So each new iterator needs a new name ...

Lets suppose appending _couple instead of inventing individual names is sufficient.

first_couple {$a != $b} 0 ..9 any_couple ... map_couple ... ...

when letting $_ iterating normally with $^PRE activated you might want to add _ante everywhere

map_ante { $_ == $^PRE ? $_ : () } grep_ante ...

simply having special vars which only change behavior when they are used within the block, simplifies notation.

Even if one doesn't touch classical iterator names to guaranty backwards compatibility, already those three cases can be integrated into one naming convention:

xgrep { $_ == 9 } LIST # like ordinary grep xgrep { $a == $b } LIST # like grep_couple xgrep { $^PRE == $_ } LIST # like grep_ante xgrep { $a == $^PRE } LIST # ERROR xfirst ... # and so on

In other words orthogonality helps to keep the namespace slim. And I'm sure there are still other variants of special vars to be considered.

I promise to answer your other points soon, unfortunately I don't have the possibility at the moment...

Cheers Rolf


In reply to Re^6: reduce like iterators by LanX
in thread reduce like iterators by LanX

Title:
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, details, 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, summary, 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.