Useful 0.0.1 → 0.0.2
raw patch · 2 files changed
+2/−12 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Useful.List: initList :: a -> Int -> [a]
Files
- Useful.cabal +1/−1
- Useful/List.hs +1/−11
Useful.cabal view
@@ -1,5 +1,5 @@ Name: Useful -Version: 0.0.1 +Version: 0.0.2 Cabal-Version: >= 1.2 License: BSD3 Author: Daniel Holden
Useful/List.hs view
@@ -4,7 +4,6 @@ import Useful.General import Data.List - -- | Takes a list item and splits a list around it, removing the item. -- -- > $ explodeI "Hello there people" ' ' @@ -50,7 +49,7 @@ |x == [] = [] |y == [] = [x] |buff == len y = (takeBefore buff (fst splut)) : ( explode'' (snd splut) y 0 0) -- If the buffer is full (match found). Then split and remove match from fst, cons onto the explode'' of the second part. - |(len x < count) && ((x !! count) ? y) = explode'' x y (((x !! count) ?! y )+1) (count+1) -- is x !! count in y? If so then find at which position and explode'' with that +1 as the new buffer. + |((x !! count) ? y) = explode'' x y (((x !! count) ?! y )+1) (count+1) -- is x !! count in y? If so then find at which position and explode'' with that +1 as the new buffer. |otherwise = explode'' x y 0 (count+1) -- otherwise increment the counter. where splut = (splitAt count x) @@ -134,15 +133,6 @@ map3 f x = map (map (map f)) x map4 f x = map (map (map (map f))) x map5 f x = map (map (map (map (map f)))) x - - --- | returns a list of size n filled with items x --- --- > $ initList 0 5 --- > [0,0,0,0,0] -initList :: a -> Int -> [a] -initList x 0 = [] -initList x n = x : (initList x (n-1)) -- | Replaces any occuranses of the second list, with the third list, in the first list. --