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
744 B
744 B
name, slug, sourceRef, category, subCategory, signatures, playUrl, variantHelpers, similarHelpers, position
| name | slug | sourceRef | category | subCategory | signatures | playUrl | variantHelpers | similarHelpers | position | |||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Sliding | sliding | it/seq.go#L329 | it | sequence |
|
https://go.dev/play/p/mzhO4CZeiik |
|
|
80 |
Creates a sequence of sliding windows of a given size with a given step. If step equals size, windows don't overlap.
seq := func(yield func(int) bool) {
yield(1)
yield(2)
yield(3)
yield(4)
yield(5)
yield(6)
yield(7)
yield(8)
}
windows := it.Sliding(seq, 2, 3)
var result [][]int
for w := range windows {
result = append(result, w)
}
// result contains [1 2], [4 5], [7 8]