Releases: elliotchance/pie
Releases · elliotchance/pie
v2.9.0
v2.8.1
Renamed Lenght to Length everywhere 🗿 (#201) Co-authored-by: quackable <matsveimaksimau@nb-pg77059hj9.barn-sun.ts.net>
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 <6203454+kirillmorozov@users.noreply.github.com>
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
v2.4.0
Adding Flat (#187) Flat flattens the two-dimensional slice into one-dimensional slice. Slices of zero-length are ignored. Examples: Flat([[100], [101, 102], [102, 103]]) => [100, 101, 102, 102, 103] Flat([nil, [101, 102], []]) => [101, 102] Co-authored-by: Dmytro Misik <d.misik@draftkings.com>