P16 - Drop every nth element from a list.

Author: Ryan Connelly

Example

> say drop-nth(<a b c d e f g h i j k l m n>.list, 3);
a b d e g h j k m n

Source code: P16-topo.pl

use v6;

sub drop-nth(@list, $n)
{
    my $count = 1;

    gather for @list -> $e
    {
        take $e if not $count++ %% $n;
    }
}

say "{drop-nth(<a b c d e f g h i j k l m n>.list, 3)}";