
On Thu, 10 Jul 2008, David Roundy wrote:
On Fri, Jul 11, 2008 at 12:11:15AM +0100, Neil Mitchell wrote:
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:
I would suggest that when everyone defines a different version of a function, then it isn't actually such a good function to put into the standard libraries.
I think the problem is, that there is no commonly agreed data structure for a list of alternating elements, like this one: http://darcs.haskell.org/event-list/src/Data/AlternatingList/List/Uniform.hs With this intermediate form, you could have a generic 'split' function split :: (a -> Bool) -> [a] -> AlternatingList a [a] from which you can derive several flavours easily, by extracting only the [a] elements, or by turning 'a' into [a] and flatten the alternating list then, or by fusing pairs of 'a' and [a].