Skip to content

Instantly share code, notes, and snippets.

View stephendavidmarsh's full-sized avatar

Stephen Marsh stephendavidmarsh

View GitHub Profile
def zipAll[T](seqs: Seq[T]*): List[List[T]] = {
def loop(seqs: List[Seq[T]]): List[List[T]] = {
if (seqs.isEmpty)
List(List())
else {
val s = loop(seqs.tail)
seqs.head.flatMap(x => s.map(x :: _))(collection.breakOut)
}
}
loop(seqs.toList)