Aiui, in Raku, macros are typechecked as normal because they are just functions like any other (albeit with the twist that they'll end up being called at compile-time, passed AST fragments as arguments, and required to return a new AST fragment which gets spliced into the overall program AST that's being constructed).
Once the RakuAST project is completed, and the ongoing implementation work in the Raku directory of the rakuast branch of Rakudo is merged (maybe this year, but I suspect next year), the scheme will aiui be something like:
Macro parameters are (at least normally) a sub-type of RakuAST::Node
, eg RakuAST::Expression
, and a call to a macro must bind to a macro definition with a matching type signature.
A macro's return value must be a sub-type of RakuAST::Node
.
For further details, you'll need to read the code, or at least the comments in the code, in the branch I linked above, and/or ask questions in a suitable Raku forum such as the IRC #raku channel.
When was that?
Raku isn't nearly as mature as Perl but it's driven by the same spirit, leadership and principles that created and made Perl a reliable industrial strength tool.
----
The rename to Raku was needed to make clear it's not the same language and tech stack. But the original name reflected the fact that "Raku intends to carry forward the high ideals of the Perl community", as Larry Wall put it.
The latter sentence was recently removed from the raku.org home page. Its removal was understandable and inevitable -- it's really easy to confuse folk -- but I do wish we could come up with another way to succinctly express the connection in a way that didn't confuse people.
I'm sure raku folk would welcome you (there's a link to the #raku IRC channel in spokesbug Camelia's welcome text).
Using IRC is ingrained in Raku's cultural DNA -- as is being kind and helpful in response to folk such as yourself who want to learn, have fun, and get stuff done.
That said, their primary focus is Raku, which is a programming language, so I think you'll find they'll encourage you to play with it (using online evaluator bots if you like) rather than any other PL.
I've been hanging out on SO for the last few years and I think it's safe to say that provided askers make sure to include a raku tag, and to not include any other language tag, the anti-noob crowd generally leave us alone.
(They've occasionally come in and attempted to close questions that we reopen but that hasn't happened in a year or two. Perhaps they've gotten used to our attitude which I'd summarise as -Ofun, forgiveness > permission, and "be helpful".)
I see you've posted on codereview and will follow up there too...
> staying separate from the bastard child that is Perl 6. It's going to rather bugger that up next time it needs a major version update...
Er... not really. Perl 6 has been Raku for months.
Not efficient, not elegant, not... wait, it works!
I tripped on the wire of background changing color every other step, luckily I could handle without too many changes.
I also added the generation of two images for the outcome of the two parts, using the PGM format, which is super-handy in these occasions at it requires virtually no effort to do (see pgm
function at the end).
Recursive solution in Raku.
sub day12(:$verbose) { my @caves = <start-A start-b A-c A-b b-d A-end b-end>, <dc-end HN-start start-kj dc-start dc-HN LN-dc HN-end kj-sa kj-HN kj-dc>, <fs-end he-DX fs-he start-DX pj-DX end-zg zg-sl zg-pj pj-he RW-he fs-DX pj-RW zg-RW start-pj he-WI zg-he pj-fs start-RW>;
my @number-of-paths; for @caves -> @cave { say ‚Cave ‘ ~ ++$ ~ ‚:‘ if $verbose; my %connections.append: @cave».split('-').map(-> [$a, $b] { $a => $b, $b => $a }).flat;
my \paths = gather { sub walk($node, @so-far is copy, %seen is copy) { return if %seen{$node}:exists; @so-far.push: $node; (take @so-far; return) if $node eq 'end';
%seen{$node} = True if $node eq $node.lc;
.&walk(@so-far, %seen) for %connections{$node}.flat; }
walk 'start', [], %() }
paths.&{@number-of-paths.push(.elems); $_}.sort».join(',')».&{.say if $verbose}; }
printf(„There are %d paths in cave %d.\n“, |$_) for (@number-of-paths Z ++$ xx ∞); }
raku.org current:
​
It's like they intentionally implemented everything this guy was against.
Perl 6 was released in 2015. Since then, it has been renamed to the Raku Programming Language (https://raku.org #rakulang).
The Raku Community has a Steering Council and a Code of Conduct, and a Community Affairs Team (CAT). This CAT has issued a ban for this person.
Why do you think it matters?
Friends of FLOSS contribute to its funding.
My perspective is that no amount of funding can make a FLOSS project competitive.
Yes, FLOSS has won every major competitive battle of the last three decades between FLOSS and proprietary interests. But no, I don't think funding is what led to that. Linus Torvalds scratched an itch. That's how FLOSS rolls.
In Raku's case its competitive strength vs Oracle is a combination of FLOSS vs proprietary forces; <em>-Ofun</em> culture; support from one of the world's most popular PLs of all time; the value of the technical asset Raku is building; guidance by wise and capable leaders; and other factors. It's gotten a few hundred thousand dollars of funding too, but that's just icing on its overall cake.
Consider the reasons for, and impact of, the OpenJDK project dropping support for Graal in the upcoming JDK 17. Despite all their money, Oracle aren't wise enough to see that they will lose if they decide to do battle with the FLOSS world. It took Microsoft decades to figure this out; Oracle are simply behind the eight ball and don't yet know it.
I showed off my solution a while back. Sample code. That example uses the language as a thin wrapper over html; but it's a full-fledged programming language, so you could easily make something that would compile to latex or html or ...
Tagline is 'code is not data…but a lot of your data might actually be code'. Simple text-processing needs will be simple, and markdown—or rst, asciidoc, whatever—will be sufficient. Complex text-processing needs are complex, and at that point turing-completeness is nice. LaTeX is the only language which really does this, and latex is quite complex. The typesetting is remarkably good, but the language is not particularly good, by modern standards. Then you have text-processors which embed other languages—html has js; org-mode has lisp; luatex/lualatex has lua—but when you do that, you bifurcate your language, and now you have to learn two languages. You have to keep two different syntaxes in sync.
With my solution, there is a single language which acts both as text processor and programming language. It's lisp; a proven design, and of course has macros so it can be whatever else you want it to be. The only other language I know of which is doing anything like this is raku, with pod6, but the basic form of pod6 is somewhat simple than I would like; and because raku's syntax is heterogenous, it's not so easy to extend or interoperate.
Raku can look a bit like this. It uses Unicode operators like ∪, ∩, ⊖, ∈, ∉, ⊆, «, », ∘ and has so many features for combining operators and making new ones like the love operator...
Try Raku!
It's actually a lovely language, but uses terms like Rat, FatRat, Cool, slurp, spurt, iffy, diffy, slip, twigils...
Not to mention Unicode operators like ∪, ∩, ⊖, ∈, ∉, ⊆, «, », ∘
This is my favourite syntax:
grammar Parser { rule TOP { I <love> <lang> } token love { '♥' | love } token lang { < Raku Perl Rust Go Python Ruby > } }
say Parser.parse: 'I ♥ Raku'; # OUTPUT: 「I ♥ Raku」 love => 「♥」 lang => 「Raku」
say Parser.parse: 'I love Perl'; # OUTPUT: 「I love Perl」 love => 「love」 lang => 「Perl」
from the Raku programming language.
Perl 6 does not exist anymore, it is now developed as a totally separated language with a new name (Raku) to mark its new lineage.
Perl 5, on the other hand, is still being supported and improved on it's own – you're commenting on a new release of Perl5.
I'm not really involved in that community and surprisingly google didn't find much. However they are truely different languages, the homepage of each has code examples:
https://raku.org -> Download
brings you to a page with a frame which says :
> More Download Options
> Source archives, pre-compiled packages, ...
and has a button rakudo.org/downloads
which takes to https://rakudo.org/downloads
Then one select the tab Sources
(the monochrome flat design really doesn't help here).
And there... well there is the source, but the Github link appears only in the page footer (and you have to be familiar with Github brand logo), not in a better place than on any other page. There really ought to be a section in the text titled Development repository
with a proper link to the repository (and mirrors if any). And we shouldn't have to care if it hoisted at the Github company or anywhere else, BTW.
So I'd say :
This seems like something a bit difficult to solve in a nice way. You could put some kind of section explaining in just a bit more detail the difference between the specification and the implementation on the main raku.org website, and then link to the Rakudo source.
But I worry all that technical speak on the front page would be a little alienating to beginners. Raku is, as far as I can tell, a wonderful beginner language and I don't think the language front page should mix warmth and welcome with anything that makes a novice feel nervous because they're not Ada Lovelace or Alan Turing.
The Raku website FAQ linked at the top of the raku.org main page does have a link to the source code in it as part of an answer to "As an advanced user I want to track Rakudo development."
I'm sorry you had a problem finding what you wanted. I'll discuss making a pull request to the website documentation to make it easier.
When I'm talking at a conference, I sometimes talk about a programming language called raku which has support for rational numbers. Thus, I can do this:
$ raku -e 'say .1 + .2 - .3' 0
And, unsurprisingly, it prints 0. Most other programming languages fail:
$ ruby -e 'puts 0.1 + 0.2 - 0.3' 5.551115123125783e-17 $ python -c 'print .1 + .2 - .3' 5.55111512313e-17 $ echo "puts [expr .1+.2-.3]"|tclsh 5.551115123125783e-17 $ perl -E 'say .1 + .2 - .3' 5.55111512312578e-17
While the result is very small, it's not zero. That's because most programming languages default to using floating point numbers. Then I put up a slide of Mount Everest and point out that the mass of the sun multiplied by these "zero" amounts is roughly the mass of Everest.
Number 4 of the 361 RFCs from 20 years ago that kick-started raku was type inference.
The essence of Larry Wall's view of it is encapsulated in two comments by someone in 2005:
>Larry said that type inference is a possibility as long as it doesn't yell at you
>
>he's kind of punting the exact semantics of type inference
Around that time Audrey Tang wrote a post titled Complete type inferencing about a design she was developing for:
>a system that can decide on one of five classes of judgements for each internal language term
Raku has ended up with something like four of her five, but until I looked into this a few days ago I had always thought of it as not having any inference.
Raku supports block scoped variables and array/string slices.
My ShipComputer class (Perl 6 / Raku code).
Initially, my input and output were simply handled with @.input
and @.output
attributes, which worked until we needed to determine the next input element on the fly based on the output. So at that point I implemented &input-handler
and &output-handler
attributes; these handlers just default to reading from @.input
and appending to @.output
.
Because of these handlers, I can just call the run-program
method and let the program run to the end. If I need to intervene, I do it from these handlers.
I did need to add a interrupt
method on day 15 so that I could interrupt an infinite loop when I had the answers I needed.
On day 7, when we needed to run 4 chained amplifiers, I ran them in parallel and used Channel
s to pass the output of one to the next.