I'm very new to Haskell. I did try it for a few days, a few years ago... but other than that, this is my second day. I'm equally unused to functional programming, by the way.After much trial and error, I managed to write this function:chunk :: Int -> [a] -> [[a]]chunk n xs = chunk' n [] xs    where    chunk' _ results [] = results    chunk' n results xs        | length xs >= n = chunk' n (results ++ [take n xs]) $ tail xs        | otherwise = chunk' n results []This creates a list of all possible length n sub-lists, like so:*Main> chunk 3 [1..7][[1,2,3],[2,3,4],[3,4,5],[4,5,6],[5,6,7]]*Main> chunk 5 [1..7][[1,2,3,4,5],[2,3,4,5,6],[3,4,5,6,7]]How can this be improved (in readability, performance, brevity etc.)?
Splitting a list into overlapping sub-lists
beginner;haskell