5 ms·
I would add: an extended standard library for "common stuff". I don't want to import a third-party library nor write my own "utils.go" to do: func contains
by sdevonoes 5y ago
I would add: an extended standard library for "common stuff". I don't want to import a third-party library nor write my own "utils.go" to do:
func contains(s []int, e int) bool {
for _, a := range s {
if a == e {
return true
}
}
return false
}
- Mawr 5y agoIf you need to look up or worse, delete, a value in a slice, then you probably shouldn't be using a slice in the first place. You probably want to replace your slice with a set.
- arccy 5y agosoon-ish https://cs.opensource.google/go/x/exp/+/master:slices/slices.go;l=121 https://cs.opensource.google/go/x/exp/+/master:slices/slices...