feat: funciones core filter_slice y map_slice
Primeras funciones reales del registry: - filter_slice: filtra un slice con predicado, pura, generica - map_slice: transforma cada elemento de un slice, pura, generica Cada una con implementacion .go, documentacion .md y tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package core
|
||||
|
||||
// MapSlice applies fn to each element of xs and returns a new slice with the results.
|
||||
// Does not mutate the original slice.
|
||||
func MapSlice[T any, U any](xs []T, fn func(T) U) []U {
|
||||
result := make([]U, len(xs))
|
||||
for i, x := range xs {
|
||||
result[i] = fn(x)
|
||||
}
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user