mirror of
https://github.com/samber/lo.git
synced 2026-04-22 23:47:11 +08:00
863 B
863 B
name, slug, sourceRef, category, subCategory, signatures, playUrl, variantHelpers, similarHelpers, position
| name | slug | sourceRef | category | subCategory | signatures | playUrl | variantHelpers | similarHelpers | position | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Union | union | it/intersect.go#L136 | it | intersect |
|
https://go.dev/play/p/ImIoFNpSUUB |
|
|
20 |
Returns all distinct elements from given collections (union of all collections).
Examples:
seq1 := func(yield func(int) bool) {
_ = yield(1)
_ = yield(2)
_ = yield(3)
}
seq2 := func(yield func(int) bool) {
_ = yield(2)
_ = yield(3)
_ = yield(4)
}
seq3 := func(yield func(int) bool) {
_ = yield(3)
_ = yield(5)
}
union := it.Union(seq1, seq2, seq3)
var result []int
for v := range union {
result = append(result, v)
}
// result contains 1, 2, 3, 4, 5 (all distinct elements)