Copyright | (C) Frank Staals |
---|---|
License | see the LICENSE file |
Maintainer | Frank Staals |
Safe Haskell | None |
Language | Haskell2010 |
Documentation
>>>
let ordList = C.fromList [5,6,10,20,30,1,2,3]
insertOrd :: Ord a => a -> CList a -> CList a Source #
Given a circular list, whose elements are in increasing order, insert the new element into the Circular list in its sorted order.
>>>
insertOrd 1 C.empty
fromList [1]>>>
insertOrd 1 $ C.fromList [2]
fromList [2,1]>>>
insertOrd 2 $ C.fromList [1,3]
fromList [1,2,3]>>>
insertOrd 31 ordList
fromList [5,6,10,20,30,31,1,2,3]>>>
insertOrd 1 ordList
fromList [5,6,10,20,30,1,1,2,3]>>>
insertOrd 4 ordList
fromList [5,6,10,20,30,1,2,3,4]>>>
insertOrd 11 ordList
fromList [5,6,10,11,20,30,1,2,3]
insertOrdBy :: (a -> a -> Ordering) -> a -> CList a -> CList a Source #
Insert an element into an increasingly ordered circular list, with specified compare operator.
insertOrdBy' :: (a -> a -> Ordering) -> a -> [a] -> [a] Source #
List version of insertOrdBy; i.e. the list contains the elements in cirulcar order. Again produces a list that has the items in circular order.