I have a piece of asyncronous code I would like to run at a later date. I figured a Promise would suit this purpose fine.
So far this is what I have:
sub makePromise ( $o, $m, :$in = 0, :$args = @() ) {
my $p = Promise.new;
for $args {
I have a piece of asyncronous code I would like to run at a later date. I figured a Promise would suit this purpose fine.
So far this is what I have:
sub makePromise ( $o, $m, :$in = 0, :$args = @() ) {
my $p = Promise.new;
for $args {
RakuAST::StatementList.new(
RakuAST::Statement::Use.new(
module-name => RakuAST::Name.from-identifier("Cro::HTTP::Router")
),
RakuAST::Call::Name.new(
name => RakuAST::Name.from-identifier("route"),
args => RakuAST::ArgList.new(
RakuAST::Block.new(
body => RakuAST::Blockoid.new(
Over the weekend, I wrote a module to do just that. It's early days still, as I'm sure there are tags that are not covered. I'll need to find the spec and have a nice long sit down before it's complete.
Here's what I have, though.
Have fun!
use XML::Class;
The BQN list operator ‿
can readily transfer into Raku. It's basically the same as Raku's list operator: ,
.
There is a small devil in the detail and that can be illustrated in the following example:
multi sub infix:<‿> ($a, $b) {
infix:<,>($a, $b)
}
say 1‿2‿3; # ((1 2) 3)
I was just introduced to BQN, recently. While it won't be my first choice of language until I understand it a lot more, it does provide an interesting insight into all things Listy.
So I thought I might grab some low hanging fruit and bring some of that BQN goodness into Raku, a language that I -am- using on the daily.
Here's an implementation for the Range operator (↕):
multi sub prefix:<↕>(List() $l) {
I went to [bart.gooogle.com] and asked it: "How do you write lambda functions in Raku?"
Here's how it responded:
===
To write lambda functions in Raku, you can use the following syntax:
Code snippet
raku -Ilib -e 'use experimental :rakuast; use MONKEY-SEE-NO-EVAL; my $ast = RakuAST::Statement::Need.new( module-names => [ RakuAST::Name.from-identifier(RakuAST::Name.from-identifier("GLib::Raw::Definitions")) ] ); EVAL $ast; import ::("GLib::Raw::Definitions"); glib.say'
This is the exact testing data. It's execution ready if you clone p6-GLib, you should
only need to change into the project directory and run the above. Otherwise you will have to create a .rakumod file
with a constant declaration and replace the glib
in the above script with the name of that constant.
So I needed to access the symbol table of one of my modules, recently. After a few hours on the web (and after wracking my brain for a bit) I came up with the following:
sub getSymbolTable (\T, $cu-name) is export {
return Nil unless $cu-name;
my $nodes = $cu-name.split('::').Array;
my $fn = $nodes.shift;
my $st = T.WHO{$fn};
Does anyone see a problem with this? If so, I will submit the PR.
diff --git a/src/core.c/RakuAST/Deparse.pm6 b/src/core.c/RakuAST/Deparse.pm6
index ef073dbba..62410a414 100644
--- a/src/core.c/RakuAST/Deparse.pm6
+++ b/src/core.c/RakuAST/Deparse.pm6
@@ -619,6 +619,9 @@ class RakuAST::Deparse {
my $target := $ast.target;
Version 0.0.2 - Now includes attributes!
RakuAST::ApplyDottyInfix - (ast/expressions.rakumod - 923)
Attributes
RakuAST::DottyInfixish $.infix
RakuAST::Expression $.left
RakuAST::Postfixish $.right