Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Explain Hash.classify-list :&as argument
  • Loading branch information
zoffixznet committed Sep 25, 2016
1 parent 782e000 commit b234967
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions doc/Type/Hash.pod6
Expand Up @@ -379,6 +379,19 @@ must have the same number of elements, or the method will throw an exception.
This restriction exists to avoid conflicts when the same key is a
leaf of one value's classification but a node of another value's classification.
=head3 C<:&as> value modifier
If C<:&as> L«C<Callable>|/type/Callable» argument is specified, it will be
called once per each item of C<@list>, with the value as the argument, and
its return value will be used instead of the original C<@list>'s item:
say % .classify-list: :as{"Value is $_"}, { $_ %% 2 ?? 'even' !! 'odd' }, ^5;
# OUTPUT (slightly altered manually, for clarity):
# {
# even => ['Value is 0', 'Value is 2', 'Value is 4'],
# odd => ['Value is 1', 'Value is 3']
# }
=head2 method categorize-list
Defined as:
Expand Down

0 comments on commit b234967

Please sign in to comment.