Programming in NQP is troublesome, but it is fast and it is self-hosting.
1,154 karma · joined January 23, 2018
Programming in NQP is troublesome, but it is fast and it is self-hosting.
Because in Raku, grammars are really classes. So you can actually use roles and inheritance to build your grammar. And at the lower level in Raku, rules, tokens and regexes are just executable code (method on the grammar), so you can wrap them if need be. And they have all of the optimization opportunities (such as inlining) as all of the other executable code.
If you consider "never-ending development" until the first release, then Perl 6 ended development in 2015 when it was released.
If you consider "never-ending development" biologically, then it just means that the language is alive. Which it is, and Perl as well for that matter.
If you consider the language "Perl", then it should continue to be noted that for Larry Wall, Perl 6 (now Raku) still IS the next version of Perl. It just has a different name now.
If you use ² and ³ a lot in your work, I'm sure you can install a macro / keybinding / whatever to access them quickly.
And in any other case, https://docs.raku.org/language/unicode_ascii is a bit of a Rosetta stone in the cases you don't know how to type them, because you can copy / paste them from there.
Finally, the Raku documentation also contains information on how to type these unicode characters on your OS: https://docs.raku.org/language/unicode_entry .
If you want to force usage of floating point arithmetic, you will have to indicate that in literal values. E.g. `0.1` would be a [Rat](https://docs.raku.org/type/Rat) (Rational number), and `0.1e0` would be a [Num](https://docs.raku.org/type/Num) (aka a floating point".
In Raku, to get the nearest representation, use the [.narrow](https://docs.raku.org/routine/narrow) method. So `42e0.narrow`, `42.0.narrow` and `42+0i.narrow` would all be an `Int`. Yes, Raku has complex numbers built in as well :-)
sub deflate($power is copy, $rate, $years) {
$power *= 1 + $rate for ^$years;
$power * 100
}
sub MAIN(:$rate = 0.0225, :$years = 10)
{
print qq:to/EOF/;
After $years years of deflation at a rate of {$rate * 100}% per year,
purchasing power is &deflate(1,$rate,$years)% of what it was initially.
EOF
}
Which I think reads quite a bit better :-)Perl 6 got renamed to the Raku Programming Language (https://raku.org #rakulang) and continues to work on a 100 year programming language. If you want to stay up-to-date on developments, you can check out the Rakudo Weekly News https://rakudoweekly.blog
m:s/ What is your (name | guest | favorite color) '?' /
Especially in natural language parsing applications, this can be a very handy feature :-)See https://docs.raku.org/language/regexes#index-entry-regex_adv...
One could argue that that is exactly what happened in 2008, when the "sister language" meme was introduced. At that time, the Perl Porters basically abandoned all support for Perl 6 and started developing on Perl 5 again.
So development of Perl 6 basically fell back on just a handful of people, on the Parrot backend, which became less and less acceptable for Perl 6. And then people still wonder why it took so long?
In 2000, for all intents and purposes, Perl 6 was the successor of Perl 5. And one of the reasons the project was started, was because Perl 5 was already dying at that point. Not only losing the web server competition to PHP, but also from internal battles, close to civil war.
The internal battles ceased for a while when the Perl 6 process was started. But around 2008, it became a war between Perl 5 and Perl 6. To squelch that, the sister language meme was born. But that just meant a cease-fire, rather than peace, and the dissent and resentments continued to fester under the blanket of the sister language meme.
Until 2019, when the rename of Perl 6 to the Raku Programming Language happened. Factions within Perl 5 lost their common enemy, and fighting could start all over again. Which caused at least one pumpking to resign.
To mark Perl 6 as the cause for Perl 5's demise, is incorrect. Perl 6 was one of the effects of Perl 5's demise.
Meanwhile the Raku Programming Language continues to build a programming language of the future. You can check out the Rakudo Weekly News if you want to stay up-to-date on developments https://rakudoweekly.blog
Also, when you're talking slow: why is it that any performant Perl module, actually has most of its logic written in XS (aka C)? So I think it's shows quite a bit of hutzpah to call Inline::Perl5 "an ugly last resort solution", whereas a *lot* of upstream CPAN modules rely on the hack that is XS to make them performant. To give you an example: the pure Raku version of Text::CSV is more than 2x as fast as the pure Perl version of Text::CSV.
I wonder when it was the last time you tried Raku. Or compared it to a Perl script with Moose.
> plus every lib has to be rewritten from scratch, including the good and mature ones from Perl.
The good and mature ones from Perl can be used from Raku with Inline::Perl5.
When you do:
$a ~~ $b
You are in fact doing: $b.ACCEPTS($a)
So any object can determine how it will interpret any other object in smart-matching. The core classes or course have all these methods implemented in the expected way. And you can easily do that for your own classes as well: class Foo {
multi method ACCEPTS(Int:D $count) { $count == 42 }
multi method ACCEPTS("frobnicate" --> True) { }
}
my $foo = Foo.new;
say 42 ~~ $foo; # True
say 666 ~~ $foo; # False
say "what" ~~ $foo; # False
say "frobnicate" ~~ $foo; # TrueThe millionth prime number using 1 CPU:
$ raku -e 'say (1..Inf).grep(*.is-prime).skip(999999).head'
15485863
real 0m5.515s
Using whatever CPU cores are available (using `.hyper`): $ raku -e 'say (1..Inf).hyper(batch => 10000).grep(*.is-prime).skip(999999).head'
15485863
real 0m2.036sThe example for "looks_like_number" has probably be chosen, because many experienced Perl programmers are familiar with that.
In Raku, you can use kebab-case, and if there would be such a routine in Raku, it would probably be called "looks-like-number", and return a Bool, as in either True or False.
"say" is also builtin in Perl, at least for the past 12 years or so. And if you are on a Mac, running "say this is your computer talking to you', it will talk to you.
In any case, the thing you appear to refer to, is in no way a tutorial, but rather documentation intended for a specific group of people: Perl programmers.
This allows you to gradually move your code into Raku, replacing Perl 5 modules by Raku ones as needed.
As we're about to reach the 2000 modules in the Raku ecosystem mark, it should be noted that many modules from CPAN are not needed, as they're builtins in the Raku Programming Language. And many CPAN modules have outlived their usefulness in any programming language.
You can use any infix op (core or custom) to do a reduction:
[*] 1..10 # 3628800 basically faculty
Focussing on the Raku Programming Language, being a member of the Raku Steering Council, writing a weekly blog post (https://rakudoweekly.blog/blog-feed/), writing blog posts for the Raku Advent Calendar (https://raku-advent.blog/category/2021/), creating and maintaining modules (https://raku.land/zef:lizmat), doing Rakudo core development (https://github.com/rakudo/rakudo/graphs/contributors), setting up a IRC log server (https://logs.liz.nl, still in alpha), posting on Reddit (https://reddit.com/r/rakulang) tweeting a bit (https://twitter.com/liztormato).
The usual, I'd say :-)
There was the personal realization that the two factions in what was then the Perl community, would never see eye to eye on what the language called "Perl 6" was. And that all of my efforts of reconciliation, such as the Perl Reunification Summit http://blogs.perl.org/users/gabor_szabo/2013/02/perl-reunifi... had been in vain.
Which lead me to open an issue https://github.com/Raku/problem-solving/issues/81 which in the end resulted in the rename to the Raku Programming Language https://raku.org .
You could e.g. check out this year's Advent Posts: https://raku-advent.blog/category/2021/
Or the Weekly Rakudo News: http://rakudoweekly.blog/blog-feed/
Though this was technically correct in 2019, meanwhile the Raku Programming Language has continued to evolve, de-emphasizing its heritage more and more. For example, Covid restrictions allowing, 2022 will see the first European Raku Conference.