Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Change example of sorting multidimmed
Although the syntax "sort(*[1])" is technically correct, I felt it could
be confusing to naive readers with the "say @A[*;1]" syntax just two lines
before it.  Using "sort( { $_[1] } )" is less magic at a place where
there's already quite some magic introduced.
  • Loading branch information
lizmat committed Jun 12, 2018
1 parent ccb4f25 commit bdf3baf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion doc/Language/subscripts.pod6
Expand Up @@ -355,7 +355,7 @@ multidimensional subscripts.
say @a[*;1]; # 2nd element of each sub list
# OUTPUT: «(2 4)␤»
my @a = (<1 c 6>, <2 a 4>, <5 b 3>);
say @a.sort(*[1]); # sort by 2nd column
say @a.sort( { $_[1] } ); # sort by 2nd column
# OUTPUT: «((2 a 4) (5 b 3) (1 c 6))␤»
=head1 Modifying elements
Expand Down

0 comments on commit bdf3baf

Please sign in to comment.