
Hi
What do people think of adding these?
split is sorely lacking, and definately needs to be included. However, my version is different to yours: split :: Eq a => a -> [a] -> [[a]] split x [] = [] split x xs = if null b then [a] else a : split x (tail b) where (a,b) = break (== x) xs split '*' "hello*neil" = ["hello","neil"] While with yours: split '*' "hello*neil" = ["hello","*","neil"] I much prefer mine. Didn't the bytestring people add it, under some gise, to their library? It should be consistent with that.
and perhaps a better name for split'
A better name is essential. split' should be for the strict version of split, not something quite different.
On a secondary note, but less important than the foregoing, I'd like to add two functions: 'replace' and 'replaceBy'. They do basically what they sound like: given two items, change every occurrence in a given list of one item to another.
I commonly define: rep :: Eq a => a -> a -> a rep from to x = if x == from then to else x Now you can do replace with map rep. Still, replace and replaceBy might be useful to have. Thanks Neil