Rakumap
Machine-written Raku programs, each run under the reference compiler and under Raku++.
Rakumap writes small Raku programs by machine, runs each one under Rakudo 2026.08, the reference compiler, and under Raku++ 5.0.0-g312cde8e, the engine behind this site, and compares what they print. Below are 207 of those programs, sorted by topic. Open one to see both outputs side by side, change the code and run it yourself.
Recorded 2026-09-29 with Rakudo 2026.08 and Raku++ 5.0.0-g312cde8e.
How to read these results
- ✓ Same as Rakudo Raku++ prints exactly the same text as Rakudo.
- ✓ Both reject it The program is broken on purpose, and both compilers refuse to run it. That is the right answer.
- ≠ Differs from Rakudo The outputs are not the same. That is a lead to investigate, not automatically a Raku++ bug: sometimes both answers are valid Raku, and sometimes Rakudo is the one that is wrong.
- ! Warnings differ Same output, but only one compiler printed a warning.
Most programs share a four-line tail that prints what they computed: its type, its .raku representation, its string form and its truth value. The cards show only the part before that tail.
Literals 10 of 12 agree
Writing values straight into code: numbers in other bases, rationals, pairs, strings, versions.
my $value = (answer => 7, :enabled, :!hidden, :count(8));✓ Same as Rakudo#1
my $value = (True, False, Nil, Any, Failure.new("x").defined);! Warnings differ#2
my $value = (0b101101, 0o755, 0xCAFE, :16<ff>);✓ Same as Rakudo#3
my $n = 4;
my $value = ("value=$n", "next={ $n + 1 }", "array={($n, $n + 1).join(q[,])}");✓ Same as Rakudo#4
my $value = (1/3, 2/6, 7/2, (1/3 + 2/3));✓ Same as Rakudo#5
my $value = { alpha => 2, beta => 3, nested => { ok => True } };✓ Same as Rakudo#6
my $value = (2+3i, (2+3i).conj, (3+4i).abs);✓ Same as Rakudo#7
my $value = (v1.2.3, v1.2.4, v2.0.0, v1.2.3 ~~ Version);≠ Differs from Rakudo#8
my $value = (q[raw $text], qq[double\nline], Q:c[\x52aku], 「corner quotes」);✓ Same as Rakudo#9
my $value = (1_000_000, 0b1010_0101, 12_345.67_89);✓ Same as Rakudo#10
my $value = [5, 6, [8, 13], "raku"];✓ Same as Rakudo#11
my $value = (1e3, 2.5e-2, 6.022e23, -0e0);✓ Same as Rakudo#12
Variables 12 of 12 agree
Assignment, binding, scope, state variables and dynamic variables.
our $Counter = 7;
sub bump { ++$Counter }
my $value = (bump(), bump(), $Counter);✓ Same as Rakudo#1
my %source = alpha => 6, beta => 7;
%source<gamma> = 13;
my $value = %source.keys.sort.map({ $_ => %source{$_} }).Array;✓ Same as Rakudo#2
my $value = 5; $value += 3; $value *= 2;✓ Same as Rakudo#3
my &combine = { $^a * 10 + $^b };
my $value = combine(4, 5);✓ Same as Rakudo#4
my $source = 3; my $alias := $source; $source += 4; my $value = ($source, $alias);✓ Same as Rakudo#5
my $*FACTOR = 2;
sub scaled($x) { $x * $*FACTOR }
my $value = (scaled(2), { temp $*FACTOR = 3; scaled(2) }(), scaled(2));✓ Same as Rakudo#6
my @source = (9, 10); @source.push(13); my $value = (@source.elems, @source[0], @source[*-1]);✓ Same as Rakudo#7
sub bump($target is rw) { $target += 2 }
my $source = 8;
bump($source);
my $value = $source;✓ Same as Rakudo#8
my @source = (7, 8, 8);
my $value = @source.grep(* %% 2).map({ $_ * 2 }).Array;✓ Same as Rakudo#9
my $source = 6;
my $inner = { my $source = 20; $source + 1 }();
my $value = ($source, $inner);✓ Same as Rakudo#10
sub counter { state $seen = 0; ++$seen }
my $value = (counter(), counter(), counter());✓ Same as Rakudo#11
my ($a, $b, *@rest) = (4, 5, 8, 13); my $value = ($a, $b, @rest.Array);✓ Same as Rakudo#12
Numbers 9 of 10 agree
Integers, rationals, floating point, complex numbers and infinities, mixed together.
my $source = (+(+(10 / NaN))); my $value = $source;✓ Same as Rakudo#1
sub carry($x) { $x }
my $value = carry((-Inf * Inf));✓ Same as Rakudo#2
my @source = ((-(+1/2)),); my $value = @source[0];✓ Same as Rakudo#3
my $value = (max((9223372036854775807 + "1.5"), (-NaN)) - 1+2i);✓ Same as Rakudo#4
my @source = ((-"1.5"),); my $value = @source[0];✓ Same as Rakudo#5
sub carry() { min((-1 + 0e0), (+7/3)) }
my $value = carry();✓ Same as Rakudo#6
my $value = (+1);✓ Same as Rakudo#7
sub carry($x) { $x }
my $value = carry(7/3);✓ Same as Rakudo#8
my @source = (((1+2i * 9223372036854775808) / max(7/3, 1+2i)),); my $value = @source[0];≠ Differs from Rakudo#9
sub carry($x) { $x }
my $value = carry(0e0);✓ Same as Rakudo#10
Operators 11 of 12 agree
Arithmetic, comparison, junctions and reductions over the same pair of values.
my $source = 5; my $value = $source %% 2 ?? "even" !! "odd";✓ Same as Rakudo#1
my $needle = 8; my $value = ($needle == any(1, 2, 3, 5, 8, 13), $needle > all(0, -1));≠ Differs from Rakudo#2
my $a = 13; my $b = 8; my $value = ($a + $b, $a - $b, $a * $b, $a / $b, $a div $b, $a % $b);✓ Same as Rakudo#3
my $value = ((1, 2, 3) Z+ (1, 13, 4)).Array;✓ Same as Rakudo#4
my $a = "ra"; my $b = "ku"; my $value = ($a ~ $b, $a x 3, $a lt $b, $a cmp $b);✓ Same as Rakudo#5
my $value = 3; $value += 2; $value *= 2;✓ Same as Rakudo#6
my $value = (5 .. 8).list;✓ Same as Rakudo#7
my $source = 8; my $value = ($source ~~ Int, $source ~~ 1..10, $source ~~ (* > 0));✓ Same as Rakudo#8
my @source = (13, 8, 2); my $value = ([+] @source, [*] @source, [min] @source, [max] @source);✓ Same as Rakudo#9
my $a = 1; my $b = 13; my $value = ($a == $b, $a != $b, $a < $b, $a <= $b, $a <=> $b);✓ Same as Rakudo#10
my $value = (("a", "b") X (1, 2)).map({ $_.join(":") }).Array;✓ Same as Rakudo#11
my $a = 3; my $zero = 0; my $value = ($a && "yes", $zero || "fallback", Nil // "defined");✓ Same as Rakudo#12
Control flow 12 of 12 agree
if and unless, loops, given/when, gather/take and early returns.
my @result;
for 0 .. 5 -> $i { next if $i %% 2; @result.push($i) }
my $value = @result;✓ Same as Rakudo#1
my $i = 0;
my @result;
repeat { @result.push($i); $i++ } while $i < 7;
my $value = @result;✓ Same as Rakudo#2
my $source = 8;
my $value; if $source %% 2 { $value = "even" } else { $value = "odd" }✓ Same as Rakudo#3
my $value = gather for 0 .. 2 -> $i { take $i if $i %% 2 };✓ Same as Rakudo#4
my $source = 1;
my $value;
given $source { when 0 { $value = "zero" }; when 1..3 { $value = "small" }; default { $value = "large" } }✓ Same as Rakudo#5
sub choose($x) { for 1..3 -> $i { return $i * 10 if $i == $x }; -1 }
my $value = choose(3);✓ Same as Rakudo#6
my $i = 0;
my @result;
while $i < 5 { @result.push($i); $i++ }
my $value = @result;✓ Same as Rakudo#7
my @trace;
sub traced() { LEAVE { @trace.push("leave") }; @trace.push("body"); "done" }
my $result = traced();
my $value = ($result, @trace);✓ Same as Rakudo#8
my @result;
loop (my $i = 0; $i < 10; $i++) { @result.push($i + 1) }
my $value = @result;✓ Same as Rakudo#9
my $source = 0;
my @trace;
@trace.push("zero") unless $source;
@trace.push("nonzero") if $source;
…✓ Same as Rakudo#10
my $result = try { die "planted" };
my $value = ($result.defined, $!.^name);✓ Same as Rakudo#11
my @result;
for 0 .. 4 -> $i { @result.push($i * $i) }
my $value = @result;✓ Same as Rakudo#12
Subroutines 12 of 12 agree
Declaring and calling subs, closures and recursion.
my &transform = sub ($x) { $x + 7 };
my $value = (transform(1), transform(4));✓ Same as Rakudo#1
multi sub kind(Int $x) { "int:$x" }
multi sub kind(Str $x) { "str:$x" }
my $value = (kind(6), kind("6"));✓ Same as Rakudo#2
sub add($a, $b) { $a + $b }
my $value = add(5, 6);✓ Same as Rakudo#3
sub doubled(Int $x --> Int) { $x * 2 }
my $value = (doubled(4), &doubled.returns.^name);✓ Same as Rakudo#4
sub scale($value, $factor = 3) { $value * $factor }
my $value = (scale(3), scale(3, 2));✓ Same as Rakudo#5
sub factorial(Int $x) { $x <= 1 ?? 1 !! $x * factorial($x - 1) }
my $value = factorial(2);✓ Same as Rakudo#6
sub ordered(*%items) { %items.keys.sort.map({ $_ => %items{$_} }).Array }
my $value = ordered(beta => 8, alpha => 9);✓ Same as Rakudo#7
sub classify(Int $x) { return "negative" if $x < 0; return "zero" if $x == 0; "positive" }
my $value = (classify(-7), classify(0), classify(7));✓ Same as Rakudo#8
proto sub area(|) {*}
multi sub area(Int $side) { $side * $side }
multi sub area(Int $a, Int $b) { $a * $b }
my $value = (area(6), area(6, 7));✓ Same as Rakudo#9
sub describe(:$name!, :$count = 1) { "$name:$count" }
my $value = describe(name => "raku", count => 5);✓ Same as Rakudo#10
sub multiplier($factor) { -> $value { $value * $factor } }
my × = multiplier(4);
my $value = times(3);✓ Same as Rakudo#11
sub total(*@items) { [+] @items }
my $value = total(1, 3, 4);✓ Same as Rakudo#12
Signatures 12 of 12 agree
How arguments bind to parameters: defaults, named, slurpy, typed and multi subs.
sub bind(|c) { (c.elems, c.list) }
my $value = bind(42, -1);✓ Same as Rakudo#1
sub bind(:short(:$long)!) { $long }
my $value = bind(short => 42);✓ Same as Rakudo#2
sub bind($x) { ($x.^name, $x) }
my $value = bind(True);✓ Same as Rakudo#3
sub bind(*%x) { %x.keys.sort.map({ $_ ~ "=" ~ %x{$_}.raku }).join(";") }
my $value = bind(a => 0, b => True);✓ Same as Rakudo#4
sub bind($x = 1) { $x }
my $value = bind();✓ Same as Rakudo#5
sub bind(Int $x where * > 0) { $x * 2 }
my $value = bind(42);✓ Same as Rakudo#6
sub bind(:$x!) { $x }
my $value = bind(x => 42);✓ Same as Rakudo#7
multi bind(Int $x) { "Int:" ~ $x }
multi bind(Str $x) { "Str:" ~ $x }
my $value = bind("text");✓ Same as Rakudo#8
sub bind(*@x) { (@x.elems, @x) }
my $value = bind(True, "text", True);✓ Same as Rakudo#9
sub bind($x, $y) { ($x, $y) }
my $value = bind(0, True);✓ Same as Rakudo#10
sub bind(Int $x) { ($x.^name, $x) }
my $value = bind(2);✓ Same as Rakudo#11
sub bind($x = -1) { $x }
my $value = bind(1);✓ Same as Rakudo#12
Arrays and hashes 10 of 10 agree
Arrays, hashes and scalar containers: what gets copied, what gets shared, what flattens.
my $source = "text"; $source = 0; my $value = $source;✓ Same as Rakudo#1
my $source = 1/2; my $alias := $source; $alias = True; my $value = ($source, $alias);✓ Same as Rakudo#2
my @source = (42, "text"); @source[0] = "text"; my $value = @source;✓ Same as Rakudo#3
my %source = a => -1, b => 1/2; %source<a> = 1/2; my $value = (%source<a>, %source<b>);✓ Same as Rakudo#4
sub replace($x is rw) { $x = 42 }
my $source = 1;
replace($source);
my $value = $source;✓ Same as Rakudo#5
sub replace($x is copy) { $x = -1; $x }
my $source = 0;
my $result = replace($source);
my $value = ($source, $result);✓ Same as Rakudo#6
my Numeric $source = True; my $value = $source;✓ Same as Rakudo#7
my @inner = ("text", 0);
my @source = item(@inner);
my $value = (@source.elems, @source[0].^name, @source[0]);✓ Same as Rakudo#8
my @inner = (1/2, True); my @source = (@inner, 1/2); my $value = (@source.elems, @source);✓ Same as Rakudo#9
my @source = (slip(42, "text"), 42); my $value = (@source.elems, @source);✓ Same as Rakudo#10
Types 11 of 12 agree
Type objects, roles, enums, subsets and smartmatching against types.
my Int @source = (7, 8); my $value = (@source.^name, @source.of.^name, @source.Array, @source ~~ Positional);≠ Differs from Rakudo#1
role Named { method label { self.^name } }
class Item does Named { }
my $source = Item.new;
my $value = ($source.label, $source ~~ Named, Item.^roles.map(*.^name).Array);✓ Same as Rakudo#2
my $source = 5; my $value = ($source.^name, $source.WHAT.^name, $source ~~ Int);✓ Same as Rakudo#3
role Tagged { method tag { "mixed" } }
my $source = 4 but Tagged;
my $value = ($source + 1, $source.tag, $source ~~ Tagged);✓ Same as Rakudo#4
my $source = "3"; my $value = ($source.Int, $source.Numeric, $source.Bool, $source.Str);✓ Same as Rakudo#5
my $source = answer => 2; my $value = ($source.^name, $source.key, $source.value, $source ~~ Pair);✓ Same as Rakudo#6
enum Direction <North East South West>; my $source = Direction.enums<North>; my $value = ($source, Direction::East.value, Direction.enums.keys.sort.Array);✓ Same as Rakudo#7
sub classify(Int $x where * > 0) { ($x.^name, $x * 2) }
my $value = classify(8);✓ Same as Rakudo#8
class Parent { method value { 2 } }
class Child is Parent { method value { callsame() + 7 } }
my $source = Child.new;
my $value = ($source.value, $source ~~ Parent, Child.^mro.map(*.^name).Array);✓ Same as Rakudo#9
my $value = (Int.defined, Nil.defined, 0.defined, "".defined);✓ Same as Rakudo#10
my $source = Int; my $value = ($source.^name, $source.defined, $source ~~ Int, $source.HOW.^name);✓ Same as Rakudo#11
subset Small of Int where 0..10; my Small $source = 4; my $value = ($source, $source.^name, $source ~~ Small, $source ~~ Int);✓ Same as Rakudo#12
Classes and methods 12 of 12 agree
Attributes, inheritance, roles, private and multi methods, delegation.
class Counter { has $.base; method add($x) { self.base + $x }; method twice($x) { self.add($x) * 2 } }
my $value = Counter.new(base => 7).twice(3);✓ Same as Rakudo#1
class Base { method score { 2 } }
class Derived is Base { method score { callsame() + 6 } }
my $value = Derived.new.score;✓ Same as Rakudo#2
class Box { has $.value; method doubled { $.value * 2 } }
my $value = Box.new(value => 5).doubled;✓ Same as Rakudo#3
role Measured { method measure { self.value * 2 } }
class Item does Measured { has $.value }
my $value = Item.new(value => 4).measure;✓ Same as Rakudo#4
class Point { has Int $.x is rw; has Int $.y }
my $point = Point.new(x => 3, y => 4);
$point.x += 3;
my $value = ($point.x, $point.y);✓ Same as Rakudo#5
class Math { method triple($x) { $x * 3 } }
my &operation = Math.^find_method("triple");
my $value = operation(Math.new, 2);✓ Same as Rakudo#6
class Parent { method label { "parent" } }
class Child is Parent { }
my $value = (Child.new.label, Child.^mro.map(*.^name).Array);✓ Same as Rakudo#7
class Dynamic { method FALLBACK($name, |c) { "$name:" ~ c.elems } }
my $value = Dynamic.new.unknown(8, 9);✓ Same as Rakudo#8
class Render { multi method show(Int $x) { "int:$x" }; multi method show(Str $x) { "str:$x" } }
my $r = Render.new;
my $value = ($r.show(7), $r.show("7"));✓ Same as Rakudo#9
class Factory { method build(::?CLASS:U: $x) { ::?CLASS.new(:value($x)) }; has $.value }
my $value = Factory.build(6).value;✓ Same as Rakudo#10
class Engine { method power($x) { $x * 3 } }
class Vehicle { has Engine $.engine handles <power> }
my $value = Vehicle.new(engine => Engine.new).power(5);✓ Same as Rakudo#11
class Secret { method !twice($x) { $x * 2 }; method reveal($x) { self!twice($x) } }
my $value = Secret.new.reveal(4);✓ Same as Rakudo#12
Regexes 12 of 12 agree
Matching, captures, quantifiers, comb, split and subst.
my $value = "alpha beta\tgamma".split(/ \s+ /).Array;✓ Same as Rakudo#1
my $whole = "abc" ~~ / ^ a .* c $ /; my $partial = "xabc" ~~ / ^ a .* c $ /; my $value = (so $whole, so $partial);✓ Same as Rakudo#2
my $match = "xxabcxx" ~~ / abc /; my $value = (so $match, $match.from, $match.to, ~$match);✓ Same as Rakudo#3
my @matches = "one 22 three".match(/ <[a..z]>+ /, :g);
my $value = @matches.map({ ($_.Str, $_.from, $_.to) }).Array;✓ Same as Rakudo#4
my $match = "abc-42" ~~ / $<word>=[<[a..z]>+] \- $<number>=[\d+] /; my $value = (so $match, ~$match<word>, ~$match<number>);✓ Same as Rakudo#5
my $value = "a1 bb22 ccc333".comb(/ <[a..z]>+ /).Array;✓ Same as Rakudo#6
my $match = "baaac" ~~ / a ** 2..4 /; my $value = (so $match, ~$match, $match.chars);✓ Same as Rakudo#7
my regex word { <[a..z]>+ }
my $match = "abc 42" ~~ / <word> \s+ \d+ /;
my $value = (so $match, ~$match<word>, $match.from, $match.to);✓ Same as Rakudo#8
my $match = "AbC" ~~ m:i/ abc /; my $value = (so $match, ~$match, $match.from, $match.to);✓ Same as Rakudo#9
my $match = "aaab" ~~ / (a+) b /; my $value = (so $match, ~$match[0], $match[0].from, $match[0].to);✓ Same as Rakudo#10
my $value = "a1b22c333".subst(/ \d+ /, "#", :g);✓ Same as Rakudo#11
my $match = "gamma" ~~ / alpha | beta | gamma | delta /; my $value = (so $match, ~$match, $match.from, $match.to);✓ Same as Rakudo#12
Grammars and match trees 12 of 19 agree
Grammars assembled at random from alternations, quantifiers, subrule calls and captures, with every field of the resulting Match printed.
grammar G {
rule TOP { \d+ }
rule r0 { <[a..c]> }
}
…✓ Same as Rakudo#1
grammar G {
token TOP { $<k0>=[ \w <[a..c]>+ \w | \w <[a..c]>+ 'b' | \w <[a..c]>+ ] | <r0> | [ <?after 'x'> <k1=r0> || <?after 'x'> \d+ || <?after 'x'> <r0> ] }
token r0 { <[a..c]> }
rule r1 { \w }
…✓ Same as Rakudo#2
grammar G {
token TOP { 'b' }
regex r0 { \w+ }
token r1 { <.r0> <k0=r0> <k0=r0> | <.r0> <k0=r0> }
…✓ Same as Rakudo#3
my token r0 { \w+ }
my regex r1 { [ <r0> ] [ 'a' 'x' || 'a' <k1=&r0> ] }
my token r2 { <r1> <r1> <&r0> <k1=&r1> 'a' }
my rule r3 { [ <r2> <r2> ] }
…✓ Same as Rakudo#4
my regex r0 { \w }
my @inputs = " b a 1 0 2 - 1 <", " b _ 2 a _ - b <", " 1 bc b 1 b c = - c ";
for @inputs.kv -> $i, $in {
say "#$i input {$in.raku}";
…✓ Same as Rakudo#5
grammar G {
rule TOP { [ ( 'a' ) || $<k0>=[ <?after 'b'> ] ] <[a..c]>+ }
token r0 { \d+ }
token r1 { 'b' }
…✓ Same as Rakudo#6
grammar G {
regex TOP { <k0=r1> }
token r0 { \d+ }
regex r1 { \w+ }
…✓ Same as Rakudo#7
grammar G {
rule TOP { <[a..c]>+? [ 'b' \d+ ] }
rule r0 { \d }
rule r1 { \w+ }
…✓ Same as Rakudo#8
grammar G {
token TOP { [ <r0> [ <[a..c]>+ ] ** 2 ]* \d }
token r0 { \d }
}
…✓ Same as Rakudo#9
grammar G {
token TOP { '=' | [ $<k1>=[ <r1> ] | 'x' ] | $<k1>=[ <?r0> <!r0> <r0> ] }
rule r0 { <[a..c]>+ }
rule r1 { <[a..c]> }
…✓ Same as Rakudo#10
grammar G {
regex TOP { <r2> }
token r0 { <[a..c]> }
rule r1 { <[a..c]> ',' \w+ '=' <k1=r0> <?r0> }
…✓ Same as Rakudo#11
grammar G {
token TOP { <.r0> }
regex r0 { <[a..c]> }
token r1 { [ <[a..c]>+ ] ** 1..2 % '-' }
…✓ Same as Rakudo#12
my token r0 { \w }
my token r1 { <r0> \w }
my rule r2 { \w+ }
my @inputs = "b", ")223bc>", "";
…≠ Differs from Rakudo#13
grammar G {
regex TOP { <k0=r0> [ <.r3> <[a..c]>+ <!r2> ] }
token r0 { \w }
rule r1 { 'b' <[a..c]>+ \w || 'b' <[a..c]>+ 'x' || 'b' <[a..c]>+ <r0> }
…≠ Differs from Rakudo#14
my regex r0 { <[a..c]> }
my regex r1 { \w+ }
my @inputs = "c1a", "ab", "";
for @inputs.kv -> $i, $in {
…≠ Differs from Rakudo#15
grammar G {
regex TOP { ( <r0> ) | [ <[a..c]>+ ]+ <r0> '-' <[a..c]> <r1> <?r0> | [ <[a..c]> ] [ <.r0> | <.r0> ] }
regex r0 { \d }
regex r1 { <[a..c]> }
…≠ Differs from Rakudo#16
grammar G {
rule TOP { <r1> | <k1=r2>* <r2> <k0=r1> <k1=r2> $ }
token r0 { \d }
rule r1 { <[a..c]> }
…≠ Differs from Rakudo#17
my token r0 { \w }
my token r1 { $<k0>=[ \w ] <&r0> }
my rule r2 { <r0> }
my @inputs = "0", "1_", "";
…≠ Differs from Rakudo#18
my rule r0 { \d+ }
my rule r1 { \d+ }
my token r2 { <[a..c]> }
my token r3 { \d+ <k1=&r0> || \d+ <r0> }
…≠ Differs from Rakudo#19
Unicode 12 of 12 agree
Characters versus codepoints, case mapping and text outside ASCII.
my $source = "नमस्ते"; my $needle = $source.substr(0, 1); my $value = ($source.index($needle), $source.starts-with($needle), $source.ends-with($needle));✓ Same as Rakudo#1
my $source = "👩💻"; my $value = ($source.lc, $source.lc.ords);✓ Same as Rakudo#2
my $source = "Σίσυφος"; my $value = ($source.chars, $source.comb.elems);✓ Same as Rakudo#3
my $source = "Straße";
my $value = $source.comb.map({ ($_.Str, $_.ords) });✓ Same as Rakudo#4
my $source = "é"; my $normalized = $source.NFC; my $value = ($normalized.Str, [$normalized.list]);✓ Same as Rakudo#5
my $source = "é";
my $bytes = $source.encode("utf8");
my $value = ($bytes.list, $bytes.decode("utf8"));✓ Same as Rakudo#6
my $source = "東京"; my $value = ($source.uc, $source.uc.ords);✓ Same as Rakudo#7
my $source = "Ångström"; my $value = $source.trans(["a".."z"] => ["A".."Z"]);✓ Same as Rakudo#8
my $source = "नमस्ते";
my $value = (0 ..^ $source.chars).map({ $source.substr($_, 1) });✓ Same as Rakudo#9
my $source = "👩💻"; my $value = ($source.codes, $source.ords);✓ Same as Rakudo#10
my $source = "Σίσυφος"; my $value = ($source.ords.map(*.chr).join, $source.ords);✓ Same as Rakudo#11
my $source = "Straße"; my $normalized = $source.NFD; my $value = ($normalized.Str, [$normalized.list]);✓ Same as Rakudo#12
Built-in functions 12 of 12 agree
Everyday routines: abs and sqrt, sort, unique, zip, rotor, sprintf and friends.
my $source = "7"; my $value = ($source.Int, $source.Rat, $source.Num, $source.Bool);✓ Same as Rakudo#1
my @source = 1..6; my $value = @source.grep(* %% 2).map(* ** 2).Array;✓ Same as Rakudo#2
my $value = (abs(-5), sign(-5), sqrt(25), exp(0));✓ Same as Rakudo#3
my @source = (4, 2, 4, 3, 2); my $value = (@source.unique.Array, @source.repeated.Array);✓ Same as Rakudo#4
my @source = (3, 13, 2, 4); my $value = (@source.min, @source.max, @source.minmax.raku);✓ Same as Rakudo#5
my $value = zip(<a b c>, (2, 3, 13)).map(*.Array).Array;✓ Same as Rakudo#6
my $source = "alpha,beta,gamma";
my $value = $source.split(",").reverse.join("|");✓ Same as Rakudo#7
my $value = sprintf("%04d:%0.2f", 8, 2.666667);✓ Same as Rakudo#8
my @source = (13, 7, 2, 8); my $value = (@source.sort.Array, @source.sort(-*).Array);✓ Same as Rakudo#9
my $source = 7.625; my $value = ($source.floor, $source.ceiling, $source.round, $source.truncate);✓ Same as Rakudo#10
my $value = (1..8).rotor(3, :partial).map(*.Array).Array;✓ Same as Rakudo#11
my $source = "Raku 🦋"; my $value = ($source.chars, $source.codes, $source.ords.Array, $source.flip);✓ Same as Rakudo#12
Phasers 12 of 12 agree
Code that runs at a particular moment: BEGIN, INIT, END, ENTER, LEAVE, FIRST, LAST, CATCH.
my @events;
for 1..3 { LAST @events.push("last"); @events.push($_) }
my $value = @events.Array;✓ Same as Rakudo#1
my @events;
{ LEAVE @events.push("leave"); @events.push("body") }
my $value = @events.Array;✓ Same as Rakudo#2
BEGIN constant COMPILED = 5 * 2; my $value = COMPILED;✓ Same as Rakudo#3
my @events;
try { UNDO @events.push("undo"); die "stop" }
my $value = @events.Array;✓ Same as Rakudo#4
INIT say "PHASE\tinit-3"; my $value = "runtime";✓ Same as Rakudo#5
my @events;
for 1..3 { NEXT @events.push("next"); @events.push($_) }
my $value = @events.Array;✓ Same as Rakudo#6
my @events;
{ ENTER @events.push("enter"); @events.push("body") }
my $value = @events.Array;✓ Same as Rakudo#7
my @events;
try { CATCH { default { @events.push(.^name) } }; die "stop" }
my $value = @events.Array;✓ Same as Rakudo#8
my @events;
{ KEEP @events.push("keep"); @events.push("body") }
my $value = @events.Array;✓ Same as Rakudo#9
CHECK say "PHASE\tcheck-6"; my $value = "runtime";✓ Same as Rakudo#10
my @events;
for 1..3 { FIRST @events.push("first"); @events.push($_) }
my $value = @events.Array;✓ Same as Rakudo#11
END say "PHASE\tend-4"; my $value = "runtime";✓ Same as Rakudo#12
Concurrency 12 of 12 agree
Promises, start/await, channels, supplies, locks and threads — small and bounded.
my $value = Supply.from-list((7, 8, 13)).list;✓ Same as Rakudo#1
my $channel = Channel.new; $channel.send(6); my $value = $channel.receive; $channel.close;✓ Same as Rakudo#2
my $work = start { 5 * 2 };
my $value = await $work;✓ Same as Rakudo#3
my $lock = Lock.new;
my $source = 4;
my $value = $lock.protect({ $source += 2; $source });✓ Same as Rakudo#4
my $promise = Promise.kept(3); my $value = ($promise.status.Str, await $promise);✓ Same as Rakudo#5
my $result;
my $thread = Thread.start({ $result = 2 * 4 });
$thread.join;
my $value = $result;✓ Same as Rakudo#6
my $promise = Promise.kept(9).then({ .result * 3 });
my $value = await $promise;✓ Same as Rakudo#7
my @seen;
react whenever Supply.from-list((8, 9)) { @seen.push($_) }
my $value = @seen.Array;✓ Same as Rakudo#8
my $channel = Channel.new; $channel.send(7); $channel.close; my $value = $channel.list.Array;✓ Same as Rakudo#9
my @work = (start { 6 + 1 }, start { 6 + 2 });
my $value = await(@work);✓ Same as Rakudo#10
my $lock = Lock.new;
my $counter = 0;
my @work = (1..4).map({ start { $lock.protect({ $counter++ }) } });
await @work;
…✓ Same as Rakudo#11
my $promise = Promise.broken("failure");
my $error = try await $promise;
my $value = ($promise.status.Str, $error.defined);✓ Same as Rakudo#12
Programs that must fail 9 of 12 agree
Deliberately broken code. The correct result is a compile-time error, not output.
my $value = 1 2;≠ Differs from Rakudo#1
my $value = :1<2>;✓ Both reject it#2
my $value = (1 + 2;✓ Both reject it#3
sub f() is definitely-not-a-trait { };✓ Both reject it#4
if True { say 1;✓ Both reject it#5
class C { method 42() { } }≠ Differs from Rakudo#6
my ?value = 1;✓ Both reject it#7
else { say 1 }✓ Both reject it#8
my $value = :;≠ Differs from Rakudo#9
my $value = "unfinished;✓ Both reject it#10
my $value = rx/ [ /;✓ Both reject it#11
sub f($x, $x) { };✓ Both reject it#12