On the other hand, closures are much nicer now (JavaScript needs this): > say (1,2,3,4,5).reduce: { $^a + $^b };
15
Note about .reduce: it only supports binary functions.
A note on operators:
Hyperops, eg: (1,2,3,4) «+» (5,6,7,8)
These are permitted to auto-parallelize (implementation dependent.)
Lazy meta-ops, eg: 1,2,3,4 Z+ 5,6,7,8
These support lazy evaluation. The result is generated as needed.
Reduction meta-ops, eg: [+] 1,2,3,4,5
Triangular reduction: [code][\+] 1,2,3,4,5 # result is (1,3,6,10,15)[code]
These are basically .reduce(*[b][i]op[/i][/b]*) with the binary operator provided.
>>1
i liek perl6 cuz it reminds me so much of haskal hahahahahahahaha lol ^___^ i rly liek haskal (and i'm from /g/ hahaha nice to meet u haha lol hahahahaha lol)
>>4
NB. whatever-star is not classified as an operator. I think it's classified as a type in the auto-currying form.
Name:
Anonymous2011-01-10 11:15
>>6
I praised the power of Perl's Yada Yada Operator many times.
It is actually useful:
1. Your sub function { ... } example codes will be actual VALID Perl 6 CODE.
2. When you're working on a complex function, you can implement part of it later, using The operator on that branch: if (something) {
...; //TODO: we've got something, what to do?
} else {
// Let me work on this first
}
3. It's cute.
>>7
I think it can be classified as meta-operator, like «»/»«.
These support lazy evaluation. The result is generated as needed.
No CSE, no sharing, just call-by-name. Certain people fucking hate that myth that you can add some sort of primitively deferred computation to a strict applicative-order language and add "lazy evaluation" to your feature list.
>>14
Take it up with Larry Wall. No really--you can, he hangs out on IRC all the time. And I don't mean that in the "go away" sense, I mean it in the We're doing The Whirlpool-Larry Wall sense, i.e. if you can make a good point about it the spec and implementation will be revised.