Skip to content

Commit 13f5943

Browse files
committed
Expanding and adding examples to circumfix []
Which would close #2360 if everyone is happy with it. It's the best one can do meanwhile the contexts are not better explained, as requested in #1225.
1 parent 4155d56 commit 13f5943

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

doc/Language/operators.pod6

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,19 @@ To always ensure you end up with a L<Hash>, you can use C<%( )> coercer or L<has
509509
=head2 circumfix C«[ ]»
510510
511511
The X<L<Array> constructor> returns an itemized L<Array> that does not flatten
512-
in list context.
512+
in list context. Check this:
513+
514+
say .perl for [3,2,[1,0]; # OUTPUT: «3␤2␤$[1, 0]␤»
515+
516+
This array is itemized, in the sense that every element constitutes an item, as
517+
shown by the C<$> preceding the last element of the array, the
518+
L<(list) item contextualizer|https://docs.perl6.org/type/Any#index-entry-%24_%28item_contextualizer%29>.
519+
520+
The output will be (almost) the same if we attempt to flatten it using
521+
L<C<|> a. k. a. I<the flattener>|/routine/|>, which puts it in a list context:
522+
523+
say .perl for | 3,2,[1,0]; # OUTPUT: «3␤2␤[1, 0]␤»
524+
513525
514526
=head1 Method postfix precedence
515527

0 commit comments

Comments
 (0)