
24 Jul
2012
24 Jul
'12
9:31 a.m.
Twan van Laarhoven wrote:
I just needed a function for splitting a list into two equal parts. This is something you often need for MergeSort-like functions. Is that something that belongs in Data.List.Split?
If you don't care about the order of elements (which merge sort doesn't), then this will do the trick: foldr (\x (ys,zs) -> (zs,x:ys)) ([],[]). Roman