Perl 6 Perl 6 Lists and Arrays vivified #52

Positional role

The Positional role reflects objects that support indexing

Variables using the @ sigil only bind to Positional arguments

 List, Array, and Parcel implement Positional

sub shout-them(@words) {
    for @words { print uc($_), " " }
}

my @lastwords = <Perl 6 rocks>;
shout-them(@lastwords);          # PERL 6 ROCKS
shout-them('no', 'way');         # error, too many arguments
shout-them(   'yes'  );          # error, Str not positional
shout-them( @('yes') );          # YES, ok with list contextualizer
Copyright © 2012
http://www.pmichaud.com/2012/pres/