I want to create a flatten function, which will take List of various depth and transform it to a flat list.
For example, for integers it can take List(1, List(2, 3)) and return List(1, 2, 3).
How to declare this function correctly?
def flatten(list: List[???]): List[T]
A(Int, in this case) orRecursiveList[A]?RecursiveList[A]and then the functiondef flatten[A](xs: RecursiveList[A]): List[A]be what you want?List[Any). Scala lists are homogenous.