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,34 @@
|
||||
---
|
||||
name: compose2
|
||||
kind: function
|
||||
lang: go
|
||||
domain: core
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func Compose2[A, B, C any](f2 func(B) C, f1 func(A) B) func(A) C"
|
||||
description: "Compone dos funciones de derecha a izquierda. compose2(g, f)(x) = g(f(x))."
|
||||
tags: [functional, composition, generic]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: []
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/core/compose2.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
double := func(x int) int { return x * 2 }
|
||||
toString := func(x int) string { return fmt.Sprintf("%d", x) }
|
||||
doubleStr := Compose2(toString, double)
|
||||
result := doubleStr(5) // "10"
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Funcion pura generica. Implementacion en devfactory/core.
|
||||
Reference in New Issue
Block a user