Perl 6 More laziness and lists #6

Flattening (Parcel interpolation)

Most list operations 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 © 2012
http://www.pmichaud.com/2012/pres/