package bounded

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

Index

Functions

func Clamp

func Clamp[T any](b Bounded[T]) func(T) T

Clamp returns a function that clamps against the bounds defined in the bounded type

Types

type Bounded

type Bounded[T any] interface {
	O.Ord[T]
	Top() T
	Bottom() T
}

func MakeBounded

func MakeBounded[T any](o O.Ord[T], t, b T) Bounded[T]

MakeBounded creates an instance of a bounded type

func Reverse

func Reverse[T any](b Bounded[T]) Bounded[T]

Reverse reverses the ordering and swaps the bounds

Source Files

bounded.go

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

Tools for package owners.