I would seem foolish to me to pour a significant volume of time rooting around in a perl's monstrous code base finding the bits to patch, patching them, only then to be told "no, no, we cant do that because of this".

You could announce your intentions to the committers on the p5p mailing list or on their IRC channel.

no closer to tacking down where map and grep are implemented. Anyone know off the top of their shaved heads?.

$ perl -MO=Concise -e'grep { f() } $x..$y;' c <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 2 -e:1) v:{ ->3 8 <|> grepwhile(other->9)[t7] vK ->c 7 <@> grepstart K* ->8 3 <0> pushmark s ->4 - <1> null lK/1 ->4 - <1> null sK/1 ->8 - <@> scope sK ->8 - <0> ex-nextstate v ->9 b <1> entersub[t2] sKS/TARG,1 ->- - <1> ex-list sK ->b 9 <0> pushmark s ->a - <1> ex-rv2cv sK ->- a <#> gv[*f] s/EARLYCV ->b - <1> null lKM/1 ->7 6 <1> flop lKM ->7 e <1> flip[t6] lK ->7 4 <|> range(other->5)[t5] lK/1 ->d - <1> ex-rv2sv sK/1 ->e d <#> gvsv[*x] s ->e - <1> ex-rv2sv sK/1 ->6 5 <#> gvsv[*y] s ->6 -e syntax OK

So pp_grepstart and pp_grepwhile (in pp*.c) for grep. Similarly, map is pp_mapstart and pp_mapwhile.

Keep in mind that the list is already flattened before grep and map see it. First, you'd need to create new ops or use the "S"tacked flag like Perl does for for. (It doesn't appear to be used by the relevant ops.)

$ perl -MO=Concise -e'1 for $x..$y;' ... 8 <{> enteriter(next->9 last->c redo->9) lKS/8 ->a ... ^ | Stacked: Is a counting loop $ perl -MO=Concise -e'1 for (),$x..$y;' ... 9 <{> enteriter(next->a last->d redo->a) lK/8 ->b ... ^ | Not Stacked: Is a foreach loop

Then, you'd need to alter the compiler to produce the right opcode tree when a range is provided.

Update: s/Special/Stacked/


In reply to Re^3: Making perl's map and grep more large list friendly by ikegami
in thread Making perl's map and grep more large list friendly by nudge

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.