Last active
February 19, 2025 17:38
-
-
Save jarrodhroberson/19d6fc559f9cb1aeb7167686e74529ef to your computer and use it in GitHub Desktop.
iter.Seq/iterSeq2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Seq is an iterator over sequences of individual values. | |
// When called as seq(yield), seq calls yield(v) for each value v in the sequence, | |
// stopping early if yield returns false. | |
// See the [iter] package documentation for more details. | |
type Seq[V any] func(yield func(V) bool) | |
// Seq2 is an iterator over sequences of pairs of values, most commonly key-value pairs. | |
// When called as seq(yield), seq calls yield(k, v) for each pair (k, v) in the sequence, | |
// stopping early if yield returns false. | |
// See the [iter] package documentation for more details. | |
type Seq2[K, V any] func(yield func(K, V) bool) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment