Perl 6 Perl 6 Lists, Arrays, and Hashes vivified #44

Flattening (Parcel interpolation)

Most operations on lists flatten Parcels

my @a = 2,3;
my @b = <f g>;

((1, @a), (4, 5, @b)).elems          # 7
((1, @a), (4, 5, @b))[5]             # 'f'

The flat contextualizer explicitly flattens:

my $a = ((1, @a), (4, 5, @b)).flat;
say $a.elems                         # 7

The lol (list-of-lists) contextualizer explicitly itemizes subparcels:

my $b = ((1, @a), (4, 5, @b)).lol
say $b.elems;                        # 2
Copyright © 2011
http://www.pmichaud.com/2011/pres/