Maybe. I did not set out to do a thorough benchmark - as I think is clear from the lack of rigour in my reply. Rather I was curious to find out how close Raku would be to Python expecting it to be rather slower. By chance the example picked by the OP - fibonacci - is best written in Raku via the `...` sequence operator and, yes, I would that is using hyper operators and internal concurrency to "cheat". I agree that Raku is not generally faster than Rust, or indeed Python. At this point in its evolution, there is still much work to be done on code optimisation.
When I say "haha" I mean <<that's quite funny since by chance the code given in the OP is much faster in Raku _in this particular instance_ and that's quite apt since some higher level operators such as `...` are actually quite useful and since they are core operations can be more tightly optimised than general code. So actually (in addition to the main thrust that human speed is more important than code speed), it seems that often our preconceptions are not always true>>
I am genuinely sorry that you find the raku gibberish - I suppose that I would find Malay gibberish but that's a reflection on me not on the inhabitants of Malaysia that use it every day.
Let me try a translation:
The sequence operator is spelled `...`. Here are a couple of basic examples:
say 1,2,3 ... 10; #(1,2,3,4,5,6,7,8,9,10) - an arithmetic sequence
say 1,2,4 ... 16; #(1,2,4,8,16) - a geometric sequence
say 1,2,4 ... *; #(1,2,4,8,16,32...) - lazy list with infinite length
The RHS value limits the size of the last item in the output list. A `
` on the right means `infinity`.You can see that this looks at the list of three items on the LHS and determines the remainder of the sequence from that. If you want to use it with a function, you can use the `` to represent a parameter like this:
say (1, *+7 ... *)[1..4]; #((8 15 22 29)
You will note that I am using the regular `[]` index syntax with the range `1..4` to request only the first 4 items of the resulting lazy list.
So, the final bit of the puzzle is when I have a dyadic function that takes two parameters (ie the previous value and the one before it), like this:
say (0,1, *+* ... *)[10,20,30,40];
This is the fibonacci series.
---
One last word is that the raku MAIN() function is a very neat way to deploy a raku script on the command line.
sub MAIN(*@n) {
say "$_ " ~ (0, 1, *+* ... *)[$_] for @n
}
So that's "slurp" all the indices provided on the command line to array `@n`, which can then be used as the index to the sequence.
PS. I have tweaked this a bit to include printing the index and the result.
---
Even if this helps to de-gibberish the code, I understand that you may not like it. Personally I find it quite clean and easier to read than the Python code.