Group (BQN)
⊔

Group (⊔
) is a primitive function in BQN that places values at the specified indices in the result. Because each index can appear multiple times in the array of indices, or not at all, each result element is a list of all the values placed there. Group is ambivalent: in the dyadic case, the left argument is the array of indices and the right argument is the array of values. In the monadic case ("Group Indices"), the right argument gives the result indices and the values used are the indices of that argument. The name "Group" is also used for a related primitive ⊕
in Uiua, which takes two arguments as well as a function to be applied to each result group.
Together with Classify, Group can be used to implement the functionality of Key or K's Group (=
) primitive. Group can be used for Partitioned Enclose and Partition in BQN by manipulating the left argument: for example, summing with +⍀
gives a function similar to Partitioned Enclose.
See also
Documentation