Skip to content

Commit

Permalink
Adds example for multi-dim {} slicing closes #2436
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ committed Nov 3, 2018
1 parent 8a61a9c commit cc34198
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions doc/Language/create-cli.pod6
Expand Up @@ -298,7 +298,7 @@ X<|ARGS-TO-CAPTURE>
The C<ARGS-TO-CAPTURE> subroutine should accept two parameters: a L<Callable>
representing the C<MAIN> unit to be executed (so it can be introspected if
necessary) and an array with the arguments from the command line. It
should return a L<Capture|/type/Capture> object that should be used to
should return a L<Capture|/type/Capture> object that will be used to
dispatch the C<MAIN> unit. A B<very> contrived example that will create
a C<Capture> depending on some keyword that was entered (which can be handy
during testing of a command line interface of a script):
Expand Down Expand Up @@ -334,7 +334,7 @@ ecosystem.
X<|GENERATE-USAGE>
=head2 sub GENERATE-USAGE
The C<GENERATE-USAGE> subroutine should accept a Callable representing the
The C<GENERATE-USAGE> subroutine should accept a C<Callable> representing the
C<MAIN> subroutine that didn't get executed because the dispatch failed.
This can be used for introspection. All the other parameters are the
parameters that were set up to be sent to C<MAIN>. It should return the
Expand All @@ -348,7 +348,7 @@ arguments:
!! &*GENERATE-USAGE(&main, |capture)
}
You can also use multi subroutine to create the same effect:
You can also use multi subroutines to create the same effect:
multi sub GENERATE-USAGE(&main, :$foo!) {
"You're not allowed to specify a --foo"
Expand Down Expand Up @@ -376,7 +376,7 @@ called if a C<MAIN> subroutine was found in the mainline of a program.
This interface was never documented. However, any programs using this
undocumented interface will continue to function until C<v6.e>. From v6.d
onward, the use of the undocumented API will cause a DEPRECATED message.
onward, the use of the undocumented API will cause a C<DEPRECATED> message.
Ecosystem modules can provide both the new and the old interface for
compatibility with older versions of Perl 6: if a newer Perl 6 recognizes
Expand Down
6 changes: 6 additions & 0 deletions doc/Language/subscripts.pod6
Expand Up @@ -346,6 +346,12 @@ elements and dimensions.
say @twodim[0,1;1]; # 2nd element of both lists
# OUTPUT: «(b 2)␤»
my %pantheon = %('Baldr' => 'consort' => 'Nanna' ,
'Bragi' => 'consort' => 'Iðunn' ,
'Nótt' => 'consort' => 'Dellingr' );
say %pantheon{'Bragi','Nótt';'consort'; # 'consort' value for both keys
# OUTPUT: «(Iðunn Dellingr)␤»
X<|flattening ;>
Multidimensional subscripts can be used to flatten nested lists when combined
Expand Down

0 comments on commit cc34198

Please sign in to comment.