Given the following list:
List(List(1,2,3), List(4,5))
I would like to generate all the possible combinations. Using yield, it
Feels like your problem can be described in terms of recursion:
If you have n lists of int: list1 of size m and list2, ... list n
so with List(List(1,2), List(3), List(4, 5)) the result of your recursive call is List(List(3,4),List(3,5)) and for each you add 2 combinations: List(1,3,4), List(2,3,4), List(1,3,5), List(2,3,5).