I am trying to use a recursive function that prints all lists that has the maximum length out of the lists ( could be one or more if they have the same length)
given an input such as :
[[],[3],[2],[6],[3,6],[2,6],[4],[3,4],[2,4],[5],[3,5],[2,5],[4,5],[3,4,5],[2,4,5],[1]]
the output should contain both the longest lists :
[3,4,5],[2,4,5]
My following function prints only the first list: [3,4,5]
longest :: Ord a => [[a]] -> [a]
longest [y] = y --base case: if there's only one element left, return it.
longest (x:y:lst) --extract the first two elements x, y from the list.
| length x < length y = longest (y:lst)
| otherwise = longest (x:lst)
Note: I must used recuersion