/ totd

TOTD: Scala - For Comprehensions

Given two lists, that multiply their cross product:

for (x <- xs; y <- ys) yield x * y

This is syntactic sugar and equivalent to:

xs.flatMap { x => ys.map { y => x * y } }