[Haskell-beginners] how to split a list

PICCA Frederic-Emmanuel frederic-emmanuel.picca at synchrotron-soleil.fr
Mon Mar 26 17:52:58 UTC 2018


Hello, I try to achieve this but I can not find a convenient (elegant solution)

let l =[1,2, 3, 4, 6, 7, 9, 10]

I want this

[[1, 2, 3, 4][6, 7],[9, 10]]

In fact I want to split a list with all consecutive series.

I imagine that it existe a one-liner for this but I did not find it :))

Cheers and thanks for your help

Frederic


More information about the Beginners mailing list