ForEach consumes the Iterator applying fn to each yielded value.
(it Iterator[T], fn func(T))
| 322 | |
| 323 | // ForEach consumes the Iterator applying fn to each yielded value. |
| 324 | func ForEach[T any](it Iterator[T], fn func(T)) { |
| 325 | v := it.Next() |
| 326 | for v.IsSome() { |
| 327 | fn(v.Unwrap()) |
| 328 | v = it.Next() |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | // Fold reduces Iterator using function fn. |
| 333 | func Fold[T any, B any](it Iterator[T], init B, fn func(B, T) B) B { |
searching dependent graphs…