---
name: flat_map
kind: function
lang: py
domain: core
version: "1.0.0"
purity: pure
signature: "def flat_map(xs: list, fn: callable) -> list"
description: "Aplica una funcion que retorna listas a cada elemento y aplana el resultado un nivel."
tags: [list, functional, flatmap, python, pendiente-usar]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: ""
imports: []
params:
  - name: xs
    desc: "lista a transformar"
  - name: fn
    desc: "funcion que recibe un elemento y retorna una lista"
output: "lista plana resultado de aplicar fn a cada elemento y aplanar un nivel"
tested: false
tests: []
test_file_path: ""
file_path: "python/functions/core/core.py"
---

## Ejemplo

```python
result = flat_map([1, 2, 3], lambda n: [n, n * 10])
# [1, 10, 2, 20, 3, 30]
```

## Notas

Funcion pura. Equivalente a flatten(map_list(xs, fn)). Solo aplana un nivel.
