Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JJ committed Oct 7, 2018
1 parent 4155d56 commit 13f5943
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion doc/Language/operators.pod6
Expand Up @@ -509,7 +509,19 @@ To always ensure you end up with a L<Hash>, you can use C<%( )> coercer or L<has
=head2 circumfix C«[ ]»
The X<L<Array> constructor> returns an itemized L<Array> that does not flatten
in list context.
in list context. Check this:
say .perl for [3,2,[1,0]; # OUTPUT: «3␤2␤$[1, 0]␤»
This array is itemized, in the sense that every element constitutes an item, as
shown by the C<$> preceding the last element of the array, the
L<(list) item contextualizer|https://docs.perl6.org/type/Any#index-entry-%24_%28item_contextualizer%29>.
The output will be (almost) the same if we attempt to flatten it using
L<C<|> a. k. a. I<the flattener>|/routine/|>, which puts it in a list context:
say .perl for | 3,2,[1,0]; # OUTPUT: «3␤2␤[1, 0]␤»
=head1 Method postfix precedence
Expand Down

0 comments on commit 13f5943

Please sign in to comment.