gi2op

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 gi2op provides a set of binary operators on pairs of values for generic iterator combinators.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add[V1, V2 constraints.Number](l1 V1, l2 V2, r1 V1, r2 V2) (V1, V2)

Add returns sum of l1 and r1 and sum of l2 and r2.

func BinaryAnd

func BinaryAnd[V1, V2 constraints.Integer](l1 V1, l2 V2, r1 V1, r2 V2) (V1, V2)

BinaryAnd returns the binary "and" of l1 and l2 and binary "and" of r1 and r2.

func BinaryOr

func BinaryOr[V1, V2 constraints.Integer](l1 V1, l2 V2, r1 V1, r2 V2) (V1, V2)

BinaryOr returns the binary "or" of l1 and l2 and binary "or" of r1 and r2.

func BinaryXor

func BinaryXor[V1, V2 constraints.Integer](l1 V1, l2 V2, r1 V1, r2 V2) (V1, V2)

BinaryXor returns the binary "xor" of l1 and l2 and binary "xor" of r1 and r2.

func Divide

func Divide[V1, V2 constraints.Number](l1 V1, l2 V2, r1 V1, r2 V2) (V1, V2)

Divide returns quotient of l1 and r1 and quotient of l2 and r2.

func IntMod

func IntMod[V1, V2 constraints.Integer](l1 V1, l2 V2, r1 V1, r2 V2) (V1, V2)

IntMod returns integer remainder of l1 and r1 and integer remainder of l2 and r2.

func Max

func Max[V1, V2 constraints.Ordered](l1 V1, l2 V2, r1 V1, r2 V2) (V1, V2)

Max returns the maximum value of the left and right.

func MaxBy

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

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

func MaxByLeft

func MaxByLeft[V1 constraints.Ordered, V2 any](l1 V1, l2 V2, r1 V1, r2 V2) (V1, V2)

MaxByLeft returns the pair with the maximum left value.

func MaxByRight

func MaxByRight[V1 any, V2 constraints.Ordered](l1 V1, l2 V2, r1 V1, r2 V2) (V1, V2)

MaxByRight returns the pair with the maximum right value.

func Min

func Min[V1, V2 constraints.Ordered](l1 V1, l2 V2, r1 V1, r2 V2) (V1, V2)

Min returns the minimum value of the left and right.

func MinBy

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

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

func MinByLeft

func MinByLeft[V1 constraints.Ordered, V2 any](l1 V1, l2 V2, r1 V1, r2 V2) (V1, V2)

MinByLeft returns the pair with the minimum left value.

func MinByRight

func MinByRight[V1 any, V2 constraints.Ordered](l1 V1, l2 V2, r1 V1, r2 V2) (V1, V2)

MinByRight returns the pair with the minimum right value.

func Mod

func Mod[V1, V2 constraints.Float](l1 V1, l2 V2, r1 V1, r2 V2) (V1, V2)

Mod returns math.Mod(l1, r1) and math.Mod(l2, r2).

func Multiply

func Multiply[V1, V2 constraints.Number](l1 V1, l2 V2, r1 V1, r2 V2) (V1, V2)

Multiply returns product of l1 and r1 and product of l2 and r2.

func Subtract

func Subtract[V1, V2 constraints.Number](l1 V1, l2 V2, r1 V1, r2 V2) (V1, V2)

Subtract returns difference of l1 and r1 and difference of l2 and r2.

Types

This section is empty.

Jump to

Keyboard shortcuts

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