Skip to content

Instantly share code, notes, and snippets.

@renanreismartins
Created March 3, 2022 10:37
Show Gist options
  • Save renanreismartins/804e4efe66e6ce95bdef1457787c3533 to your computer and use it in GitHub Desktop.
Save renanreismartins/804e4efe66e6ce95bdef1457787c3533 to your computer and use it in GitHub Desktop.
val combinationsLetters = (for {
(i, idi) <- List("A", "B", "C", "D", "E").zipWithIndex
(j, idj) <- List("A", "B", "C", "D", "E").zipWithIndex.take(idi)
(k, _) <- List("A", "B", "C", "D", "E").zipWithIndex.take(idj)
} yield (i, j, k))
val combinationsNumbers = (for {
(i, idi) <- List("1", "2", "3").zipWithIndex
(j, _) <- List("1", "2", "3").zipWithIndex.take(idi)
} yield (i, j))
val combinationsAll = (for {
i <- combinationsLetters
j <- combinationsNumbers
} yield (i, j))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment