License | GNU LGPLv3 |
---|---|
Maintainer | paul.bittner@uni-ulm.de |
Safe Haskell | Safe |
A collection of functions that modify lists.
Synopsis
- safehead :: [a] -> Maybe a
- getRange :: Int -> Int -> [a] -> [a]
- insertAtIndex :: Int -> a -> [a] -> [a]
- insertListAtIndex :: Int -> [a] -> [a] -> [a]
- removeIndex :: Int -> [a] -> [a]
- removeRange :: Int -> Int -> [a] -> [a]
- removeDuplicates :: Eq a => [a] -> [a]
Documentation
safehead :: [a] -> Maybe a Source #
Returns the head of the given list as Just or Nothing, iff the list is empty.
getRange :: Int -> Int -> [a] -> [a] Source #
Returns a continuous sublist within the given range [i, j].
insertAtIndex :: Int -> a -> [a] -> [a] Source #
Inserts the given element into the given list at the given index. Subsequent elements will be pushed by one.
insertListAtIndex :: Int -> [a] -> [a] -> [a] Source #
Inserts all elements from the first list into the second list at the given index.
Similar to insertAtIndex
but inserts all elements of a list rather than just a single element.
removeIndex :: Int -> [a] -> [a] Source #
Removes the element at given index from the given list.
removeRange :: Int -> Int -> [a] -> [a] Source #
Removes all elements within the given range [i, j] from the given list.
removeDuplicates :: Eq a => [a] -> [a] Source #
Removes all duplicates from the given list.
If two elements are equal (w.r.t. to Eq
), the first one will be kept and the second one discarded.