single-use iterator
ref: Pure vs. impure iterators in Go :: jub0bs.com
標準パッケージの go docs を読んでいると以下のような表現を見る
https://pkg.go.dev/strings#SplitSeq
https://go.dev/play/p/ZFOcPvh4sSQ
SplitSeq returns an iterator over all substrings of s separated by sep. The iterator yields the same strings that would be returned by Split(s, sep), but without constructing the slice. It returns a single-use iterator.
single-use iterator = 使い捨てイテレータ、のように訳される場合がある
https://pkg.go.dev/iter#hdr-Single_Use_Iterators
iter パッケージ内で詳しい解説がある
Most iterators provide the ability to walk an entire sequence: when called, the iterator does any setup necessary to start the sequence, then calls yield on successive elements of the sequence, and then cleans up before returning. Calling the iterator again walks the sequence again.
Some iterators break that convention, providing the ability to walk a sequence only once. These “single-use iterators” typically report values from a data stream that cannot be rewound to start over. Calling the iterator again after stopping early may continue the stream, but calling it again after the sequence is finished will yield no values at all. Doc comments for functions or methods that return single-use iterators should document this fact:
code:iter.go
// Lines returns an iterator over lines read from r.
// It returns a single-use iterator.
func (r *Reader) Lines() iter.Seqstring
通常イテレータは繰り返し走査が完了しもう一度実行されると同じように繰り返すが、例にもあるように一度実行されたら値を返さない場合があり、doc comment に single-use iterators であると明記すべきとある
記事内では、状態に依存せず何度繰り返しても同じ結果が得られるイテレータを Pure, クロージャとなっているイテレータで内部的にカウントアップされるフィボナッチ関数を例にして、状態をもったイテレータについては Impure としている
そういった意味ではGoにおいて用語が成熟してないのでは、というのが著者の指摘