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

Perl 6 - Subroutine taking "Bareword" input

So I've been diving into Perl 6 and have been looking at interpreting another language using Perl 6's operator definitions. I understand that this could be done by parsing the code but I'm looking to push Perl 6's capabilities to see what it can do.…
Phyreprooph
  • 517
  • 2
  • 13
6
votes
1 answer

A constructor with only 1 argument in Perl 6

I want to override new so that my class can be created only by passing one argument to the constructor, no more and no fewer. class MyClass { has $.var1; method new($var1) { return MyClass.new(var1 => $var1); } } my $my_class1 =…
user266003
6
votes
1 answer

Will writing module in NQP (Not Quite Perl) speed up perl6 program?

NQP was mainly designed to bootstrap the perl6 language, but I'm thinking whether it is possible to use it as optimization. I know that rakudo is not perfectly optimized yet, but I'm looking for a long term approach. Perl6 has some low level data…
teodozjan
  • 913
  • 10
  • 35
6
votes
1 answer

How does hybrid typing work?

Wikipedia says "Perl 6 offers a hybrid typing system whereby the programmer may choose to use static typing, use dynamic typing, or mix the two." How does hybrid typing work? Does using static typing in Perl simply mean that I declare a type, and…
Jeff Linahan
  • 3,775
  • 5
  • 37
  • 56
6
votes
2 answers

Use of colon in method and function calls in Perl 6

I'm wondering what colons have to do with method and function calls in Perl 6. For the record, I am using perl6 version 2015.05-55-gd84bbbc built on MoarVM version 2015.05. I just saw the following in a Perl6 spec test (S32-io) (I added the…
Christopher Bottoms
  • 11,218
  • 8
  • 50
  • 99
6
votes
1 answer

In perl6, how do you read a file in paragraph mode?

data.txt: hello world goodbye mars goodbye perl6 hello perl5 myprog.py: my $fname = 'data.txt'; my $infile = open($fname, :r, nl => "\n\n"); for $infile.lines(nl => "\n\n") -> $para { say $para; say '-' x 10; } Actual output: hello…
7stud
  • 46,922
  • 14
  • 101
  • 127
6
votes
2 answers

parse string with pairs of values into hash the Perl6 way

I have a string which looks like that: width=13 height=15 name=Mirek I want to turn it into hash (using Perl 6). Now I do it like that: my $text = "width=13\nheight=15\nname=Mirek"; my @lines = split("\n", $text); my %params; for @lines { (my…
user983447
  • 1,598
  • 4
  • 19
  • 36
6
votes
1 answer

When can I use the Whatever star?

Following this post on perlgeek, it gives an example of currying: my &add_two := * + 2; say add_two(5); # 7 Makes sense. But if I swap the + infix operator for the min infix operator: my &min_two := * min 2; say min_two(5); # Type check failed in…
Phil H
  • 19,928
  • 7
  • 68
  • 105
6
votes
1 answer

Singleton Implementation in Perl 6

What is the correct implementation of singleton pattern in perl6? I've tried this but I dont' know how to use static keyword in perl6:
teodozjan
  • 913
  • 10
  • 35
5
votes
3 answers

Creating a raku module for zef upload

I've created a new Raku module and uploaded with fez, all working fine. dist.ini file in the top directory. There are directives such as ReadmeFromPOD which don't seem to do anything. Is this file still needed? Seems to be a legacy issue from perl…
Kim Ryan
  • 515
  • 1
  • 3
  • 11
5
votes
1 answer

How to debug a Raku program

I looked at the documentation, but I didn't quite understand how to debug. I use the raku-debug command, but it reports an error: Could not find Debugger::UI::CommandLine. When I tried to search on zef, I didn't find any results. Does Raku have a…
陈易之
  • 59
  • 1
5
votes
2 answers

Does Perl 6 make any promises about the order alternations will be used?

Given an alternation like /(foo|foobar|foobaz)/ does Perl 6 make any promises about which of the three will be used first, and if it does where in the documentation does it make that promise? See the related question Does Perl currently (5.8 and…
Chas. Owens
  • 64,182
  • 22
  • 135
  • 226
5
votes
1 answer

What's the difference between $.attribute and self.attribute inside a class in Raku?

For example, in this class Foo both methods b and c return the same value: class Foo { method a { 42 } method b { $.a } method c { self.a } } my $foo = Foo.new; say $foo.a; #=> 42 say $foo.b; #=> 42 say $foo.c; #=> 42 I noticed…
uzluisf
  • 2,586
  • 1
  • 9
  • 27
5
votes
1 answer

Foldcase conversion between (German) lower ß (U+00DF) and upper ẞ (U+1E9E)?

According to Wikipedia, in 2017 using an uppercase ẞ (Unicode U+1E9E) was officially adopted--at least as an option--for what may in fact be a subset of fully-capitalized words in German: In June of that year, the Council for German Orthography…
jubilatious1
  • 1,999
  • 10
  • 18
5
votes
1 answer

How to use LibXML::Reader?

raku freezes when trying to use LibXML::Reader. use v6; use LibXML::Reader; sub dump-node($reader) { printf "%d %d %s %d\n", $reader.depth, $reader.nodeType, $reader.name, $reader.isEmptyElement; } my LibXML::Reader $reader .=…
zentrunix
  • 2,098
  • 12
  • 20