
18 Nov
2012
18 Nov
'12
10:53 a.m.
On 18 November 2012 11:33, Kim-Ee Yeoh
On Sun, Nov 18, 2012 at 4:47 PM, Tobias Brandt
wrote: split xs = getSnds $ span (uncurry (<)) $ zip xs (tail xs)
where getSnds (as, bs) = (map snd as, map snd bs)
You could prepend negative infinity to not lose the first element.
Oops, didn't noticed that, nice catch. I'd rather do the following, as it works for all types that can be compared with (<), not just for numbers: split xs = getSnds $ span (uncurry (<)) $ zip xs (tail xs) where getSnds (as, bs) = (head xs : map snd as, map snd bs)