package number

import "github.com/IBM/fp-go/number"

Index

Functions

func Add

func Add[T Number](right T) func(T) T

Add is a curried function used to add two numbers

func Div

func Div[T Number](right T) func(T) T

Div is a curried function used to divide two numbers

func Inc

func Inc[T Number](value T) T

Inc is a function that increments a number

func MagmaDiv

func MagmaDiv[A Number]() M.Magma[A]

func MagmaSub

func MagmaSub[A Number]() M.Magma[A]

func Max

func Max[A C.Ordered](a, b A) A

Max takes the maximum of two values. If they are considered equal, the first argument is chosen

func Min

func Min[A C.Ordered](a, b A) A

Min takes the minimum of two values. If they are considered equal, the first argument is chosen

func MonoidProduct

func MonoidProduct[A Number]() M.Monoid[A]

MonoidProduct is the [Monoid] that multiplies elements with a one empty element

func MonoidSum

func MonoidSum[A Number]() M.Monoid[A]

MonoidSum is the [Monoid] that adds elements with a zero empty element

func Mul

func Mul[T Number](right T) func(T) T

Mul is a curried function used to multiply two numbers

func SemigroupProduct

func SemigroupProduct[A Number]() S.Semigroup[A]

func SemigroupSum

func SemigroupSum[A Number]() S.Semigroup[A]

func Sub

func Sub[T Number](right T) func(T) T

Sub is a curried function used to subtract two numbers

Types

type Number

type Number interface {
	C.Integer | C.Float | C.Complex
}

Source Files

magma.go monoid.go semigroup.go utils.go

Directories

PathSynopsis
number/integer
Version
v1.0.151 (latest)
Published
Nov 23, 2024
Platform
linux/amd64
Imports
4 packages
Last checked
4 months ago

Tools for package owners.