P14 - Duplicate the elements in a list.

Author: Ryan Connelly

Example

> say duplicate(<a b c c d e>.list);
a a b b c c c c d d e e

Source code: P14-topo.pl

use v6;

sub duplicate(@list)
{
    @list.map({$_, $_}).flat;
}

say "{duplicate(<a b c c d e>.list)}";