add some func

This commit is contained in:
xing 2024-06-24 21:19:24 +08:00
parent d598fb5ce5
commit e592a753bf

View File

@ -102,3 +102,9 @@ func DecompressBy[T, R any](a [][]T, fn func(T) (R, bool)) (r []R) {
}
return
}
func Replace[T any](a []T, offset int, replacement []T) {
aa := a[offset:]
aa = aa[:0]
aa = append(aa, replacement...)
}