c72ae15429
Sistema de extracción de funciones desde repos externos. Agrega campos source_repo, source_license y source_file en functions y types (migración 006). Incluye manifest sources/sources.yaml, regla sources.md, parser con campos de atribución, y template actualizado con los nuevos campos. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
37 lines
831 B
Markdown
37 lines
831 B
Markdown
---
|
|
name: filter_slice
|
|
kind: function
|
|
lang: go
|
|
domain: core
|
|
version: "1.0.0"
|
|
purity: pure
|
|
signature: "func FilterSlice[T any](xs []T, pred func(T) bool) []T"
|
|
description: "Filtra un slice aplicando un predicado sin mutar el original."
|
|
tags: [slice, functional, generic]
|
|
uses_functions: []
|
|
uses_types: []
|
|
returns: []
|
|
returns_optional: false
|
|
error_type: ""
|
|
imports: []
|
|
tested: false
|
|
tests: []
|
|
test_file_path: ""
|
|
file_path: "functions/core/filter_slice.go"
|
|
# Source attribution (solo para funciones extraidas de repos externos)
|
|
# source_repo: "https://github.com/user/project"
|
|
# source_license: "MIT"
|
|
# source_file: "pkg/utils.go"
|
|
---
|
|
|
|
## Ejemplo
|
|
|
|
```go
|
|
evens := FilterSlice([]int{1, 2, 3, 4}, func(n int) bool { return n%2 == 0 })
|
|
// evens = [2, 4]
|
|
```
|
|
|
|
## Notas
|
|
|
|
Funcion pura generica. No muta el slice original — crea uno nuevo.
|