Multi Paradigm
Smoothly combine coding styles:
- Object-Oriented:
class Circle encapsulates data and behavior.
- Functional: built-ins like
.map and operators like
». and
[+] .
- Declarative:
... infers sequences, such as the powers of two.
- Procedural: the overall code flow is straightforward.
...natural syntax & semantics
class Circle {
has $.radius;
method area { π * $.radius² }
}my @radii = 1,2,4...256;
my @circles = map { Circle.new(:$^radius) }, @radii;
my $total-area = [+] @circles».area;
say "Total area: $total-area";
Grammars
Definable grammars for pattern matching and generalized string processing.
...domain specific languages
grammar Parser {
rule TOP { I <love> <lang> }
token love { '♥' | love }
token lang { < Raku Rust Go Python Ruby TypeScript PHP > }
}say Parser.parse: 'I ♥ Raku';
say Parser.parse: 'I love Python';
Unicode Regexes
The most powerful Unicode-aware regular expression engine available, especially for complex text processing.
It shines in tasks where precision and multilingual support are essential such as Grapheme and Diacritic handling.
...unicode centric text handling
say "Cool😎" ~~ /<:Letter>* <:Block("Emoticons")>/; say "Cześć" ~~ m:ignoremark/ Czesc /; say "WEIẞE" ~~ m:ignorecase/ weisse /; say "หนูแฮมสเตอร์" ~~ /<:Letter>+/;