For assignment, I need to write some Haskell code, which has as input a finite list consisting of infinite lists of integers, with each list increasing monotonously.
Now I need to combine them into one list, which orders integers. In addition, some integers can be displayed in several lists: in the output list, each integer can be displayed only once in the list.
So, if the input is, for example, [[1, 2, 6, 10, 28, 40, ...] [3, 4, 10, 28, 100, ...], [any number of lists]], then the output should be [1, 2, 3, 4, 6, 10, 28, 40, 100, ...]
I'm a little stuck here. I do not know how to use foldr effectively to combine lists. I think I should compare the chapters of each list and make a new list out of it.
list functional-programming haskell
surfer1311
source share