Releases: elliotchance/pie
Releases · elliotchance/pie
v2.9.1
v2.9.0
Add a new slice method: UniqueStable (#203) UniqueStable works similar to Unique. However, unlike Unique the slice returned will be in previous relative order. Co-authored-by: Westrious <[email protected]>
v2.8.1
Renamed Lenght to Length everywhere 🗿 (#201) Co-authored-by: quackable <[email protected]>
v2.8.0
Added Rotate (#198) Rotate returns slice circularly rotated by a number of positions n. If n is positive, the slice is rotated right. If n is negative, the slice is rotated left.
v2.7.1
Shift to accept any parameter (#197)
v2.7.0
Add Delete function (#194) Delete removes elements at indices in idx from input slice, returns resulting slice. If an index is out of bounds, skip it.
v2.6.0
Add Zip and ZipLongest function (#193) Zip will return a new slice containing pairs with elements from input slices. If input slices have different length, the output slice will be truncated to the length of the smallest input slice. ZipLongest will return a new slice containing pairs with elements from input slices. If input slices have diffrent length, missing elements will be padded with default values. These are the same as zip() and itertools.zip_longest() in Python.
v2.5.2
perf: New implemention for Diff() (#191) Using set instead of nested for loops, the time complexity is reduced from O(n^2) to O(n)
v2.5.1
docs: Add doc comments to `OfSlice[T]` methods (#190) Copy doc comments from functions to the respective OfSlice[T] methods. Fixes #186 Co-authored-by: Kirill Morozov <[email protected]>
v2.5.0
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