Skip to content

Instantly share code, notes, and snippets.

@echojc
Last active December 17, 2015 17:39
Show Gist options
  • Select an option

  • Save echojc/5647219 to your computer and use it in GitHub Desktop.

Select an option

Save echojc/5647219 to your computer and use it in GitHub Desktop.
def transpose[T](list: List[List[T]]): List[T] =
if (list.isEmpty) Nil
else (list map { _.head }) :::
transpose(list map { _.tail} filter { !_.isEmpty })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment