Returns the index of an element of the non-empty list xs that minimizes f.
If x, y are such that f x = f y, it returns the index of whichever comes first
in the list.
The correctness of this function assumes β to be linearly pre-ordered.
Equations
- List.minIdxOn f (y :: ys) h_2 = List.minIdxOn.go✝ f y 0 1 ys
Instances For
Returns the index of an element of xs that minimizes f. If x, y
are such that f x = f y, it returns the index of whichever comes first in the list.
Returns none if the list is empty.
The correctness of this function assumes β to be linearly pre-ordered.
Equations
- List.minIdxOn? f [] = none
- List.minIdxOn? f (y :: ys) = some (List.minIdxOn f (y :: ys) ⋯)
Instances For
Returns the index of an element of the non-empty list xs that maximizes f.
If x, y are such that f x = f y, it returns the index of whichever comes first
in the list.
The correctness of this function assumes β to be linearly pre-ordered.
Equations
- List.maxIdxOn f xs h = List.minIdxOn f xs h
Instances For
Returns the index of an element of xs that maximizes f. If x, y
are such that f x = f y, it returns the index of whichever comes first in the list.
Returns none if the list is empty.
The correctness of this function assumes β to be linearly pre-ordered.
Equations
- List.maxIdxOn? f xs = List.minIdxOn? f xs