Created
July 19, 2016 20:02
-
-
Save dogbert17/dddb8b7d8db541ca5c1e9998146ff960 to your computer and use it in GitHub Desktop.
Attempt to document List.Capture
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=head2 method Capture | |
Defined as: | |
method Capture() returns Capture:D | |
Usage: | |
LIST.Capture | |
Returns a L<Capture|/type/Capture> where each L<Pair|/type/Pair>, if any, in | |
the C<List> has been converted to a named argument. All other elements in the | |
C<List> are converted to positional arguments in the order they are found, | |
i.e. the first non pair item in the list becomes the first positional argument, | |
the second non pair item becomes the second positional argument etc. | |
my $list = (7, 5, a => 2, b => 17); | |
my $capture = $list.Capture; | |
my-sub(|$capture); # 7, 5, 2, 17 | |
sub my-sub($first, $second, :$a, :$b) { | |
say "$first, $second, $a, $b" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment