Created
September 30, 2009 03:33
-
-
Save chrislewis/197738 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def combine[T](sets: List[List[T]]): List[List[T]] = sets match { | |
| case List(l1, l2) => l1.flatMap(i1 => l2.map(List(i1, _))) | |
| case head :: tail => combine(tail).flatMap(set => head.map(_ :: set)) | |
| case _ => sets | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment