goext/langext/iter.go
Mike Schwörer 10a6627323
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 1m33s
v0.0.559 Add .Iterate and .IterateFunc methods to wmo
2025-01-28 15:55:18 +01:00

22 lines
323 B
Go

package langext
import (
"iter"
)
func IterSingleValueSeq[T any](value T) iter.Seq[T] {
return func(yield func(T) bool) {
if !yield(value) {
return
}
}
}
func IterSingleValueSeq2[T1 any, T2 any](v1 T1, v2 T2) iter.Seq2[T1, T2] {
return func(yield func(T1, T2) bool) {
if !yield(v1, v2) {
return
}
}
}