2,091 questions
Tooling
2
votes
2
replies
73
views
In Raku, how to assign a value but only if the value is defined?
I want to assign
my $FOO = $foo if $foo.defined;
I tried
my $FOO with= $foo;
but that doesn't work. Is there a canonical way to do this?
1
vote
1
answer
48
views
In Raku, how to import a module during runtime?
I would like to import Test::Color only when %*ENV<TEST_COLOR> is set.
I can't put use inside an if block, because use happens at compile time. I put require inside the if block, to no effect.
...
-3
votes
2
answers
188
views
Raku solution for discovering words for word puzzle [closed]
I would like to develop a raku script that can search a word list for words of the same length which contain the same characters except for one. For example 'castle' and 'cattle' would be appropriate ...
Advice
0
votes
4
replies
44
views
Two level export in Raku
I have a tree of modules Air::Base, Air::Base::Tools and so on, and I want to re-export the Air::Base::Tools enum from Air::Base to code that uses that.
Air::Base::Tools rakumod…
sub exports-air-base-...
5
votes
1
answer
128
views
get method objects using only spec'd features
Using only features from the Raku specification, i.e., not using any implementation-specific features, is there a way to get the method objects for a given class / object?
I'd like to do something ...
6
votes
1
answer
123
views
Too many positionals passed error with slurpy hash
I'm trying to understand this behavior/error message. If I pass a pair where the key is unquoted to a slurpy hash, it succeeds. If I pass a pair where the key is explicitly quoted to a slurpy hash I ...
Advice
3
votes
2
replies
120
views
How can I unconditionally evaluate two terms and return the first one evaluated?
Sometimes, I write code like
my $x = do {
my $result = get-result;
do-a-thing-that-would-change-result;
$result
};
. Whenever I do, I yearn for an operator to express this idea. You ...
5
votes
1
answer
96
views
Initializing required attributes without BUILD submethod
In Raku, is it, or will it ever be possible to set required private attributes without writing a BUILD submethod?
E.g., the following does not work:
class C {
has Str:D $!name is required;
}
C.new:...
7
votes
2
answers
233
views
How to use the raku operator 'ff'or 'fff' in a 'for lines()' loop
Given the input file:
----------------
A
----------------
information for A
on these lines
----------------
B
----------------
Something about B
on these lines
etc
I want to produce:
A: information ...
2
votes
1
answer
127
views
Why is the deep cloned object still linked?
Following the documentation and this SO answer I wrote the following class with clone method, but the tests in the code do not give the expected result.
use v6.d;
use Test;
class Numeration {
...
3
votes
2
answers
157
views
How to create a CL utility with an option set?
Background:
In build.rakumod I have several multi sub MAIN( ... ), one of which is:
multi sub MAIN(
:$config = 'config', #= localised config file
Bool :install($)!, #= install a config ...
5
votes
1
answer
171
views
Unable to print color when color code is taken from array
I have color codes stored in an array. I cannot print color when I take a color code from the array, but I can print color if I use the code directly in a "say" or "print" ...
1
vote
0
answers
132
views
I have a problem using the command line and Raku
This screen transcript pretty much says it all:
ftype
PerlScript=C:\strawberry\perl\bin\perl.exe "%1" %*
RakuScript=C:\rakudo\bin\raku.exe "%1" %*
assoc
.pl=PerlScript
.raku=...
2
votes
2
answers
206
views
Raku regex to match two consecutive dots but not three
I'm looking for a Raku regex that matches two or more consecutive dots unless there are three dots.
These strings should match:
Yes.. Please go away.
I have the ball..
In this case....I vote yes.
...
4
votes
0
answers
134
views
rakudo-star-2025.06.1 install failed
I have Linux kernel 5.15.0-94-generic. I downloaded rakudo-star-2025.06.1.tar.gz. I gunzip and tar xf in a directory, and in this directory, I do "./bin/rstar install" as I did with previous ...