133982cfaf
Composicion: Pipe2, Pipe3, Compose2, Identity, Curry2, Uncurry2, Partial2, Flip, Const. Slices: Find, FindIndex, Any, All, GroupBy, Flatten, FlatMapSlice, Unique, Zip, Reduce, Take, Drop. Stubs que documentan devfactory/core para el registry.
669 B
669 B
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, tested, tests, test_file_path, file_path
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | tested | tests | test_file_path | file_path | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| reduce | function | go | core | 1.0.0 | pure | func Reduce[T, U any](slice []T, initial U, f func(U, T) U) U | Reduce un slice a un unico valor aplicando una funcion acumuladora de izquierda a derecha. |
|
false | false | functions/core/reduce.go |
Ejemplo
sum := Reduce([]int{1, 2, 3, 4}, 0, func(acc, x int) int { return acc + x })
// sum = 10
Notas
Funcion pura generica. Implementacion en devfactory/core.