Splitting lists inside list haskell
- by user3713267
Hi I need to split list by an argument in Haskell. I found function like this
group :: Int -> [a] -> [[a]]
group _ [] = []
group n l
| n > 0 = (take n l) : (group n (drop n l))
| otherwise = error "Negative n"
But what if lists that I want to divide are contained by another list?
For example
group 3 [[1,2,3,4,5,6],[2,4,6,8,10,12]]
should return
[[[1,2,3],[4,5,6]],[[2,4,6],[8,10,12]]]
Is there any way to do that ?