Especially the .hyper method that turns a regular sequence into hyper sequence that gets processed in parallel. First 5000 prime numbers:
# single-thread, takes 14.893s
put ^∞ .grep(*.is-prime).head: 5000
# multi-threaded, takes 8.853s on my 2-core box
put ^∞ .hyper.grep(*.is-prime).head: 5000
Concurrency isn't the same thing as parallelism. You can have concurrency without ever executing two things at the same time. You just give some CPU cycles to one threaad, then pause it, give cycles to the other thread, and keep switching back and forth. Indeed, this is what any multitasking operating system has always done, even when every computer only had one CPU.
For parallelism as what you describe, D instead has approximately the same thing. There's a `parallel` function in the standard library that works on any range (i.e. any iterable). You basically instead of doing
foreach(object; somerange) {
// ..
}
do
foreach(object; parallel(somerange)) {
// ...
}
and it works like your Perl example.
If you want it more functionalish, without writing out the loop, you can use `taskPool.map` instead of ordinary `map` for the same effect. More details:
Concurrency is not a first class citizen in Perl 6 though. As with Perl 5 the best you can hope for is actor model implemented on top of promises/futures.
Even an empty Rakudo Perl 6 program is a multi-threaded program, as the dynamic optimizer runs on a separate thread. I'd figure if that's possible, concurrency/parallelism would be quite a first-class citizen, not a best hope on top of something.
To answer some of the comments: no, this isn't satire, nor is it a marketing or advertisement piece.
I'm just having fun with the language and wrote a post in the voice of The Grinch (https://en.wikipedia.org/wiki/Grinch). It's meant to be mean. That's all there is to it. Tomorrow's article (coincidentally, also written by me), will have a more sober tone and will describe Perl 6's system of containers and variables. See if you like it more.
I'm OK if you don't like Perl 6 :) That's why we have so many different wonderful languages: everyone can find what they love. I love Perl 6. You should try it out.
Some fuddy-duddies think that preferring expression over safety is irresponsible. They might be right, but Perl is a language that doesn't have to justify itself:
I’m glad you’re having some fun. I still code in Perl 5 regularly and reading your code is causing my brain to invert. I’m not sure if you’re a Contrary Warrior or an Assassin whose primary weapon is Brainstem Autodissection. It’s like learning Perl all over again.
The “cutting edge” of technology or craft is the newest / greatest stuff, pushing the field forward in new unexplored directions, by analogy to the cutting edge of a plow or a knife which slices through some uncut material or unbroken ground. I believe the metaphorical use of the term dates from the middle of the 20th century.
The “bleeding edge” is a more recent term for the same idea, emphasizing that being at the cutting edge might involve danger to yourself.
There's actually talk about amending the name for next major language release ( https://rakudo.party/post/The-Hot-New-Language-Named-Rakudo ). Exactly for the reasons you state: it's a completely different language than Perl and so far it proved too confusing for everyone.
You should mind annoying people to cause problems. Bringing up the language naming thing, again after 10+ years of discussion, has all of the problem solving ability of "hay guise whats going on in this thread?"
Branding is not the problem with Perl 6, though it is the easiest thing to bikeshed. The problem is compiler speed, language interoperability, and enough of a toolchain to start building serious apps. Make that good enough, and no one will care what our language is called.
I think you're trying to solve the wrong problem: Don't move the languages further apart through rebranding, move the implementations closer together through improved interoperability.
Have a frontend that can invoke the perl5 interpreter as well as Rakudo as appropriate, supporting the perl5 command line flags, and arguably quite a bit of the problem goes away.
Maybe the problem isn't with the "Perl" part of the name, but with the "6" part? It sounds like an incremental update when it's actually a new language.
dunno perl6 seems fine to me, rakudo just looks like something half my team will wonder how to pronounce.. I agree with the other guy that people want a platform that they can use and is performant
Funny you mentioning Geth... Perl 6's core devs use a bot named Geth to report new commits on IRC. And.... it's written in Perl 6 ( https://github.com/perl6/geth ) :)
That's just a helper script to generate tables for for .succ/.pred string increment/decrement methods. Nd and No chars as numeric literals were available since first stable release in December 2015
> EDIT: Ok, so I installed perl6 (rakudo) just to test this out, and it apparently doesn't work out of the box. Pity.
By any chance, was it from system packages that are likely outdated? You can get up-to-date packages [here](https://github.com/nxadm/rakudo-pkg/releases) or for Windows/Mac, use [Rakudo Star](http://rakudo.org/downloads/star/). Anything older than 2017.04 is ancient and anything older than 2015.12 precedes first stable release and is likely broken.
> Now I wonder what other number systems it supports
It goes by Unicode's definition of what's a digit or a number (using Nd and No) properties. Nd chars are "digits" and can be combined. `No` chars are "Numeric other" and can't be combined; can only use them as numeric literals. [Among other things](https://docs.perl6.org/language/unicode_texas.html#Numeric_c...), that includes Unicodey fractions. And as a cherry on top, you can use superscript chars to raise to a power:
$ rakudo -e 'say ½ + 42²'
1764.5
Here are all the Nd and No chars that can be used as numeric literals: