Last active
May 21, 2017 14:16
-
-
Save dogbert17/4bcbc10b4843d64b6cb14987f766b013 to your computer and use it in GitHub Desktop.
Attempt to document Setty
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 pickpairs | |
Defined as: | |
multi method pickpairs(Setty:D: --> Pair:D) | |
multi method pickpairs(Setty:D: $count --> Seq:D) | |
Returns a C<Pair> or a C<Seq> of C<Pair>s depending on the candidate of the method | |
being invoked. Each C<Pair> returned has an element of the invocant as its key and | |
<True> as its value. The elements are 'picked' without replacement. If C<*> | |
is passed as C<$count>, or C<$count> is greater than or equal to the number of | |
L<elements|#method elems> of the invocant, then all element/C<True> C<Pair>s from | |
the invocant are returned in a random sequence. | |
Note that each C<pickpairs> invocation maintains its own private state and has | |
no effect on subsequent C<pickpairs> invocations. | |
my $numbers = set (4, 2, 3); | |
say $numbers.pickpairs; # OUTPUT: «4 => True» | |
say $numbers.pickpairs(1); # OUTPUT: «(3 => True)» | |
say $numbers.pickpairs(*); # OUTPUT: «(2 => True 4 => True 3 => True)» |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment