MCPcopy Create free account
hub / github.com/Soft/iter / Any

Function Any

iterator.go:440–449  ·  view source on GitHub ↗

Any tests if any element of the Iterator matches a predicate. An empty Iterator returns false.

(it Iterator[T], pred func(T) bool)

Source from the content-addressed store, hash-verified

438// Any tests if any element of the Iterator matches a predicate. An empty
439// Iterator returns false.
440func Any[T any](it Iterator[T], pred func(T) bool) bool {
441 v := it.Next()
442 for v.IsSome() {
443 if pred(v.Unwrap()) {
444 return true
445 }
446 v = it.Next()
447 }
448 return false
449}
450
451// Nth returns nth element of the Iterator.
452func Nth[T any](it Iterator[T], n uint) Option[T] {

Callers 1

TestAnyFunction · 0.85

Calls 3

IsSomeMethod · 0.80
UnwrapMethod · 0.80
NextMethod · 0.65

Tested by 1

TestAnyFunction · 0.68