On 18 November 2012 11:33, Kim-Ee Yeoh <ky3@atamo.com> wrote:
On Sun, Nov 18, 2012 at 4:47 PM, Tobias Brandt <tob.brandt@googlemail.com> 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)