mirror of
https://github.com/samber/lo.git
synced 2026-04-22 23:47:11 +08:00
706 B
706 B
name, slug, sourceRef, category, subCategory, signatures, playUrl, variantHelpers, similarHelpers, position
| name | slug | sourceRef | category | subCategory | signatures | playUrl | variantHelpers | similarHelpers | position | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chunk | chunk | it/seq.go#L264 | it | sequence |
|
|
|
60 |
Returns a sequence of elements split into groups of length size. The last chunk may be smaller than size.
Examples:
seq := func(yield func(int) bool) {
_ = yield(1)
_ = yield(2)
_ = yield(3)
_ = yield(4)
_ = yield(5)
}
chunks := it.Chunk(seq, 2)
var result [][]int
for chunk := range chunks {
result = append(result, chunk)
}
// result contains [1, 2], [3, 4], [5]