You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
The key has expired.
Add GroupBy (#189)
GroupBy groups slice elements by key returned by getKey function for each
slice element.
It returns a map in which slices of elements of original slice are matched
to keys defined by getKey function. It returns non-nil map, if empty or nil
slice is passed.
For example, if you want to group integers by their remainder from division
by 5, you can use this function as follows:
_ = pie.GroupBy(
[]int{23, 76, 37, 11, 23, 47},
func(num int) int {
return num % 5
},
)
In above case map {1:[76, 11], 2:[37, 47], 3:[23, 23]} is returned.
Fixes #188