github.com/mtoohey31/iter/v2 (go): Package iter provides generic, lazy iterators, functions for producing them from primitive types, as well as functions and methods for transforming and consuming them.  When reading the documentation of the functions contained in this package, you should assume that any function which accepts an iterator, but does not return one, consumes it unless otherwise stated, meaning that the values contained within cannot be used again.  It might seem as though this package's API contains some duplicate functionality, since there are many functions that appear to do the same thing as methods of the same names defined on Iter[T]. However, there is an important difference between these functions and their method counterparts. Since Go does not support type parameters on methods, (Iter[T]).Map can only return Iter[T] (an iterator of the same type as the input iterator). Map does not have this limitation; it can map from an Iter[T] to an Iter[U] (an iterator with a different type than the input iterator). The method versions are still provided even though their functionality is a strict subset of that of the function versions because using methods when possible results in more readable code.
Keywords: generic|generics|go|golang|iterator|lazy