giop

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package giop provides a set of binary operators on scalar values for generic iterator combinators.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add[T constraints.Number](left T, right T) T

Add returns sum of left and right.

func And

func And(left, right bool) bool

And returns true if both left and right are true.

func BinaryAnd

func BinaryAnd[T constraints.Integer](left, right T) T

BinaryAnd returns the binary "and" of the left and right.

func BinaryOr

func BinaryOr[T constraints.Integer](left, right T) T

BinaryOr returns the binary "or" of the left and right.

func BinaryXor

func BinaryXor[T constraints.Integer](left, right T) T

BinaryXor returns the binary "xor" of the left and right.

func Divide

func Divide[T constraints.Number](left T, right T) T

Divide returns integer part of left / right.

func IntMod

func IntMod[T constraints.Integer](left T, right T) T

IntMod returns integer remainder of left / right.

func Max

func Max[T constraints.Ordered](left, right T) T

Max returns the maximum value of the left and right.

func MaxBy

func MaxBy[T any, K constraints.Ordered, Key ~func(T) K](key Key) func(T, T) T

MaxBy returns a function that returns the maximum value of the left and right using provided key function for comparison.

func MaxByCompare

func MaxByCompare[T constraints.OrderedByCompare[T]](left, right T) T

MaxByCompare returns the maximum value of the left and right using Compare method for comparison.

func MaxByCompareFunc

func MaxByCompareFunc[T any, F ~func(T, T) int](compare F) func(left, right T) T

MaxByCompareFunc returns a function that returns the maximum value of the left and right using provided compare function for comparison.

func MaxByLess

func MaxByLess[T constraints.OrderedByLess[T]](left, right T) T

MaxByLess returns the maximum value of the left and right using Less method for comparison.

func MaxByLessFunc

func MaxByLessFunc[T any, F ~func(T, T) bool](less F) func(left, right T) T

MaxByLessFunc returns a function that returns the maximum value of the left and right using provided less function for comparison.

func Min

func Min[T constraints.Ordered](left, right T) T

Min returns the minimum value of the left and right.

func MinBy

func MinBy[T any, K constraints.Ordered, Key ~func(T) K](key Key) func(T, T) T

MinBy returns a function that returns the minimum value of the left and right using provided key function for comparison.

func MinByCompare

func MinByCompare[T constraints.OrderedByCompare[T]](left, right T) T

MinByCompare returns the minimum value of the left and right using Compare method for comparison.

func MinByCompareFunc

func MinByCompareFunc[T any, F ~func(T, T) int](compare F) func(left, right T) T

MinByCompareFunc returns a function that returns the minimum value of the left and right using provided compare function for comparison.

func MinByLess

func MinByLess[T constraints.OrderedByLess[T]](left, right T) T

MinByLess returns the minimum value of the left and right using Less method for comparison.

func MinByLessFunc

func MinByLessFunc[T any, F ~func(T, T) bool](less F) func(left, right T) T

MinByLessFunc returns a function that returns the minimum value of the left and right using provided less function for comparison.

func Mod

func Mod[T constraints.Float](left T, right T) T

Mod returns math.Mod(left, right).

func Multiply

func Multiply[T constraints.Number](left T, right T) T

Multiply returns product of left and right.

func Or

func Or(left, right bool) bool

Or returns true if either left or right is true.

func Subtract

func Subtract[T constraints.Number](left T, right T) T

Subtract returns difference of left and right.

func Xor

func Xor(left, right bool) bool

Xor returns true if either left or right is true, but not both.

Types

This section is empty.

Jump to

Keyboard shortcuts

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