This is the package with functions from Python/other language, that you are searching for in Go (Golang)
Most of the functions from this lib became possible to be written because of generics. So, it is make sense to use the library only if your project is ready to use go >=1.18
- go get github.com/waclawthedev/go-sugaring
- Call the function. For example:
print(sugar.Contains([]string{"a", "b", "c"}, "a"))
//output: true
- sugar.Contains - check if slice contains element
- sugar.IndexesOf - get the slice with occurrences (indexes) of element in slice
- sugar.Map - Map function. Python analog
- sugar.Filter - Filter function. Python analog
- sugar.Reduce - Reduce function. Python analog
- sugar.Flatten - Transforms matrix to slice
- sugar.Min - min element in slice
- sugar.Max - max element in slice
- sugar.Keys - get keys of map as slice
- sugar.Values - get values of map as slice