v0.0.559 Add .Iterate and .IterateFunc methods to wmo
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 1m33s

This commit is contained in:
2025-01-28 15:55:18 +01:00
parent 06b3b4116e
commit 10a6627323
5 changed files with 105 additions and 9 deletions

21
langext/iter.go Normal file
View File

@@ -0,0 +1,21 @@
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
}
}
}