mirror of
https://github.com/samber/lo.git
synced 2026-04-22 23:47:11 +08:00
fa095e4b4f
* fix(doc): fix go playground demo URL * fix(doc): add more go playground demo URL
648 B
648 B
name, slug, sourceRef, category, subCategory, signatures, variantHelpers, playUrl, similarHelpers, position
| name | slug | sourceRef | category | subCategory | signatures | variantHelpers | playUrl | similarHelpers | position | ||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Flatten | flatten | it/seq.go#L26 | it | sequence |
|
https://go.dev/play/p/CCklxuNk7Lm |
|
172 |
Flatten returns a sequence a single level deep.
seq1 := func(yield func(int) bool) {
yield(1)
yield(2)
}
seq2 := func(yield func(int) bool) {
yield(3)
yield(4)
}
flattened := it.Flatten([]iter.Seq[int]{seq1, seq2})
var result []int
for item := range flattened {
result = append(result, item)
}
// result contains [1, 2, 3, 4]