Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Utils.Drasil.Lists
Description
Functions for working with lists.
Synopsis
- atLeast2 :: [a] -> Bool
- replaceAll :: Eq a => [a] -> a -> [a] -> [a]
- subsetOf :: Eq a => [a] -> [a] -> Bool
- nubSort :: Ord a => [a] -> [a]
- weave :: [[a]] -> [a]
- foldle :: (a -> a -> a) -> (a -> a -> a) -> a -> [a] -> a
- foldle1 :: (a -> a -> a) -> (a -> a -> a) -> [a] -> a
- toColumn :: [a] -> [[a]]
- mkTable :: [a -> b] -> [a] -> [[b]]
Documentation
replaceAll :: Eq a => [a] -> a -> [a] -> [a] Source #
Replaces all elements of a target list that belong to a provided "bad" input list.
foldle :: (a -> a -> a) -> (a -> a -> a) -> a -> [a] -> a Source #
Fold helper function that applies f to all but the last element, applies g to last element and the accumulator.
foldle1 :: (a -> a -> a) -> (a -> a -> a) -> [a] -> a Source #
Fold helper function that applies f to all but last element, applies g to last element and accumulator without starting value, does not work for empty list.
mkTable :: [a -> b] -> [a] -> [[b]] Source #
Create a table body (not including header row) by applying the given functions to the column elements of the table rows (in order). The first argument is a list of functions to be applied (one per column). This essentially creates the rows. The second argument is a list of elements apply the functions to.
For example, mkTable [id, *5] [1,2,3]
should produce a table:
| 1 | 5 | | 2 | 10 | | 3 | 15 |