search

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All[V any](seq iter.Seq[V], predicate ...func(V) bool) bool

All returns true if all values in the iterator satisfy the predicate. If no predicate is provided, it defaults to checking if a value is a zero value for its type.

Example
package main

import (
	"fmt"
	"slices"

	"github.com/elordeiro/goext/algorithms/search"
)

func main() {
	seq := slices.Values([]bool{true, true, true, true, true})
	fmt.Println(search.All(seq))
}
Output:

true

func Any

func Any[V any](seq iter.Seq[V], predicate ...func(V) bool) bool

Any returns true if any value in the iterator satisfies the predicate. If no predicate is provided, it defaults to checking if a value is a zero value for its type.

Example
package main

import (
	"fmt"
	"slices"

	"github.com/elordeiro/goext/algorithms/search"
)

func main() {
	seq := slices.Values([]bool{true, false, true, false, true})
	fmt.Println(search.Any(seq))
}
Output:

true

func None

func None[V any](seq iter.Seq[V], predicate ...func(V) bool) bool

None returns true if no value in the iterator satisfies the predicate. If no predicate is provided, it defaults to checking if a value is a zero value for its type.

Example
package main

import (
	"fmt"
	"slices"

	"github.com/elordeiro/goext/algorithms/search"
)

func main() {
	seq := slices.Values([]bool{true, false, true, false, true})
	fmt.Println(search.None(seq))
}
Output:

false

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL