Copyright | (C) Frank Staals |
---|---|
License | see the LICENSE file |
Maintainer | Frank Staals |
Safe Haskell | None |
Language | GHC2021 |
Synopsis
- extractMinimaBy :: (a -> a -> Ordering) -> NonEmpty a -> NonEmpty a :+ [a]
Documentation
extractMinimaBy :: (a -> a -> Ordering) -> NonEmpty a -> NonEmpty a :+ [a] Source #
Extracts all minima from the list. The result consists of the list of minima, and all remaining points. Both lists are returned in the order in which they occur in the input.
>>>
extractMinimaBy compare $ NonEmpty.fromList [1,2,3,0,1,2,3,0,1,2,0,2]
0 :| [0,0] :+ [2,3,1,2,3,1,2,1,2]