2015-02-20 09:02:09 -05:00
|
|
|
multi can-spell-word(Str $word, @blocks) {
|
2016-12-05 22:15:40 +01:00
|
|
|
my @regex = @blocks.map({ my @c = .comb; rx/<@c>/ }).grep: { .ACCEPTS($word.uc) }
|
2015-11-18 06:14:39 +00:00
|
|
|
can-spell-word $word.uc.comb.list, @regex;
|
2015-02-20 09:02:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
multi can-spell-word([$head,*@tail], @regex) {
|
|
|
|
|
for @regex -> $re {
|
|
|
|
|
if $head ~~ $re {
|
|
|
|
|
return True unless @tail;
|
|
|
|
|
return False if @regex == 1;
|
2015-11-18 06:14:39 +00:00
|
|
|
return True if can-spell-word @tail, list @regex.grep: * !=== $re;
|
2015-02-20 09:02:09 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
False;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
my @b = <BO XK DQ CP NA GT RE TG QD FS JW HU VI AN OB ER FS LY PC ZM>;
|
|
|
|
|
|
|
|
|
|
for <A BaRK BOoK tREaT COmMOn SqUAD CoNfuSE> {
|
|
|
|
|
say "$_ &can-spell-word($_, @b)";
|
|
|
|
|
}
|