Haskell platform proposal: split package

Roman Leshchinskiy rl at cse.unsw.edu.au
Tue Jul 24 15:31:03 CEST 2012

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)) ([],[]).


More information about the Libraries mailing list