group-by ( seq quot: ( elt -- key ) -- groups )


Vocabulary
grouping.extras

Inputs and outputs
seqa sequence
quota quotation with stack effect ( elt -- key )
groupsa new assoc


Word description
Groups the elements by the key received by applying quot to each element in the sequence.

Examples
USING: grouping.extras unicode.data prettyprint sequences strings ; "THis String Has CasE!" [ category ] group-by [ last >string ] { } map-as .
{ "TH" "is" " " "S" "tring" " " "H" "as" " " "C" "as" "E" "!" }


Definition