Skip to content

Instantly share code, notes, and snippets.

@pavlov99
Created July 19, 2016 07:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pavlov99/be6000fe6a1bb5da287fd3c09eaa7f0c to your computer and use it in GitHub Desktop.
Save pavlov99/be6000fe6a1bb5da287fd3c09eaa7f0c to your computer and use it in GitHub Desktop.
def combine[T](s: Seq[T]): Seq[Seq[T]] =
for {
len <- 1 to s.length
combinations <- s combinations len
} yield combinations
println(combine(List('a', 'b', 'c')))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment