I\'m able to easily achieve this in Scala with something like:
def permute(xs: List[Int], ys: List[Int]) = { for {x <- xs; y <- ys} yield (x,y) }