»
group_map
Sequence.group_map
(K
type
:
property.orderable, B type
, key_f Unary K Sequence.T, f Unary B Sequence.T) =>
container.Map K (Sequence B)[Contains abstract features]
¶Type Parameters
type of the keys
0.094dev (2025-06-18 15:08:51 GIT hash 89cffc23ae669b0898a5564fefbf793fcb8e5ca7 built by fridi@fzen)
example: group characters by category and add underscores around each character
values array codepoint := ["A", "1", "b", "?", "X", "4"]
classify (c codepoint) String => c.is_ascii_letter ? "letter" : c.is_ascii_digit ? "digit" : "other"
values.group_map String String classify (x->"_{x}_")
=> {(digit => [_1_, _4_]), (letter => [_A_, _b_, _X_]), (other => [_?_])}