Useful 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]
- takeFor :: Eq a => Int -> [a] -> [a]
- dropFor :: Eq a => Int -> [a] -> [a]
- takeBefore :: Eq a => Int -> [a] -> [a]
- dropBefore :: Eq a => Int -> [a] -> [a]
- rmEmptyList :: Eq a => [[a]] -> [[a]]
- map2 :: (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.

THIS NEEDS FIXING

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"

takeFor :: Eq a => Int -> [a] -> [a]Source

takes n number of items from the front of a list, alias of take

$ takeFor 5 "Hello there people" "Hello"

dropFor :: Eq a => Int -> [a] -> [a]Source

drops n number of items from the front of a list, alias of drop

$ dropFor 5 "Hello there people" " there people"

takeBefore :: Eq a => Int -> [a] -> [a]Source

takes a number of items from a list before it reaches the index n

$ takeBefore 5 "Hello there people" "Hello there p"

dropBefore :: Eq a => Int -> [a] -> [a]Source

drops a number of items from a list before it reaches the index n

$ dropBefore 5 "Hello there people" "eople"

rmEmptyList :: 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.

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]]