Skip to content

Commit 722b41d

Browse files
committed
Adds section on list contexts, refs #1225
1 parent 05a5e8d commit 722b41d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

doc/Language/contexts.pod6

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,22 @@ force this context on an object.
193193
say ? 0i; # OUTPUT: «False␤»
194194
say ! :true; # OUTPUT: «False␤»
195195
196+
=head1 List X<|list context>
197+
198+
There are actually several different
199+
L<list contexts|/language/list#List_contexts>, which are better explained in
200+
that page. In general, the list contextualizer is the comma C<,>
201+
202+
say (3,).^name; # OUTPUT: «List␤»
203+
204+
and the method called in that case is also C<.list>
205+
206+
=for code
207+
Any.list.^name; # OUTPUT: «List␤»
208+
say 3.list.^name; # OUTPUT: «List␤»
209+
say (^3).list; # OUTPUT: «(0 1 2)␤»
210+
211+
196212
=end pod
197213

198214
# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6

0 commit comments

Comments
 (0)