raku Questions
0
I don't know if this is a bug, or I just don't understand what's happening. If I have a run statement as the last statement in a try block, any error in the run statement is not caught. If it is no...
1
Solved
Let's say I have simple socket listening in one thread and I want to hold another thread until port is opened and socket is actually listening. Which one is correct:
Using do? Documentation of do ...
Warrenwarrener asked 14/9, 2024 at 7:26
2
Solved
Is there an idiomatic way to pass a Regex from the command line to a Raku program. The following code accomplishes what I'm trying to do but it has a few issues (see below).
#!/bin/raku
use MONKEY...
Menes asked 14/8, 2024 at 23:3
1
Solved
I would like to use Raku's comb function with a regex from a Grammar instead of a standalone regex. For example, in the following code, which parses journalctl logs from stdin, I would like to repl...
Drew asked 8/8, 2024 at 13:15
4
Solved
I can write something like this (elem here is an XML::Element but it doesn't really matter):
for $elem.nodes {
when XML::Element { ... }
when XML::Text { ... }
...
default { note qq{Ignoring un...
Aparri asked 20/1, 2023 at 16:6
2
I'm creating an object for making HTTP requests like this:
$!ua = Cro::HTTP::Client.new(
base-uri => 'https://what.ever/api/',
content-type => 'application/json'
);
but one of the API en...
1
Solved
I really like the syntax of a pair :3melee which means melee => 3. I'd like to do the following:
my Creature $creature .= new(:fire-resist);
$creature.damage: :3melee;
$creature.damage: :3fire;
...
Pimpernel asked 29/7, 2024 at 19:4
1
Solved
I've created a simple program based on the Raku parsefile example provided here. The contents of my Raku file are:
grammar Names {
token TOP { [<name><.ws>]+ }
token name { <:alpha...
2
Is it possible to write a META6.json file that
prints a message that the operating system is not supported
and does not try to install the module
if the operating system is Windows?
Itinerary asked 29/5, 2024 at 14:58
2
Solved
I have this .bib file for reference management while writing my thesis in LaTeX:
@article{garg2017patch,
title={Patch testing in patients with suspected cosmetic dermatitis: A retrospective study...
1
Solved
The documentation says that there are only 3 special lexical variables ($_, $/, $!).
However, inspecting the MY:: pseudostash, it seems that a variable named $¢ also exists, and is undocumented (or...
Ainslee asked 11/5, 2024 at 23:18
1
Solved
While making use of a Range to solve a problem I noticed that a Range with 0 elems would be True as a Bool. In what scenarios could a Range be False?
[0] > (^0).so
True
[1] > (1..0).so
True
...
1
Solved
This is the simple program, it prints a terminal size when you resize it:
#!/bin/env raku
use NCurses;
initscr;
loop {
given getch() {
when 27 { last } # exit when pressing esc
when KEY_RESIZE {...
Emlen asked 3/4, 2024 at 23:30
1
Solved
I am updating a raku module (Physics::Measure)
My old code looks like this:
unit module Physics::Measure ...
class Length is Measure is export {}
class Mass is Measure is export {}
class Current i...
Myongmyopia asked 3/4, 2024 at 15:11
0
If I use OUTA as a label name it works, but OUTER doesn't:
OUTA: say OUTA.^name; # Label
OUTER: say OUTER.^name; # OUTER
Thus:
OUTA: loop { last OUTA } # works
OUTER: loop { last OUTER } # fails (...
Manstopper asked 31/3, 2024 at 7:24
1
Solved
I would like to be able to add a sub to a module Foo at runtime.
In Perl, I would do something like:
*{'My::Module::foo'} = \sub { 'FOO!' };
I know Raku doesn't have TypeGlobbing like Perl. Ideall...
Adularia asked 17/3, 2024 at 15:15
5
Solved
Does perl6/Rakudo have something equivalent to perl5's __DATA__ or __END__ sections?
3
Solved
In the docs for class List, it says:
routine map
multi method map(Hash:D \hash)
multi method map(Iterable:D \iterable)
multi method map(|c)
multi method map(\SELF: &block;; :$label, :$item)...
Retorsion asked 19/2, 2024 at 18:50
1
This seems crazy to me:
use v6.d;
say "Before division by zero!";
my $result = divide(3, 0);
say "After division by zero!";
sub divide($a, $b) {
my $result;
$result = $a / $...
Atomic asked 23/2, 2024 at 18:52
2
I expected the refinement of the Any type to Str|True would make the name type match any Str or True, but this is what I see:
subset name of Any where Str|True;
sub go(name :$x) {
say $x;
}
go(x...
Oaf asked 22/2, 2024 at 14:17
1
Solved
Example 1:
#!/usr/bin/env raku
use v6.d;
sub MAIN(Int $int) {
say 'parameter $int: ', $int.^name;
}
--output:--
$ raku b.raku 10
parameter $int: IntStr
Example 2:
#!/usr/bin/env raku
use v6.d;...
Eyestalk asked 17/2, 2024 at 18:57
1
Solved
I am adding a feature to a package that optionally uses DBIish. I would like to write a few unit tests to ensure that the functionality is working. However, DBIish should be an optional dependency,...
Zenda asked 11/2, 2024 at 22:2
3
Solved
This raku documentation page says operator ,= is supposed to concatenate
the contents of the variable on the left hand side and the expression on the right hand side
in a class-dependent way....
3
Solved
I am doing some exercise from the book Grokking Functional Programming, the origin code examples are written in Scala, and I want to rewrite it with Raku.
In Scala's cats effect library, there is a...
Sherard asked 4/2, 2024 at 7:57
1
Solved
You can specify that a regular expression should only match if all its constituents match by using a conjunction, && or &:
[4] > 'ready' ~~ / r..dy & .ea.. /
「ready」
[5] > 'ro...
1 Next >
© 2022 - 2025 — McMap. All rights reserved.