4 ms·
According to https://pkg.go.dev/iter#hdr-Single_Use_Iterators https://pkg.go.dev/iter#hdr-Single_Use_Iterators , most iterators are expected to be reusable, but
by Thorrez 2y ago
According to https://pkg.go.dev/iter#hdr-Single_Use_Iterators https://pkg.go.dev/iter#hdr-Single_Use_Iterators , most iterators are expected to be reusable, but some are single use. A function returning a single-use iterator is expected to document that with a comment.
So the Reverse implementation in this article wouldn't work with single-use iterators. The iter package isn't clear whether a function that requires a multi-use iterator needs to be documented as such.