Grokking Advanced Go
0% completed
The iter Package
The package iter, added in Go 1.23, gives names to the two iterator forms that produce values. It defines a sequence of single values and a sequence of pairs, and each definition is one line of code.
type ( Seq[V any] func(yield func(V) bool) Seq2[K, V any] func(yield func(K, V) bool) )
These types add no behavior to a function. They give every iterator of the same form one shared name, so signatures in different packages can state the same type.
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%