List operations, part of the Useful module.
- explodeI :: Eq a => [a] -> a -> [[a]]
- splitI :: Eq a => [a] -> a -> [[a]]
- implodeI :: Eq a => [a] -> a -> [a]
- joinI :: Eq a => [a] -> a -> [a]
- explode :: Eq a => [a] -> [a] -> [[a]]
- split :: Eq a => [a] -> [a] -> [[a]]
- implode :: Eq a => [[a]] -> [a] -> [a]
- join :: Eq a => [[a]] -> [a] -> [a]
- rmEmpty :: Eq a => [[a]] -> [[a]]
- map2 :: (a -> b) -> [[a]] -> [[b]]
- map3 :: (a -> b) -> [[[a]]] -> [[[b]]]
- map4 :: (a -> b) -> [[[[a]]]] -> [[[[b]]]]
- map5 :: (a -> b) -> [[[[[a]]]]] -> [[[[[b]]]]]
- replace :: Eq a => [a] -> [a] -> [a] -> [a]
- each :: [a] -> [[a]]
Documentation
explodeI :: Eq a => [a] -> a -> [[a]]Source
Takes a list item and splits a list around it, removing the item.
$ explodeI "Hello there people" ' ' ["Hello","there","people"]
implodeI :: Eq a => [a] -> a -> [a]Source
Take a list item and concatinates each element of it around another given item.
$implodeI "askjdnaskd" '!' "a!s!k!j!d!n!a!s!k!d"
explode :: Eq a => [a] -> [a] -> [[a]]Source
Takes a two lists and explodes the first into a new list, around the second. Removing the second list where it occurs.
$explode "hello there people" "ll" ["he","o there people"] $explode "hello there people" " " ["hello","there","people"]
implode :: Eq a => [[a]] -> [a] -> [a]Source
Takes a list of lists and an extra list and concatinates the list of lists with the second list inbetween. When used with the empty list mimics concat
$ implode ["helloasdad","asd hello","hello"] "!!" "helloasdad!!asd hello!!hello"
rmEmpty :: Eq a => [[a]] -> [[a]]Source
In a list of lists this removes any occurances of the empty list. Can also be used to remove occurances of the empty string.
$rmEmpty ["hello","","there","","people",""] ["hello","there","people"]
map2 :: (a -> b) -> [[a]] -> [[b]]Source
maps a function in depth N to the given list. map3, map4, map5 are also defined.
$ map2 (*2) [[1,2,3,4],[1,1,1,2]] [[2,4,6,8],[2,2,2,4]]