P14 - Duplicate the elements of a list.

Author: Scott Penrose

Specification

P14 (*) Duplicate the elements of a list.

Example

> say ~dupli(<a b c c d>);
a a b b c c c c d d

Source code: P14-scottp.pl

use v6;

sub dupli(@l) {
    return @l.map({$_, $_});
}
say ~dupli(<a b c c d>);