P16 (**) Drop every N'th element from a list.

Author: Edwin Pratomo

Specification

P16 (**) Drop every N'th element from a list.

Example

> say ~drop(, 3);
a b d e g h k

Source code: P16-edpratomo.pl

use v6;

sub drop(@ary, $n) {
  gather for 1 .. @ary.elems -> $i { take @ary[$i - 1] if $i % $n }
}

drop(, 3).list.perl.say;