Skip to content

Commit aa50ea2

Browse files
committed
Adds the list contextualizer @ refs #1711
1 parent 7ff36db commit aa50ea2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

doc/Type/Any.pod6

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,18 @@ does the L<Positional|/type/Positional> role
9999
from L«C<.list>|/routine/list». Use L«C<.List>|/routine/List» to
100100
coerce specifically to L<List|/type/List>.
101101
102+
X<|@ list contextualizer>
103+
C<@> can also be used as a list or positional contextualizer
104+
105+
=for code
106+
my $not-a-list-yet = $[1,2,3];
107+
say $not-a-list-yet.perl; # OUTPUT: «$[1, 2, 3]␤»
108+
my @maybe-a-list = @$not-a-list-yet;
109+
say @maybe-a-list.^name; # Array␤»
110+
111+
In the first case, the list is I<itemized>. C<@> as a prefix puts the initial
112+
scalar in a list context by calling C<.list> and turning it into an array.
113+
102114
=head2 method push
103115
104116
Defined as:

0 commit comments

Comments
 (0)