This library contains functions to operate on Go types in a generic and immutable way. Most of the overall behavior exists in the standard library as mutating functions already and you should really only use this library if you specifically require the immutability guarantees.
See it in action:
package foo
import (
"slices"
"github.com/mkeeler/go-immutable/immutableslice"
)
func FindAndRemove(s []int, v int) []int {
idx := slices.Index(s, v)
return immutableslice.Delete(s, idx, idx+1)
}