3 ms·
I would have written it sub prefix:<∑> { [+] @_ } would you have liked it more? (I personally find it more "perlish")
by grondilu 11y ago
I would have written it
sub prefix:<∑> { [+] @_ }
would you have liked it more? (I personally find it more "perlish")
- JadeNB 11y agoI've never written any Perl 6, so this comment could be badly foolish. As you point out, the suggested `∑` is just sugar (for some value of 'sugar') for `[+]`. In Perl 5, one could easily alias subroutines using, for example, `* a = \&b` (space inserted to fool Markdown). Is there any analogue in Perl 6, so that, say, `* ∑ = \&[+]` or its modern variant would automatically inherit the parsing semantics without having to go through the cumbersome process of declaring a new sub just to pass its arguments unchanged to an old one?
- grondilu 11y ago[+] is not a function with a name, as it is the result of the metaoperator [] to the function &infix:[+]. Thus you really need a closure.