func MapError[T, U any](s []T, f func(T) (U, error)) ([]U, error)
MapError applies the given function to each element of the given slice and returns a new slice with the
results. If any element returns an error that error is returned, as well as the slice of results so far.
Preallocates a slice of type T of a given length. If the input length is 0 then the returned slice will be
nil. We prefer this over `make([]T, 0, length)` because nil is often treated semantically different from an
empty slice.