|
Data.List.Extras.Argmax | Portability | portable | Stability | experimental | Maintainer | wren@community.haskell.org |
|
|
|
|
|
Description |
This module provides variants of the maximum and minimum
functions which return the elements for which some function is
maximized or minimized.
|
|
Synopsis |
|
|
|
|
Utility functions
|
|
|
Apply a list function safely, i.e. when the list is non-empty.
All other functions will throw errors on empty lists, so use
this to make your own safe variations.
|
|
Generic versions
|
|
|
Return an element of the list which maximizes the function
according to a user-defined ordering.
|
|
|
Return all elements of the list which maximize the function
according to a user-defined ordering.
|
|
argmaxWithMaxBy :: (b -> b -> Ordering) -> (a -> b) -> [a] -> (a, b) | Source |
|
Return an element of the list which maximizes the function
according to a user-defined ordering, and return the value of
the function at that element as well.
|
|
argmaxesWithMaxBy :: (b -> b -> Ordering) -> (a -> b) -> [a] -> ([a], b) | Source |
|
Return all elements of the list which maximize the function
according to a user-defined ordering, and return the value of
the function at those elements as well.
|
|
Maximum variations
|
|
argmax :: Ord b => (a -> b) -> [a] -> a | Source |
|
Return an element of the list which maximizes the function.
|
|
argmaxes :: Ord b => (a -> b) -> [a] -> [a] | Source |
|
Return all elements of the list which maximize the function.
|
|
argmaxWithMax :: Ord b => (a -> b) -> [a] -> (a, b) | Source |
|
Return an element of the list which maximizes the function,
and return the value of the function at that element as well.
|
|
argmaxesWithMax :: Ord b => (a -> b) -> [a] -> ([a], b) | Source |
|
Return all elements of the list which maximize the function,
and return the value of the function at those elements as well.
|
|
Minimum variations
|
|
argmin :: Ord b => (a -> b) -> [a] -> a | Source |
|
Return an element of the list which minimizes the function.
|
|
argmins :: Ord b => (a -> b) -> [a] -> [a] | Source |
|
Return all elements of the list which minimize the function.
|
|
argminWithMin :: Ord b => (a -> b) -> [a] -> (a, b) | Source |
|
Return an element of the list which minimizes the function,
and return the value of the function at that element as well.
|
|
argminsWithMin :: Ord b => (a -> b) -> [a] -> ([a], b) | Source |
|
Return all elements of the list which minimize the function,
and return the value of the function at those elements as well.
|
|
Produced by Haddock version 2.7.2 |