Documentation for routine classify

Documentation for routine classify, assembled from the following types:

class Any

From Any

(Any) method classify

Defined As:

    method classify(--> TODO)

TODO

class List

From List

(List) routine classify

Defined as:

sub    classify(&mapper*@values --> Hash:D)
method classify(List:D: &mapper   --> Hash:D)

Transforms a list of values into a hash representing the classification of those values according to &mapper; each hash key represents the classification for one or more of the incoming list values, and the corresponding hash value contains an array of those list values classified by the mapper into the category of the associated key.

Example:

say classify { $_ %% 2 ?? 'even' !! 'odd' }, (17632);
# OUTPUT: «{even => [6 2], odd => [1 7 3]}␤» 
say ('hello'122/742'world').classify: { .Str.chars };
# OUTPUT: «{1 => [1], 2 => [42], 5 => [hello world], 8 => [3.142857]}␤»