Re:What you can write in Perl 6 today
by shrughes on Friday April 24, 2009 @11:04AM
(#577580)
My God. Here's their example of the "reduction meta operator".
What the hell? With [*] they go for a reduction, but with [<] they go for a reduction over a zip of the list with its own tail. The behavior changes completely! How do you predict that? That's simply dumb. Extremely dumb. Things like this don't make the language complicated, they make it risky. It is risky to write Perl 6 programs. And we know programs don't get any thrill out of that.
[ Parent
| on HN ]
The syntax seems perfectly reasonable, or even natural, to me. Perhaps you're over-thinking the specifics, or are too used to other functional programming languages where 'reduction' has a slightly different, more specific, meaning (i.e. fold).
[+] 1...5 = 1+2+3+4+5
[*] 1...5 = 1*2*3*4*5
[**] 1...5 = 1**2**3**4**5
[<] 1...5 = 1<2<3<4<5
Note that this means, unlike the normal reduce, that it follows the operator's default precedence rules, and presumably the less-than operator works similarly to Python's in that it allows comparison chaining (i.e. 1 < 2 < 3 works as you'd expect) to make the result using reduce seem natural.You predict what a hyperoperator does by knowing what the non-hyper operator does. Your question about predictability reads to me like asking "You can modify verbs with adverbs! How in the world do you know what a verb means?"
Re:What you can write in Perl 6 today
by kingkongrevenge on Friday April 24, 2009 @11:10AM
(#577589)
Operators operate on the list. Conditions test the list. How is that confusing?
It's completely different behavior depending on the type of operator.
Edit: And apparently it even respects the associativity of the operator! There is nothing gained by making the language more complicated just to cut a few characters.
If you use the operator, it's (hopefully) safe to assume you know what it does. Then you should also know what interleaving the operator between the list elements does. Which is exactly what the reduction does. I don't understand your problem with it.
yeah. i don't really get what is being gained. you have to keep some much context in your head in order to write perl - as compared to python ... it's tiring (as i keep saying)
Re:What you can write in Perl 6 today
by kingkongrevenge on Friday April 24, 2009 @11:21AM
(#577604)
Isn't this like complaining that '[how the hell do you escape two asterisks?]' for exponentiation is too confusing?
You're not reading what I've said, are you.