On 18 November 2012 11:33, Kim-Ee Yeoh <span dir="ltr">&lt;<a href="mailto:ky3@atamo.com" target="_blank">ky3@atamo.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Sun, Nov 18, 2012 at 4:47 PM, Tobias Brandt <span dir="ltr">&lt;<a href="mailto:tob.brandt@googlemail.com" target="_blank">tob.brandt@googlemail.com</a>&gt;</span> wrote:<div class="im"><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<div>split xs = getSnds $ span (uncurry (&lt;)) $ zip xs (tail xs)</div><div>    where getSnds (as, bs) = (map snd as, map snd bs)</div></blockquote><div><br></div></div><div>You could prepend negative infinity to not lose the first element.</div>
<span class="HOEnZb"><font color="#888888">

<div>  </div></font></span></blockquote><div><br></div><div>Oops, didn&#39;t noticed that, nice catch. I&#39;d rather do the following, as it works for all types that can be compared with (&lt;), not just for numbers:</div>
<div><br></div><div><div>split xs = getSnds $ span (uncurry (&lt;)) $ zip xs (tail xs)</div><div>    where getSnds (as, bs) = (head xs : map snd as, map snd bs)</div></div></div>