P16 - 从列表中删除每 n 个元素。

作者:Ryan Connelly

示例

> 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

源代码: 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)}";