predicate

package
v0.2.43 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: Apache-2.0 Imports: 0 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type P

type P[T any] func(T) bool

P is a predicate function that tests whether a value of type T satisfies some condition.

func (P[T]) And

func (p P[T]) And(ps ...P[T]) P[T]

And returns a predicate that is a short-circuiting logical AND of this and the given predicates.

func (P[T]) Filter

func (p P[T]) Filter(s []T) []T

Filter returns a new slice holding only the elements of s that satisfy p. Filter modifies the contents of the slice s and returns the modified slice, which may have a smaller length.

func (P[T]) FilterCopy

func (p P[T]) FilterCopy(s []T) []T

FilterCopy returns a new slice holding only the elements of s that satisfy p.

func (P[T]) Negate

func (p P[T]) Negate() P[T]

Negate returns a predicate that is a logical negation of this predicate.

func (P[T]) Or

func (p P[T]) Or(ps ...P[T]) P[T]

Or returns a predicate that is a short-circuiting logical OR of this and the given predicates.

Jump to

Keyboard shortcuts

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