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
697 B
697 B
name, slug, sourceRef, category, subCategory, signatures, playUrl, variantHelpers, similarHelpers, position
| name | slug | sourceRef | category | subCategory | signatures | playUrl | variantHelpers | similarHelpers | position | |||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Window | window | it/seq.go#L318 | it | sequence |
|
https://go.dev/play/p/_1BzQYtKBhi |
|
|
70 |
Creates a sequence of sliding windows of a given size. Each window overlaps with the previous one by size-1 elements.
seq := func(yield func(int) bool) {
yield(1)
yield(2)
yield(3)
yield(4)
yield(5)
}
windows := it.Window(seq, 3)
var result [][]int
for w := range windows {
result = append(result, w)
}
// result contains [1 2 3], [2 3 4], [3 4 5]