iter: add more examples #73292
Labels
Documentation
Issues describing a change to documentation.
FixPending
Issues that have a fix which has not yet been reviewed or submitted.
NeedsFix
The path to resolution is known, but the work has not been done.
Proposal Details
Background
The iter package was introduced in Go 1.22 as a new standard library package
for working with iterators. It provides important abstractions like Seq and
Seq2 types, along with the Pull and Pull2 functions.
Currently, the package has comprehensive documentation in the comment blocks,
but lacks an example_test.go file with concrete, runnable examples. This
makes it harder for users to understand the idiomatic usage patterns for
iterators, especially for the Pull functions.
Proposal
Add an example_test.go file to the iter package that demonstrates:
Expected Benefits
Having clear, runnable examples will:
These examples would be especially helpful for this new package as developers
are still learning the idiomatic ways to use iterators in Go.
Implementation Plan
I'm willing to implement this improvement by creating a new example_test.go
file with comprehensive examples if the proposal is accepted.
/cc @golang/docs
The text was updated successfully, but these errors were encountered: