constant %name-of =
0 => 'zero', 1 => 'one',
2 => 'two', 3 => 'three',
4 => 'four', 5 => 'five',
6 => 'six', 7 => 'seven',
8 => 'eight', 9 => 'nine',
;
multi take-magic-four(4) {
take "four is magic"
}
multi take-magic-four(UInt $num where * < 10) {
my $name = %name-of{$num};
my $len = $name.chars;
take "$name is %name-of{$len}";
take-magic-four $len
}
sub magic-four(UInt $num where * < 10) {
gather { take-magic-four($num) }.join: ", "
}
for ^10 -> $num {
say magic-four $num
}