Questions tagged [rakudo]

Rakudo is a compiler for the Raku programming language running on the MoarVM virtual machine.

Rakudo is a Raku compiler running on the MoarVM, JVM and JavaScript.

Related links

189 questions
10
votes
3 answers

set PATH in azure pipelines in Windows

I am using Azure Pipelines to build a Rakudo binary for Raku (previously aka Perl 6) in Windows. This is my azure-pipelines.yml file: jobs: - job: Windows pool: vmImage: 'vs2017-win2016' steps: - bash: | mkdir -p…
Suman Khanal
  • 3,079
  • 1
  • 17
  • 29
10
votes
2 answers

How to return a value from a block's CATCH phaser?

What is the syntax to return a value from a CATCH phaser from a block which is not a Routine? sub foo() { <1 2 3>.map: -> $a { die 'oops'; CATCH { default { 'foo' } } } } sub bar() { <1 2 3>.map: -> $a { die…
J Hall
  • 531
  • 3
  • 10
10
votes
3 answers

How do I invoke a Java method from perl6

use java::util::zip::CRC32:from; my $crc = CRC32.new(); for 'Hello, Java'.encode('utf-8') { $crc.'method/update/(B)V'($_); } say $crc.getValue(); sadly, this does not work Method 'method/update/(B)V' not found for invocant of class…
user7610
  • 25,267
  • 15
  • 124
  • 150
9
votes
1 answer

How to add an attribute and its accessors in Raku using add_attribute()?

I have this program: class Foo { has $.first; } my $a = Attribute.new( :name('$!second'), :type(Int), :package('Foo'), :has_accessor(True) …
Fernando Santagata
  • 1,487
  • 1
  • 8
  • 15
9
votes
2 answers

Error install Inline::Perl5 with Zef (Raku)

I'm trying to install Raku on a Debian 11 x64. I never installed it before (perl5 too) It's a server with some Perl5 scripts, and I want to "use" it in Raku with the Inline::Perl5 (also I want to use Perl5 Module if I don't find what I want in Raku…
9
votes
1 answer

RAKUDO_RAKUAST=1 raku --target=ast is not yet available

It has been almost a year since I saw Jonathan Worthington presenting the new RakuAST in the YouTube video A Raku API to Raku programs the journey so far from TRC 2021. In the video, he showed that we could dump this new RakuAST using…
WhiteMist
  • 885
  • 4
  • 13
9
votes
2 answers

What's the point of Raku's 'mod' operator?

I previously incorrectly thought that the % operator returned the remainder and the mod operator returned the modulus (the remainder and modulus are the same when the operands are both positive or both negative but differ when one operand is…
codesections
  • 8,900
  • 16
  • 50
9
votes
1 answer

Destructuring assignment in object creation

As with my previous question, this is an area where I can't tell if I've encountered a bug or a hole in my understanding of Raku's semantics. Last time it turned out to be a bug, but doubt lightning will strike twice! In general, I know that I can…
codesections
  • 8,900
  • 16
  • 50
9
votes
2 answers

Raku equivalent to JavaScript's `setTimeout(fn, 0)`?

JavaScript's event loop uses a message queue to schedule work, and runs each message to completion before starting the next. As a result, a niche-but-surprisingly-common pattern in JavaScript code is to schedule a function to run after the messages…
codesections
  • 8,900
  • 16
  • 50
9
votes
1 answer

Could not find File::Find Raku on Windows 7

I've got a very simple program which lists all .txt files in a given directory. This program has run perfectly on my Mac which has the Rakudo Star version 2019.03.1 use File::Find; my $folder="../Documents"; .say for find dir => $folder, name =>…
Lars Malmsteen
  • 738
  • 4
  • 23
9
votes
1 answer

How to use hyperoperators with Scalars that aren't really scalar?

I want to make a hash of sets. Well, SetHashes, since they need to be mutable. In fact, I would like to initialize my Hash with multiple identical copies of the same SetHash. I have an array containing the keys for the new hash: @keys And I have my…
Mark Reed
  • 91,912
  • 16
  • 138
  • 175
9
votes
1 answer

Is it possible to do boolean assertions with raku regex?

In the apocalypses, there are some words about boolean assertions: <( code )> # call code as boolean assertion However, I cannot make it work. say "9471" ~~ m:g/ (\d) <($0 > 5)> / I expect to only match numbers greater than 5, but I get…
Julio
  • 5,208
  • 1
  • 13
  • 42
9
votes
2 answers

Install modules in other rakudo versions using rakubrew

When upgrading rakudo version using rakubrew, is pretty easy to change versions, but I wnat to know if it is posible to import raku modules from the older version to the new version. doign zef install automatically: to update: rakubrew build…
anquegi
  • 11,125
  • 4
  • 51
  • 67
9
votes
3 answers

how to cycle through list indefinitely and lazily in Raku?

This is mostly to geek out on how awesome Raku is. Question Are there built-in methods that will take a list and cycle through it indefinitely, producing, say, the lazy list a, b, c, a, b, c, ... out of (a, b, c)? Nothing in the documentation on…
grobber
  • 1,083
  • 1
  • 9
  • 20
9
votes
2 answers

Does anyone know why the TWEAK routine gets hit before the BUILD routine?

Minimal code: #!/usr/bin/raku class Widget { submethod TWEAK(:$content, :$styles) { say "t1\n"; } } class File is Widget { submethod BUILD() { say "b1"; } } my $xml = File.new(); And the output: t1 b1 To quote…
Timothy Nelson
  • 565
  • 3
  • 5