This module defines some generic list and related helper functions.
- select :: (a -> Bool) -> [a] -> [b] -> [b]
- deleteIndex :: [a] -> Int -> [a]
- subset :: Eq a => [a] -> [a] -> Bool
- equiv :: Eq a => [a] -> [a] -> Bool
- addSetElem :: Eq a => a -> [a] -> [a]
- headOrNothing :: [Maybe a] -> Maybe a
- pairUngroup :: (a, [b]) -> [(a, b)]
- pairSort :: Ord a => [(a, b)] -> [(a, b)]
- pairGroup :: Ord a => [(a, b)] -> [(a, [b])]
- breakAll :: (a -> Bool) -> [a] -> [[a]]
- powerSet :: [a] -> [[a]]
- permutations :: [a] -> [[a]]
- listProduct :: [[a]] -> [[a]]
- powerSequencesLen :: Int -> [a] -> [[a]]
- flist :: [a -> b] -> a -> [b]
- allp :: [a -> Bool] -> a -> Bool
- anyp :: [a -> Bool] -> a -> Bool
Select is like filter, except that it tests one list to select elements from a second list.
Delete the n'th element of a list, returning the result
If the list doesn't have an n'th element, return the list unchanged.
Return head of a list of
Nothing if list is empty
filter isJust to select a non-Nothing value from a
list when such a value is present.
Break list into a list of sublists, separated by element satisfying supplied condition.
Powerset of a list, in ascending order of size. Assumes the supplied list has no duplicate elements.
Given a list of lists, construct a new list of lists where each member of the new list is the same length as the original list, and each member corresponds to a different choice of one element from each of the original members in the corresponding position. Thus:
listProduct [[a1,a2],[b1],[c1,c2]] = [ [a1,b1,c1], [a1,b1,c2], [a2,b1,c1], [a2,b1,c2] ]
Note: The length of the resulting list is the prodicty of lengths of the components of the original list. Thus, if any member of the original list is empty then so is the resulting list:
listProduct [[a1,a2],,[c1,c2]] = 
NOTE: this is subsumed by
Apply list of functions to some value, returning list of results. It's kind of like an converse map.
This is similar to the
ap function in the Monad library.