subG-0.6.1.0: Some extension to the Foldable and Monoid classes.
Copyright(c) OleksandrZhabenko 2020-2023
LicenseMIT
Maintaineroleksandr.zhabenko@yahoo.com
StabilityExperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.MinMax3Plus

Description

Functions to find both minimum and maximum elements of the Foldable structure of the Ordered elements.

Synopsis

Documentation

minMax23 :: (Ord a, InsertLeft t a, Monoid (t a)) => t a -> ((a, a), (a, a, a)) Source #

Given a finite structure returns a tuple with two minimum elements and three maximum elements. Uses just three passes through the structure, so may be more efficient than some other approaches.

minMax23By :: (Ord a, InsertLeft t a, Monoid (t a)) => (a -> a -> Ordering) -> t a -> ((a, a), (a, a, a)) Source #

A variant of the minMax23 where you can specify your own comparison function.

minMax32 :: (Ord a, InsertLeft t a, Monoid (t a)) => t a -> ((a, a, a), (a, a)) Source #

Given a finite structure returns a tuple with three minimum elements and two maximum elements. Uses just three passes through the structure, so may be more efficient than some other approaches.

minMax32By :: (Ord a, InsertLeft t a, Monoid (t a)) => (a -> a -> Ordering) -> t a -> ((a, a, a), (a, a)) Source #

A variant of the minMax32 where you can specify your own comparison function.

minMax33 :: (Ord a, InsertLeft t a, Monoid (t a)) => t a -> ((a, a, a), (a, a, a)) Source #

Given a finite structure returns a tuple with three minimum elements and three maximum elements. Uses just three passes through the structure, so may be more efficient than some other approaches.

minMax33By :: (Ord a, InsertLeft t a, Monoid (t a)) => (a -> a -> Ordering) -> t a -> ((a, a, a), (a, a, a)) Source #

A variant of the minMax33 where you can specify your own comparison function.