mirror of
https://github.com/samber/lo.git
synced 2026-04-22 23:47:11 +08:00
2.3 KiB
2.3 KiB
name, slug, sourceRef, category, subCategory, signatures, playUrl, variantHelpers, similarHelpers, position
| name | slug | sourceRef | category | subCategory | signatures | playUrl | variantHelpers | similarHelpers | position | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ZipX | zipx | it/tuples.go#L14 | it | tuple |
|
https://go.dev/play/p/U5nBWvR8eUZ |
|
|
0 |
Creates a sequence of grouped elements from multiple sequences. The resulting sequence has length equal to the shortest input sequence.
Variants: Zip2..Zip9
seq1 := func(yield func(int) bool) {
_ = yield(1)
_ = yield(2)
_ = yield(3)
}
seq2 := func(yield func(string) bool) {
_ = yield("a")
_ = yield("b")
_ = yield("c")
}
zipped := it.Zip2(seq1, seq2)
var result []string
for tuple := range zipped {
result = append(result, fmt.Sprintf("%d%s", tuple.A, tuple.B))
}
// result contains "1a", "2b", "3c"