Here is a simple for comprehension to get all combinations of letters between two Lists
val two = List('a', 'b', 'c')
val three = List('d', 'e', 'f')
val res = for {
i <- two
j <- three
} yield s"$i$j"
println(res.mkString("[", ",", "]"))
// [ad, ae, af, bd, be, bf, cd, ce, cf]
Now, lets say we have a list of such lists
val list = List(two, three)
How do I write for comprehensions to get same result as first case? This list could be larger list like List(two, three, seven, nine) etc?
As @MateuszKubuszok suggested.