Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I really like the reduction operators. The concept is something I've been missing from Perl 5 as well as any other language I've used for more than fun and the syntax seems a quite natural, too.

    However, what's supposed to happen if the operator is not associative? I suppose it evaluates left to right? Is there a way to make it evaluate right to left or does that require something like [-] reverse(...)?

  • (Had a visceral reaction just after reading the example code.)

    Reduction operators with '[' ']' look horrendously ugly as they remind me of Subject: header of mailing lists which either include the list name or the major topic in square brackets.

    But, I will take it even if I don't have to like it.

    - parv
    • I personally don't have a problem with the usage of [] (and remembering the recent PHP \ namespace separator "fiasco" :-) ...)

      Hopefully with Perl 6's mutable grammar that Larry et al envisioned, you will be able to change the syntax. Of course this is not yet implemented in any of the current Perl 6 implementations.

    • I think they're intended to remind you of arrays/lists, since you're doing an operation over one. I guess when it comes to syntax, beauty is very much in the eye of the beholder - there is a method form of reduce that you can call on an array too, BTW. :-)
      • Well, I indeed like the concept.

        Given that I was shocked already, the points put forward by davegaramond remind me that things could be worse, and your own point, my hate probably will most dissipate. I will need to try harder to disassociate square brackets abuse on some mailing lists.

        - parv
        • There is a long section in my .procmailrc whose job is to get rid of that square bracket detritus from the lists I’m subscribed to…

          • Yes, I have that going too in procmail. I choose to invoke Perl to handle the cleaning bits.

            I am sure somebody else would have bad reaction reading "procmail".

            - parv
            • Oh, I hate it too… but it exists and works, which beats my non-existent better solutions. :-)