I am trying to build a function which works on lists of lists. This function would take the 1rst element of each list inside the big list, put them into a list together, then do this for the 2nd element, etc. Ex:
tr[[1,2,3],[4,5,6]]
=> [[1,4],[2,5],[3,6]
It can work for any data type, but for now I am trying to make it work for Int
Here is what I have so far, just the data declaration and a case for empty input:
tr :: [[a]] -> [[a]]
tr [] = []
Any help is much appreciated, or even a pointer to a place with information. My idea is that it will use the ++ operator, and the x:xs manipulation of List elements. My problem is figuring out how to access the head of each list respectively, and not just the first list. I can get the 1 from the example using: head $ head [[1,2,3]].