
3 Nov
2015
3 Nov
'15
5:12 a.m.
Hello, I am looking for such function: function :: Ord a => [a] -> [a] -> [[a]] function [1,3,6] [0..6] == [[0,1],[2,3],[4,5,6]] Question: does it exist already ? If no, continue: Let: partIt :: Ord a => a -> [a] -> [[a]] partIt m xs = [takeWhile (<= m) xs, dropWhile (<= m) xs] example: partIt 1 [0..5] == [[0,1],[2,3,4,5]] Question: How to define recursively partIt 1) with a list as parameter ? 2) recursively on the second part of the list ? Thanks for help, -- Alexandre Delanoƫ