P14 - Duplicate the elements of a list.

Author: Johan Viklund

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-viklund.pl

use v6;

say <a b c c d>.map({ $_ xx 2 }).map({.list}).flat.list.perl;