
12 Jul
2011
12 Jul
'11
5:57 a.m.
On 12.07.2011 11:44, Roelof Wobben wrote:
So I thought this would work . halve (xs) | length xs == 0 = []
This returns a list
| length xs `mod`2 == 0 = (take n xs, drop n xs) | otherwise = (take (n+1) xs, drop (n+1) xs)
These return a pair of two lists each.
where n = length xs `div`2
You probably want to return a pair of empty lists in the first case, too. HTH, Thomas