Exactly three adjacent 3 in lists: Difference between revisions

Content added Content deleted
m (→‎{{header|Raku}}: Generalized)
m (→‎{{header|Raku}}: white space)
Line 64: Line 64:
=={{header|Raku}}==
=={{header|Raku}}==
Generalized
Generalized
<lang perl6>for 1.. 4 -> $n {
<lang perl6>for 1 .. 4 -> $n {

say "\nExactly $n {$n}s, and they are consecutive:";
say "\nExactly $n {$n}s, and they are consecutive:";

say .gist, ' ', lc (.Bag{$n} == $n) && ( so .rotor($n=>-($n - 1)).grep: *.all == $n ) for
say .gist, ' ', lc (.Bag{$n} == $n) && ( so .rotor($n=>-($n - 1)).grep: *.all == $n ) for
[9,3,3,3,2,1,7,8,5],
[9,3,3,3,2,1,7,8,5],