feat: 21 funciones core — composicion funcional y operaciones de slice
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.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: reduce
|
||||
kind: function
|
||||
lang: go
|
||||
domain: core
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func Reduce[T, U any](slice []T, initial U, f func(U, T) U) U"
|
||||
description: "Reduce un slice a un unico valor aplicando una funcion acumuladora de izquierda a derecha."
|
||||
tags: [slice, functional, generic, fold]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/core/reduce.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
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.
|
||||
Reference in New Issue
Block a user