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
6
votes
1 answer

Probable version skew in pre-compiled xxx

I'm installing a package onto a virtual machine(ubuntu18.04). Here are the instructions I used: apt-get install perl6 && \ git clone https://github.com/ugexe/zef.git && cd zef && perl6 -I. bin/zef install . && \ /usr/lib/perl6/site/bin/zef install…
lovetomato
  • 903
  • 5
  • 11
6
votes
1 answer

Logical problem with "one" junction in Perl6

I am having some trouble with .one junction and range match: > say (3,5).any ~~ (1 .. 9) any(True, True) > say so (3,5).any ~~ (1 .. 9) True > say so (3,5).one ~~ (1 .. 9) False > say so (3,0).one ~~ (1 .. 9) # expect True because 0 not in range…
lisprogtor
  • 5,677
  • 11
  • 17
6
votes
3 answers

Defined vs. exists with Raku hash keys

I am learning Raku from Perl. I am looking at the adverb :exists https://docs.raku.org/type/Hash#:exists but there isn't a :defined adverb but I am concerned because there is a distinction between perl's exists & defined: What's the difference…
con
  • 5,767
  • 8
  • 33
  • 62
6
votes
2 answers

Get a symbol's value by its name in a sub

I'm making a package, where I have to get a symbol's value by its name in a sub, while the symbol is defined outside the sub. Here is the simplified code, it works as expected: #! /usr/bin/env perl6 sub dump_value($symbol) { say…
lovetomato
  • 903
  • 5
  • 11
6
votes
2 answers

Cannot import Perl5 module using Inline::Perl5 into Perl6

I'm trying to import a Perl5 module I really like https://metacpan.org/pod/Data::Printer using advice from the manual page https://modules.perl6.org/dist/Inline::Perl5:cpan:NINE using a very simple script use Inline::Perl5; my $p5 =…
con
  • 5,767
  • 8
  • 33
  • 62
6
votes
1 answer

Last element of a block thrown in sink context

This program my @bitfields; for ^3 -> $i { @bitfields[$i] = Bool.pick xx 3; } my @total = 0 xx 3; for @bitfields -> @row { @total Z+= @row; } say @total; says [0 0 0]. If we add something to the loop, whatever: my @bitfields; for ^3 -> $i…
jjmerelo
  • 22,578
  • 8
  • 40
  • 86
6
votes
1 answer

How to prevent the perl compiler from changing the name of dynamic link library

I'm making a perl6 package which contains some c source files that will be compiled into a dynamic link library. I found that the name of the library, such as libperl.so, will be changed into something like "A858A3D6EC5363B3D3F59B1.so" after "zef…
lovetomato
  • 903
  • 5
  • 11
6
votes
1 answer

`Missing or wrong version of dependency` after recompiling nqp

I am trying to learn myself how to debug rakudo and nqp. So this is my first attempt: cd $HOME/debug git clone https://github.com/rakudo/rakudo.git cd rakudo perl Configure.pl --gen-moar --gen-nqp --backends=moar make make install # installs into…
Håkon Hægland
  • 39,012
  • 21
  • 81
  • 174
6
votes
3 answers

Perl6 one liner execution. How is the topic updated?

Executing the one liner to process CSV a line at a time from stdin: perl6 -ne 'my @a; $_.split(",").kv.map: {@a[$^k]+=$^v}; say @a; ENTER {say "ENTER"}; BEGIN {say "BEGIN"}; LEAVE {say "LEAVE"}; END {say "END"}'; Typing in: 1,1 1,1 ^D Gives the…
drclaw
  • 2,463
  • 9
  • 23
6
votes
2 answers

Running command in perl6, commands that work in shell produce failure when run inside perl6

I'm trying to run a series of shell commands with Perl6 to the variable $cmd, which look like databricks jobs run-now --job-id 35 --notebook-params '{"directory": "s3://bucket", "output": "s3://bucket/extension", "sampleID_to_canonical_id_map":…
con
  • 5,767
  • 8
  • 33
  • 62
6
votes
1 answer

How to cache and use the cached regexes in perl6 grammar?

My code spends a lot of time on regex interpolation. As the patterns rarely change, I guess caching these generated regexes should speed up the code. But I cannot figure out a right way to cache and use the cached regexes. The code is used to parse…
lovetomato
  • 903
  • 5
  • 11
6
votes
1 answer

How to download a binary file with HTTP::UserAgent

I'm trying to download a file using HTTP::UserAgent, but all my attempts thus far have ended with the following error. Malformed UTF-8 I've tried to use the getstore sub, exported in the :simple subset. getstore($upstream ~ %module,…
Tyil
  • 1,797
  • 9
  • 14
6
votes
1 answer

Defining own CONTROL exception

The subject says it all: can I define own control exception which would handled by the CONTROL block? Applying the X::Control role is useless: class CX::Whatever does X::Control { method message { "" } } do { …
Vadim Belman
  • 1,210
  • 6
  • 15
6
votes
1 answer

Can modules be hotpatched?

I want to be able to hotpatch modules while the program is running for a project I'm working on. I tried this, but it doesn't work: qx[rm -r .precomp/*]; try require PSBot; try PSBot.test; Is it possible to do? If so, how can I do it?
Kaiepi
  • 3,230
  • 7
  • 27
6
votes
3 answers

Unable to write a grammar in perl6 for parsing lines with special characters

I have the code in: https://gist.github.com/ravbell/d94b37f1a346a1f73b5a827d9eaf7c92 use v6; #use Grammar::Tracer; grammar invoice { token ws { \h*}; token super-word {\S+}; token super-phrase { [\h ]*} …
RavBell
  • 103
  • 1
  • 8