Files
lo/docs/data/it-window.md
T
Samuel Berthe fa095e4b4f fix(doc): fix go playground demo URL (#832)
* fix(doc): fix go playground demo URL

* fix(doc): add more go playground demo URL
2026-03-06 00:09:59 +01:00

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
func Window[T any](collection iter.Seq[T], size int) iter.Seq[[]T]
https://go.dev/play/p/_1BzQYtKBhi
it#sequence#window
core#slice#window
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]