>From consistency view, the name should really be slices.IndexElem. Maybe indexing subslices other than bytes and string is not common in practice.
On Wednesday, December 10, 2025 at 6:54:09 AM UTC+8 [email protected] wrote: > Hi fellow Gophers > > I wonder why is the `Index` function from the "slices" package much less > powerful than the one in the "bytes" package? > > `bytes.Index` allows us to search for {1, 2, 3} within {1, 1, 2, 3}, > whereas `slices.Index` only does the trivial thing of whether a single 2 is > inside {1, 1, 2, 3}. > > What is the best way of doing `bytes.Index` but on say integer slices > `[]int`? > Is it reasonable to propose adding a function `slices.IndexAll` to the > "slices" package? > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/b34404b8-dba1-48a4-9c8d-de43d4e11badn%40googlegroups.com.
