cerrado @ e52226c05fb54dfe41c9bc5ebc6ce1b7ded7e1fe

 1package u
 2
 3func First[T any](v []T) (T, bool) {
 4	if len(v) == 0 {
 5		var zero T
 6		return zero, false
 7	}
 8	return v[0], true
 9}
10
11func ChunkBy[T any](items []T, chunkSize int) [][]T {
12	var chunks = make([][]T, 0, (len(items)/chunkSize)+1)
13	for chunkSize < len(items) {
14		items, chunks = items[chunkSize:], append(chunks, items[0:chunkSize:chunkSize])
15	}
16	return append(chunks, items)
17}