Questions tagged [raku]

For questions relating to the Raku programming language (formerly known as Perl 6).

Raku

Raku is an expressive and feature-rich programming language designed by Larry Wall and developed by the community.

Features include:

  • Object-oriented programming
  • Functional programming primitives
  • Parallelism
  • Concurrency
  • Asynchrony
  • Definable grammars for pattern matching and generalized string processing
  • Optional and gradual typing
  • Extensive Unicode support from code points to grapheme clusters
  • Multiple dispatch
  • Introspection
  • Rational numbers

is a Raku implementation that targets multiple back ends.

The MoarVM back end is recommended for normal use, but back ends for the Java Virtual Machine and JavaScript are also under active development.

The Rakudo implementation shipped a first official release named “коледа” on December 25, 2015. Most of the specification is frozen, and optimizations are ongoing.

Official links

1993 questions
5
votes
1 answer

Behaviour of feed operator pipeline

I'm experimenting with the feed operator using the following code: my $limit=10000000; my $list=(0,1...4); sub task($_,$name) { say "Start $name on $*THREAD"; loop ( my $i=0; $i < $limit; $i++ ){}; say "End $name"; Nil; } sub stage(…
drclaw
  • 2,463
  • 9
  • 23
5
votes
2 answers

Useless use of "-" in expression "-1" in sink context (line 13)

I'm trying to make tests for a function that throws an exception with this code: use v6; use Test; plan *; use lib "lib"; use Math::ConvergenceMethods; sub f ($x) {return $x + 1;} { is-approx: bisection(&f, -2, 0), -1; dies-ok: {…
Antonio Gamiz Delgado
  • 1,871
  • 1
  • 12
  • 33
5
votes
2 answers

Capturing a module output

Say we have this module: unit module outputs; say "Loaded"; And we load it like this use v6; use lib "."; require "outputs.pm6"; That will print "Loaded" when it's required. Say we want to capture the standard output of that loaded module. We…
jjmerelo
  • 22,578
  • 8
  • 40
  • 86
5
votes
2 answers

invert needs a Pair?

The invert method for Lists should return the inverted sequence, or at least that's what the source seems to imply. However: say (1,3,2).invert fails with: (exit code 1) Type check failed in invert; expected Pair but got Int (1)␤ in block…
jjmerelo
  • 22,578
  • 8
  • 40
  • 86
5
votes
1 answer

Terminal ANSI colors does not work with Inline::Perl5 (Data::Printer)

The following Perl 5 script: use strict; use warnings; use Data::Printer; my @a = (1,2,3,4); p @a; gives output: (note the blue color), whereas this Perl 6 scripts: use Data::Printer:from; my @a = 1,2,3,4; p @a; gives output: [ [0]…
Håkon Hægland
  • 39,012
  • 21
  • 81
  • 174
5
votes
1 answer

Installing Linenoise for Perl6 on CentOS: cannot find library "luv"

I'm trying to install Linenoise for zef in perl6. user@centos:/illumina/runs/Scripts/perl6/zef$ sudo bin/zef install Linenoise --force-build ===> Searching for: Linenoise ===> Searching for missing dependencies: LibraryMake ===> Searching for…
con
  • 5,767
  • 8
  • 33
  • 62
5
votes
2 answers

Mix syntax for Boolean elements

If I try to declare a Mix with Boolean components: my $mix= (True => 0.3, False => 0.7).Mix; dd $mix; # OUTPUT: «Mix $mix = ("True"=>0.3,"False"=>0.7).Mix␤» They use Pair syntax, which quotes automatically those bare identifiers. In order to avoid…
jjmerelo
  • 22,578
  • 8
  • 40
  • 86
5
votes
1 answer

Cumulative Z op throws a "The iterator of this Seq is already in use/consumed by another Seq"

This is another way of solving previous question my @bitfields; for ^3 -> $i { @bitfields[$i] = Bool.pick xx 3; } my @total = [\Z+] @bitfields; say @total; It should zip-add every row to the next one, and accumulate the value. However, this…
jjmerelo
  • 22,578
  • 8
  • 40
  • 86
5
votes
1 answer

Why is PSIXDISTS excluded from modules.perl6.org's rsync?

The script for retrieving all Perl 6 modules available on CPAN in modules.raku.org's DbBuilder.pm explicitly excludes any distributions from PSIXDISTS, even though there's a number of modules available in that namespace. What is the reason behind…
Tyil
  • 1,797
  • 9
  • 14
5
votes
1 answer

Perl6 regex not matching end $ character with filenames

I've been trying to learn Perl6 from Perl5, but the issue is that the regex works differently, and it isn't working properly. I am making a test case to list all files in a directory ending in ".p6$" This code works with the end character if…
con
  • 5,767
  • 8
  • 33
  • 62
5
votes
2 answers

Is it possible to make compile-time code non-cached in Perl 6?

Let's say I want to create a number of types at compile-time, but before that let's test compile-time code with a simpler example: # in file root.pm6 sub foo($a) { $a.say } sub EXPORT { # Things here may be a lot more complex foo 1; foo…
Takao
  • 1,016
  • 6
  • 11
5
votes
1 answer

Can one perl6 module conditionally 'use' another perl6 module?

Is there a sensible way to have one perl6 module check for the presence of another perl6 module and to 'use' it if and only if it is installed? Something like this... module Polygons; if $available { use Measure; #only if Measure…
librasteve
  • 6,832
  • 8
  • 30
5
votes
1 answer

Rules for barewords

Barewords can be used at the left hand side of Pair declarations (this is not documented yet, I'm addressing this issue right now, but I want to get everything right). However, I have not found what is and what's not going to be considered a…
jjmerelo
  • 22,578
  • 8
  • 40
  • 86
5
votes
2 answers

When does BEGIN actually start (or is run)?

This is related to this issue in the Perl 6 documentation repo It's not too clear the phase in which BEGIN blocks are actually run. Documentation says "compile time", but Perl is precompiled, so that might actually be precompile time. As a matter…
jjmerelo
  • 22,578
  • 8
  • 40
  • 86
5
votes
1 answer

Obtaining the QAST of a Perl 6 file from another program

This is related to this question on accesing the POD, but it goes further than that. You can easily access the Abstract Syntax Tree of a Perl 6 program using: perl6 --target=ast -e '"Þor is mighty!".say' This will print the whole Q abstract syntax…
jjmerelo
  • 22,578
  • 8
  • 40
  • 86
1 2 3
99
100