Skip to content

Instantly share code, notes, and snippets.

@oisdk
Created June 15, 2015 16:41
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 oisdk/5087c475c5f2d33abdab to your computer and use it in GitHub Desktop.
Save oisdk/5087c475c5f2d33abdab to your computer and use it in GitHub Desktop.
func everyOf<T>(var seqs: [[T]]) -> [[T]] {
return seqs.isEmpty ? [[]] :
{ f in everyOf(seqs).flatMap { s in f.map{ s + [$0] }}}( seqs.removeLast() )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment