Skip to main content
Filter by
Sorted by
Tagged with
6 votes
2 answers
164 views

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 ...
Norman Gaywood's user avatar
2 votes
1 answer
116 views

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 { ...
Richard Hainsworth's user avatar
3 votes
2 answers
150 views

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 ...
Richard Hainsworth's user avatar
5 votes
1 answer
167 views

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" ...
lisprogtor's user avatar
  • 5,871
1 vote
0 answers
118 views

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=...
hsmyers's user avatar
  • 721
2 votes
2 answers
200 views

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. ...
jubilatious1's user avatar
  • 2,473
4 votes
0 answers
129 views

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 ...
lisprogtor's user avatar
  • 5,871
3 votes
1 answer
133 views

Background: There are a number of modules in the local lib eg Eg-1.rakumod Eg-2.rakumod Eg-3.rakumod, each Eg-\d is referenced in META6.json file, and each module has the code sub SITE is export { ... ...
Richard Hainsworth's user avatar
2 votes
1 answer
129 views

While binding works as I expected, assignment doesn't: my ($a, @b, $c) := (42, <a b c>, 42); say [$a, @b, $c]; # OUTPUTS: [42 (a b c) 42] my ($d, @e, $f) = (42, <a b c>, 42); say [$d, @e, ...
fingolfin's user avatar
  • 924
2 votes
2 answers
217 views

When using a CLI it is possible to pipe the contents of a fil through uniq. Is there an analogy of the GNU uniq -c function in Raku ? For example, one two one three one two four five is transformed ...
Richard Hainsworth's user avatar
5 votes
3 answers
176 views

The response to an HTTP request is a string like 'one=iwejdoewde&two=ijijjiiij&three=&four=endinghere' I want to put this query into a hash. My solution is my $s = 'one=iwejdoewde&two=...
Richard Hainsworth's user avatar
7 votes
2 answers
230 views

I can parallelize execution using Hyper and it works: $ raku -e 'race for (^8).race(batch => 1, degree => 4) {sleep rand; .say}' 0 3 5 2 1 7 4 6 But how can I add gather/take behavior to such ...
Pawel Pabian bbkr's user avatar
5 votes
2 answers
167 views

I have a hash with several layers of sub-hashes, and I want to alter all the modified fields in the bottom layer. The hash has the following structure %sources{$lang}{$filename}{$attribute} The code ...
Richard Hainsworth's user avatar
6 votes
0 answers
167 views

I'm looking for the right way to write asynchronous routines. Here's a hypothetical example of some asynchronous javascript function: async function someFunction() { const data = await Promise....
fingolfin's user avatar
  • 924
5 votes
1 answer
125 views

Let's say we have the following subroutine: sub test($arg = 'defaut value') { say $arg } And we want to pass some argument that will cause the subroutine to use the default value, something like this:...
fingolfin's user avatar
  • 924
5 votes
1 answer
161 views

Raku has an interesting and exciting recursive-regex notation: <~~>. So in the REPL, we can do this: [0] > 'hellohelloworldworld' ~~ m/ helloworld /; 「helloworld」 [1] > '...
jubilatious1's user avatar
  • 2,473
3 votes
1 answer
166 views

Reproducing Sorry, I couldn't come up with an MRE. My code is on glot.io. It isn't perfect, because it's autogenerated. Here are steps to reproduce: Step 1 Compile the code: time raku --stagestats ...
fingolfin's user avatar
  • 924
4 votes
2 answers
166 views

I keep asking questions about sets in Raku to several AIs. Now I asked again a question about sets in Raku to Deepseek. It gave me the following example # Create a mutable SetHash my %set := SetHash....
zentrunix's user avatar
  • 2,266
5 votes
3 answers
152 views

I want to write a Raku grammar to check a monthly report about work contribution factors, written in Racket/Scribble. The report is divided, at the highest level, into monthly sections, and beneath ...
sailortailorson's user avatar
6 votes
1 answer
92 views

There is an example: class A is Array { has $.member = 42; } my $a = A.new: 1..10; say $a.member; # OUTPUT: «(Any)␤» Why doesn't it work? I also tried submethods TWEAK and BUILD, they also can't ...
fingolfin's user avatar
  • 924
9 votes
1 answer
402 views

I have guessed multiple syntax variations to achieve this in a single line in the MAIN function. I know I could achieve it in two separate lines, but am looking for the cleaner solution and only ...
David Gordon's user avatar
6 votes
1 answer
131 views

Is there a more idiomatic way to create a hash with a sub-set of keys from another hash. Currently I have: a-subroutine('param', %(:$level, :id(%prm<id>), :target(%prm<target>), ...
Richard Hainsworth's user avatar
6 votes
2 answers
136 views

I am attempting to wrap a Raku based web app in a dockerfile. I am using the Cro web framework but I cannot seem to install the Cro successfully. I tried the dockerfile below: # Use the official ...
Seamus Brady's user avatar
7 votes
4 answers
411 views

The Best Regex Trick is about writing regexes that match r1 but not r2. The example they give is a regex that matches Tarzan (and "Tarzan and Jane") but not "Tarzan". After going ...
Hovercouch's user avatar
  • 2,282
6 votes
1 answer
124 views

I'm not totally sure if this is a bug, a quirk, or simply a bad practice, but this is what happens: [0] > my @nope = [["a","b"]]; @nope.push: ["b","c"] [a b [...
jjmerelo's user avatar
  • 23.6k
5 votes
1 answer
192 views

I a trying to translate this F# code to Raku for learning purposes: type Meat = Chicken | Beef | Pork | Fish | Veggie type Ingredient = | Cheese | Rice | Beans | Salsa | Guacamole | SourCream | ...
librasteve's user avatar
  • 7,641
6 votes
1 answer
138 views

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 not ...
JustThisGuy's user avatar
  • 1,189
10 votes
1 answer
201 views

[23] > my $now = DateTime.now 2024-09-29T14:59:10.178051+08:00 [24] > my $eight-hours-later = Date.today.DateTime.later(:8hours) 2024-09-29T08:00:00Z [25] > $now - $eight-hours-later -3649....
ohmycloudy's user avatar
7 votes
1 answer
174 views

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 ...
Pawel Pabian bbkr's user avatar
4 votes
1 answer
105 views

I have some questions regarding defining bareword operators in Raku. As it stands in the language, there are a variety of bareword operators, such as div, mod, gcd, & lcm. As I'm curious about the ...
Atlas Sullivan's user avatar
6 votes
2 answers
221 views

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-...
mikeLundquist's user avatar
6 votes
1 answer
151 views

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 replace ...
mikeLundquist's user avatar
6 votes
2 answers
140 views

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/...
VZ.'s user avatar
  • 22.9k
6 votes
1 answer
124 views

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; so ...
Dmitry Matveyev's user avatar
4 votes
1 answer
143 views

I have an enum definition in a module AAA: enum RDProcDebug <None All AstBlock BlockType Scoping Templates MarkUp>; class Debug { method foo(RDProcDebug @ds) { for @ds { say .key ~ ' =>...
Richard Hainsworth's user avatar
4 votes
2 answers
124 views

Running this piece of code use v6.d; role DrawSurface { ... }; enum Surface does DrawSurface <Fire>; role DrawSurface { method draw () { given self { when Surface::...
Dmitry Matveyev's user avatar
4 votes
1 answer
125 views

Is there a way to configure Raku actions to only execute after a parse has completed successfully? For example, the program below outputs "Jane is telling us her age....", even with ...
user2023370's user avatar
  • 11.3k
5 votes
1 answer
164 views

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&...
user2023370's user avatar
  • 11.3k
4 votes
1 answer
108 views

I have a number of plugin classes each of which have a method 'enable'. The following code works unit class Top; has $!rdp; use Plugin::A; use Plugin::B; use Plugin::C; submethod TWEAK { my $rdp := ...
Richard Hainsworth's user avatar
5 votes
1 answer
167 views

I have about 75000 files and I need to search each file for a set of key phrases stored in an array. I have Intel i9 capable of running 20 threads. I am trying to speed up the whole process by ...
lisprogtor's user avatar
  • 5,871
5 votes
2 answers
195 views

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?
sid_com's user avatar
  • 25.4k
3 votes
1 answer
118 views

unit module My::Show; sub show (:$indent = False) is export { if $indent { say " Showing with indentation."; } else { say "Showing without indentation.";...
Jim Bollinger's user avatar
13 votes
1 answer
621 views

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 at ...
biancospino's user avatar
3 votes
1 answer
156 views

I have an enum list with actions and the members None and All. How do I create a sequence of enums that filters out None and All? Test program in file filter-enum.raku: #!/usr/bin/env raku use v6.d; ...
Richard Hainsworth's user avatar
6 votes
1 answer
93 views

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
Daniel Mita's user avatar
4 votes
2 answers
122 views

Apologies for the long question. I am working on the raku Net::Google::Sheets module. Currently it does a good job of successfully using OAuth2::Client::Google and getting and putting a 2D Array from/...
librasteve's user avatar
  • 7,641
8 votes
1 answer
165 views

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 ...
fingolfin's user avatar
  • 924
6 votes
1 answer
111 views

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 ...
librasteve's user avatar
  • 7,641
8 votes
0 answers
125 views

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 (...
AlvaPan's user avatar
  • 619
8 votes
1 answer
162 views

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. Ideally ...
Rawley Fowler's user avatar

1
2 3 4 5
42