Re:K: We need to talk about group
by nextaccountic on Friday March 31, 2023 @02:14PM
(#35390991)
What is group?
[ Parent
| on HN ]
Some context would be really nice indeed.
https://gist.github.com/chrispsn/3450fe6172a7cc441d0819379ed... <- Here you go, some context about what group is and does (or was and did, in this case) in the K language.
The Linux /etc/group file was my first and incorrect thought.
Group is (was) a function in various array languages, including K, APL, BQN, J, and Shakti.
Good point - added a simple explanation in the article:
Group tells you the places each element occurs in a list. It generates lists of indices.
Re:K: We need to talk about group
by nextaccountic on Saturday April 01, 2023 @04:29AM
(#35398419)
Nice! Sounds useful for scatter and gather algorithms
https://en.wikipedia.org/wiki/Gather/scatter_(vector_address...
A group is a non-empty set and an operation that combines any two elements of the set to produce a third element of the set, in such a way that the operation is associative, an identity element exists and every element has an inverse. /s
Group is actually like inverse a mapping. Given an array A which map index to value, group A map value to index.
A common idiom is: desc count each group A , which list most frequent element first