Bacon cipher: Difference between revisions

→‎Raku: .. use bound sub-array instead of addressing list of 1-char lists .[0] hack; and minor changes
(Added Quackery.)
(→‎Raku: .. use bound sub-array instead of addressing list of 1-char lists .[0] hack; and minor changes)
Line 2,310:
 
sub bacon ($s, $msg) {
my $@raw = ( [$_] for $s.lc.comb );
my $@txt := $@raw[ (^@raw).grep(*.{@raw[0$_] (elem) @abc}) ];
for $msg.lc.comb Z $@txt.batch(5) -> ($c-msg, @a) {
for @a.kv -> $i, $c-str {
(my $x := @a[$i]) = $x.uc if %bacon{$c-msg}.comb[0$i].Int.Bool;
$x = $x.uc if %bacon{$c-msg}.comb[$i].Int.Bool;
} }
$@raw.map(*.[0]).join;
}
 
Anonymous user