hgeometry-combinatorial
Copyright(C) Frank Staals
Licensesee the LICENSE file
MaintainerFrank Staals
Safe HaskellNone
LanguageGHC2021

HGeometry.NonEmpty.Util

Description

 
Synopsis

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]