Here's a version that works under pugs:

(Needless to say,) whoa! That's great. Generally I avoid replying for TY-only posts and prefer to /msg instead. But I feel like doing so publicly for this time since it's so nice to actually test the thing myself. I tried a first time and pugs seemed not to like the method call on the HERE doc string. In fact I had 6.2.12 installed; I upgraded to 6.2.13 and it still complains about something:

*** Cannot parse regex: \n *** Error: Error: Can't call method "__RUN__" on an undefined value.

But it does spit out a value.

I would generally prefer to write max as [max], but that's not implemented yet. Also it prints the result in E notation, albeit with sufficient precision.

Indeed, especially since the original problem expected an exact answer in terms of an integer. (The value spitted out doesn't seem to match the Perl 5 version one, but that's definitely a side note in this context. I don't know whether that could be related to the messages above.)

I think there are probably ways to use hyperops to replace some of the maps, but I need to think about it some more. There are also some unimplemented cross operators that might replace nested maps.

That's great as well. The maps look very natural to me, but I'd be delighted to see what hyperops could do instead of them. And I'm particularly excited about the potential cross operators which I also find quite natural, in fact it's one of the first things I asked in p6l: I can do without them, but I miss them more than, say, the somewhat "dual" zip operator. Of course the advantage becomes more evident with more nesting levels than just two...


In reply to Re^2: How to write this in Perl 6? by blazar
in thread How to write this in Perl 6? by blazar

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.