Files
fn_registry/functions/core/pipeline.go
T
egutierrez 16e34a806e feat: 6 funciones core — retry, memoize, pipeline, map_concurrent, partition, chunk
Funciones genericas reutilizables:
- RetryWithBackoff: reintento con backoff exponencial (impure)
- Memoize: cache de funciones puras (pure)
- Pipeline: composición T→T en secuencia (pure)
- MapConcurrent: map paralelo con worker pool (impure)
- Partition: divide slice en dos por predicado (pure)
- Chunk: divide slice en trozos de tamaño N (pure)
Todas con implementación real y documentación .md.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 02:23:26 +01:00

14 lines
374 B
Go

package core
// Pipeline composes a sequence of functions T -> T into a single function.
// The functions are applied left to right: Pipeline(f, g, h)(x) == h(g(f(x))).
// Returns the identity function if no functions are provided.
func Pipeline[T any](fns ...func(T) T) func(T) T {
return func(val T) T {
for _, fn := range fns {
val = fn(val)
}
return val
}
}